Files
Phraseanet/tests/Alchemy/Tests/Phrasea/Notification/AttachmentTest.php
Jean-Yves Gaulier 1f7c5718be nop
2014-12-11 15:31:49 +01:00

41 lines
966 B
PHP

<?php
namespace Alchemy\Tests\Phrasea\Notification;
use Alchemy\Phrasea\Notification\Attachment;
class AttachmentTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Attachment
*/
protected $object;
protected $tempFile;
protected function setUp()
{
$this->tempFile = tempnam(null, 'attachment');
$this->object = new Attachment($this->tempFile, 'test.txt', 'text/plain');
}
/**
* @covers Alchemy\Phrasea\Notification\Attachment::As_Swift_Attachment
*/
public function testAsSwiftAttachment()
{
/** @var $a \Swift_Mime_Attachment */
$swa = $this->object->As_Swift_Attachment();
$this->assertInstanceOf('Swift_Attachment', $swa);
$this->assertEquals($swa->getContentType(), 'text/plain');
$this->assertEquals($swa->getFilename(), 'test.txt');
unset($swa);
}
public function tearDown()
{
unlink($this->tempFile);
}
}