예제 #1
0
 public function testFindFilesReturningFalseWillNotIncludeTheFileInTheResults()
 {
     $file = m::mock(FileNode::class);
     $file->shouldReceive('getMetadata')->andReturn(false);
     $collection = new FileNodeCollection();
     $collection->add($file);
     $finder = new MetadataFinder(new AllOfFilter());
     static::assertEquals(0, $finder->findFiles($collection)->count());
 }
예제 #2
0
 /**
  * @param string $rootDir
  * @param int    $numFiles
  *
  * @return FileNodeCollectionInterface
  */
 private function createCollection($rootDir, $numFiles)
 {
     $mkDir = new MakeDirectory();
     $collection = new FileNodeCollection();
     for ($i = 1; $i <= $numFiles; $i++) {
         $file = new LocalFile(static::$dir . $rootDir . 'part_' . $i);
         $mkDir->makeDirectory($file);
         $file->put("File {$i} Line 1\nFile {$i} Line 2\nFile {$i} Line 3\n");
         $collection->add($file);
     }
     return $collection;
 }
예제 #3
0
 public function testAddingANonDataNodeWillThrowAnException()
 {
     $node = m::mock(NodeInterface::class);
     $this->expectException(InvalidArgumentException::class);
     $this->collection->add($node);
 }