public function testGetDate() { $it = new DirectoryIterator('tests/test-files/logs'); $it->setFilenameFormat(new FilenameFormat('payment.{Ymd}.log')); foreach ($it as $item) { if ($it->isFile()) { $this->assertEquals(\DateTime::createFromFormat('Ymd', '20160324'), $item->getFilenameDate()); return; } } }