Example #1
0
 /**
  * Test if the default filters filter out hidden files (like .htaccess)
  *
  * @test
  */
 public function fileListingsDoNotContainHiddenFilesWithDefaultFilters()
 {
     // we cannot use fixture->createFile() because touch() does not work with vfsStream
     $this->addToMount(array('someFile' => '', '.someHiddenFile' => ''));
     $this->prepareFixture();
     $this->fixture->resetFileAndFolderNameFiltersToDefault();
     $fileList = $this->fixture->getFileList('/');
     $this->assertContains('someFile', array_keys($fileList));
     $this->assertNotContains('.someHiddenFile', array_keys($fileList));
 }
 /**
  * @test
  */
 public function getFileListHandsOverRecursiveTRUEifSet()
 {
     $this->prepareFixture(array());
     $driver = $this->createDriverMock(array('basePath' => $this->getMountRootUrl()), $this->fixture, array('getFileList'));
     $driver->expects($this->once())->method('getFileList')->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), $this->anything(), TRUE)->will($this->returnValue(array()));
     $this->fixture->getFileList('/', 0, 0, TRUE, TRUE, TRUE);
 }
Example #3
0
 /**
  * @test
  */
 public function getFileListIgnoresCasingWhenSortingFilenames()
 {
     $fileList = array('aFile' => 'dfsdg', 'zFile' => 'werw', 'BFile' => 'asd', '12345' => 'fdsa', 'IMG_1234.jpg' => 'asdf');
     $this->prepareFixture(array());
     $driver = $this->createDriverMock(array(), $this->fixture, array('getFileList'));
     $driver->expects($this->once())->method('getFileList')->will($this->returnValue($fileList));
     $fileList = $this->fixture->getFileList('/');
     $this->assertEquals(array('12345', 'aFile', 'BFile', 'IMG_1234.jpg', 'zFile'), array_keys($fileList));
 }
Example #4
0
 /**
  * Returns amount of all files within this folder, optionally filtered by
  * the given pattern
  *
  * @param array $filterMethods
  * @return integer
  */
 public function getFileCount(array $filterMethods = array())
 {
     // TODO replace by call to count()
     return count($this->storage->getFileList($this->identifier, 0, 0, $filterMethods));
 }