scratch – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
115 | office | 1 | <?php |
2 | |||
3 | /* |
||
4 | * This file is part of the Symfony package. |
||
5 | * |
||
6 | * (c) Fabien Potencier <fabien@symfony.com> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Symfony\Component\Filesystem\Tests; |
||
13 | |||
14 | use PHPUnit\Framework\TestCase; |
||
15 | use Symfony\Component\Filesystem\Exception\IOException; |
||
16 | use Symfony\Component\Filesystem\Exception\FileNotFoundException; |
||
17 | |||
18 | /** |
||
19 | * Test class for Filesystem. |
||
20 | */ |
||
21 | class ExceptionTest extends TestCase |
||
22 | { |
||
23 | public function testGetPath() |
||
24 | { |
||
25 | $e = new IOException('', 0, null, '/foo'); |
||
26 | $this->assertEquals('/foo', $e->getPath(), 'The pass should be returned.'); |
||
27 | } |
||
28 | |||
29 | public function testGeneratedMessage() |
||
30 | { |
||
31 | $e = new FileNotFoundException(null, 0, null, '/foo'); |
||
32 | $this->assertEquals('/foo', $e->getPath()); |
||
33 | $this->assertEquals('File "/foo" could not be found.', $e->getMessage(), 'A message should be generated.'); |
||
34 | } |
||
35 | |||
36 | public function testGeneratedMessageWithoutPath() |
||
37 | { |
||
38 | $e = new FileNotFoundException(); |
||
39 | $this->assertEquals('File could not be found.', $e->getMessage(), 'A message should be generated.'); |
||
40 | } |
||
41 | |||
42 | public function testCustomMessage() |
||
43 | { |
||
44 | $e = new FileNotFoundException('bar', 0, null, '/foo'); |
||
45 | $this->assertEquals('bar', $e->getMessage(), 'A custom message should be possible still.'); |
||
46 | } |
||
47 | } |