/** * Returns the full path of the file. * * @return string Full path to the file */ public function pwd() { if ($this->getPath() === null) { $dir = $this->Folder->pwd(); if (is_dir($dir)) { return $this->Folder->slashTerm($dir) . $this->name; } } return $this->getPath(); }
/** * testBasic method * * @return void */ public function testBasic() { $path = __DIR__; $Folder = new Folder($path); $result = $Folder->pwd(); $this->assertEquals($path, $result); $result = Folder::addPathElement($path, 'test'); $expected = $path . DIRECTORY_SEPARATOR . 'test'; $this->assertEquals($expected, $result); $result = $Folder->cd(TEST_ROOT); $expected = TEST_ROOT; $this->assertEquals($expected, $result); $result = $Folder->cd(TEST_ROOT . DIRECTORY_SEPARATOR . 'non-existent'); $this->assertFalse($result); }