public function testToArray()
 {
     $contents = ['content1', 'content2'];
     $expectedArray = [];
     $index = 0;
     foreach ($this->filePaths as $filePath) {
         $expectedArray[$filePath] = $contents[$index];
         $this->directoryMock->expects($this->at($index))->method('readFile')->with($filePath)->will($this->returnValue($contents[$index++]));
     }
     $this->assertEquals($expectedArray, $this->fileIterator->toArray());
 }
Esempio n. 2
0
 /**
  * @group single
  */
 public function testIgnoreNonCompletePaths()
 {
     $expected = realpath(self::expand('dir2/file.php'));
     $iterator = new FileIterator(self::$expectedFiles, [self::expand('dir')]);
     $this->assertArrayHasKey($expected, $iterator->toArray(), "'{$expected}' should not be ignored as 'dir' should not match 'dir2'");
 }