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()); }
/** * @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; }
public function testAddingANonDataNodeWillThrowAnException() { $node = m::mock(NodeInterface::class); $this->expectException(InvalidArgumentException::class); $this->collection->add($node); }