File: Bug274Test.php

package info (click to toggle)
libphp-swiftmailer 6.3.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,164 kB
  • sloc: php: 27,203; sh: 36; makefile: 16
file content (26 lines) | stat: -rw-r--r-- 737 bytes parent folder | download
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');
        }
    }
}