| @@ 84-95 (lines=12) @@ | ||
| 81 | * @expectedException \Staticus\Resources\Exceptions\CommandErrorException |
|
| 82 | * @expectedExceptionMessage Cannot destroy equal resource: Origin and Suspect have same paths |
|
| 83 | */ |
|
| 84 | public function testDestroyEqualResourceWithSamePaths() |
|
| 85 | { |
|
| 86 | $resourceDOOrigin = $this->getResourceDOMock(); |
|
| 87 | $resourceDOSuspect = $this->getResourceDOMock(); |
|
| 88 | $this->filesystem->put($resourceDOOrigin->getFilePath(), ''); |
|
| 89 | $this->filesystem->put($resourceDOSuspect->getFilePath(), ''); |
|
| 90 | ||
| 91 | $command = $this->getCommand($resourceDOOrigin, $resourceDOSuspect); |
|
| 92 | $command(); |
|
| 93 | ||
| 94 | $this->assertTrue($this->filesystem->has($resourceDOSuspect->getFilePath())); |
|
| 95 | } |
|
| 96 | ||
| 97 | public function testDestroyEqualResourceWithDifferentPaths() |
|
| 98 | { |
|
| @@ 77-87 (lines=11) @@ | ||
| 74 | $this->assertEquals($resourceDO, $result); |
|
| 75 | } |
|
| 76 | ||
| 77 | public function testDestroyResourceByPath() |
|
| 78 | { |
|
| 79 | $resourceDO = $this->getResourceDOMock(); |
|
| 80 | $this->filesystem->put($resourceDO->getFilePath(), ''); |
|
| 81 | ||
| 82 | $command = $this->getCommand($resourceDO); |
|
| 83 | $result = $command(true); |
|
| 84 | ||
| 85 | $this->assertEquals($resourceDO, $result); |
|
| 86 | $this->assertFalse($this->filesystem->has($resourceDO->getFilePath(), '')); |
|
| 87 | } |
|
| 88 | ||
| 89 | public function testDestroyResourceByPathButLeaveOthers() |
|
| 90 | { |
|