/** * testFind method * * @return void */ public function testFind() { $Folder = new Folder(); $Folder->cd(CAKE . 'Config'); $result = $Folder->find(); $expected = array('config.php'); $this->assertSame(array_diff($expected, $result), array()); $this->assertSame(array_diff($expected, $result), array()); $result = $Folder->find('.*', true); $expected = array('cacert.pem', 'config.php', 'routes.php'); $this->assertSame($expected, $result); $result = $Folder->find('.*\\.php'); $expected = array('config.php'); $this->assertSame(array_diff($expected, $result), array()); $this->assertSame(array_diff($expected, $result), array()); $result = $Folder->find('.*\\.php', true); $expected = array('config.php', 'routes.php'); $this->assertSame($expected, $result); $result = $Folder->find('.*ig\\.php'); $expected = array('config.php'); $this->assertSame($expected, $result); $result = $Folder->find('config\\.php'); $expected = array('config.php'); $this->assertSame($expected, $result); $Folder = new Folder(TMP . 'tests/', true); $File = new File($Folder->pwd() . DS . 'paths.php', true); $Folder->create($Folder->pwd() . DS . 'testme'); $Folder->cd('testme'); $result = $Folder->find('paths\\.php'); $expected = array(); $this->assertSame($expected, $result); $Folder->cd($Folder->pwd() . '/..'); $result = $Folder->find('paths\\.php'); $expected = array('paths.php'); $this->assertSame($expected, $result); }