1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
<?php
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
class Swift_Bug274Test extends \PHPUnit\Framework\TestCase
{
public function testEmptyFileNameAsAttachment()
{
$this->expectException(\Swift_IoException::class);
$this->expectExceptionMessage('The path cannot be empty');
$message = new Swift_Message();
$message->attach(Swift_Attachment::fromPath(''));
}
#[DoesNotPerformAssertions]
public function testNonEmptyFileNameAsAttachment()
{
$message = new Swift_Message();
try {
$message->attach(Swift_Attachment::fromPath(__FILE__));
} catch (Exception $e) {
$this->fail('Path should not be empty');
}
}
}
|