| 1 | <?php |
||
| 10 | class ModificationInspectorTest extends TestCase |
||
| 11 | { |
||
| 12 | private function filesDirectory(): string |
||
| 13 | { |
||
| 14 | return __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'ModificationInspector'; |
||
| 15 | } |
||
| 16 | |||
| 17 | public function testDate(): void |
||
| 18 | { |
||
| 19 | $lastDate = null; |
||
| 20 | $files = glob($this->filesDirectory() . DIRECTORY_SEPARATOR . '*'); |
||
| 21 | |||
| 22 | foreach ($files as $file) { |
||
| 23 | if (is_file($file)) { |
||
| 24 | $date = new \DateTime('@' . filemtime($file)); |
||
| 25 | if ($date > $lastDate) { |
||
| 26 | $lastDate = $date; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | $inspector = new ModificationInspector(); |
||
| 32 | $this->assertEquals($lastDate, $inspector->getLastModifiedDate(new \ReflectionClass(Inspected::class))); |
||
| 33 | } |
||
| 34 | } |