@@ 41-55 (lines=15) @@ | ||
38 | static::assertInstanceOf(NodeCollection::class, $this->collection); |
|
39 | } |
|
40 | ||
41 | public function testGetCommonPrefixReturnsCommonPrefixOfFiles() |
|
42 | { |
|
43 | $file1 = m::mock(FileNodeInterface::class); |
|
44 | $file1->shouldReceive('getPath')->andReturn('some/common/path/to/file1.txt'); |
|
45 | $file2 = m::mock(FileNodeInterface::class); |
|
46 | $file2->shouldReceive('getPath')->andReturn('some/common/path/to/file2.txt'); |
|
47 | $file3 = m::mock(FileNodeInterface::class); |
|
48 | $file3->shouldReceive('getPath')->andReturn('some/common/path/to/file3.txt'); |
|
49 | ||
50 | $this->collection->add($file1); |
|
51 | $this->collection->add($file2); |
|
52 | $this->collection->add($file3); |
|
53 | ||
54 | static::assertEquals('some/common/path/to/file', $this->collection->getCommonPrefix()); |
|
55 | } |
|
56 | ||
57 | public function testGetCommonPrefixReturnsNullIfThereIsNoCommonPrefix() |
|
58 | { |
|
@@ 57-71 (lines=15) @@ | ||
54 | static::assertEquals('some/common/path/to/file', $this->collection->getCommonPrefix()); |
|
55 | } |
|
56 | ||
57 | public function testGetCommonPrefixReturnsNullIfThereIsNoCommonPrefix() |
|
58 | { |
|
59 | $file1 = m::mock(FileNodeInterface::class); |
|
60 | $file1->shouldReceive('getPath')->andReturn('some/common/path/to/file1.txt'); |
|
61 | $file2 = m::mock(FileNodeInterface::class); |
|
62 | $file2->shouldReceive('getPath')->andReturn('some/common/path/to/file2.txt'); |
|
63 | $file3 = m::mock(FileNodeInterface::class); |
|
64 | $file3->shouldReceive('getPath')->andReturn('other/nonCommon/path/to/file3.txt'); |
|
65 | ||
66 | $this->collection->add($file1); |
|
67 | $this->collection->add($file2); |
|
68 | $this->collection->add($file3); |
|
69 | ||
70 | static::assertNull($this->collection->getCommonPrefix()); |
|
71 | } |
|
72 | ||
73 | public function testGetCommonPrefixReturnsNullIfThereAreNoItems() |
|
74 | { |