scratch – Blame information for rev 126
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
126 | office | 1 | <?php |
2 | namespace Aura\Uri; |
||
3 | |||
4 | /** |
||
5 | * Test class for Path. |
||
6 | * Generated by PHPUnit on 2012-07-21 at 15:45:14. |
||
7 | */ |
||
8 | class PathTest extends \PHPUnit_Framework_TestCase |
||
9 | { |
||
10 | /** |
||
11 | * @var Path |
||
12 | */ |
||
13 | protected $path; |
||
14 | |||
15 | /** |
||
16 | * Sets up the fixture, for example, opens a network connection. |
||
17 | * This method is called before a test is executed. |
||
18 | */ |
||
19 | protected function setUp() |
||
20 | { |
||
21 | parent::setUp(); |
||
22 | $this->path = new Path; |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Tears down the fixture, for example, closes a network connection. |
||
27 | * This method is called after a test is executed. |
||
28 | */ |
||
29 | protected function tearDown() |
||
30 | { |
||
31 | parent::tearDown(); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @covers Aura\Uri\Path::__toString |
||
36 | */ |
||
37 | public function test__toString() |
||
38 | { |
||
39 | $path = '/foo/bar/baz/dib.gir'; |
||
40 | $this->path->setFromString($path); |
||
41 | $actual = $this->path->__toString(); |
||
42 | $this->assertSame($path, $actual); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @covers Aura\Uri\Path::setFromString |
||
47 | */ |
||
48 | public function testSetFromString() |
||
49 | { |
||
50 | $path = '/foo/bar/baz/dib.gir'; |
||
51 | $this->path->setFromString($path); |
||
52 | |||
53 | $expect = '.gir'; |
||
54 | $actual = $this->path->getFormat(); |
||
55 | $this->assertSame($expect, $actual); |
||
56 | |||
57 | $actual = $this->path->__toString(); |
||
58 | $this->assertSame($path, $actual); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @covers Aura\Uri\Path::setFormat |
||
63 | * @covers Aura\Uri\Path::getFormat |
||
64 | */ |
||
65 | public function testSetAndGetFormat() |
||
66 | { |
||
67 | $format = '.json'; |
||
68 | $this->path->setFormat($format); |
||
69 | $actual = $this->path->getFormat($format); |
||
70 | $this->assertSame($format, $actual); |
||
71 | } |
||
72 | } |