/** * Returns $path with added terminating slash (corrected for Windows or other OS). * * @param string $path Path to check * @return string Path with ending slash */ public static function slashTerm($path) { if (Folder::isSlashTerm($path)) { return $path; } return $path . Folder::correctSlashFor($path); }
/** * correctSlashFor method * * @return void */ public function testCorrectSlashFor() { $path = '/path/to/file'; $result = Folder::correctSlashFor($path); $this->assertEquals('/', $result); $path = '\\path\\to\\file'; $result = Folder::correctSlashFor($path); $this->assertEquals('/', $result); $path = 'C:\\path\\to\\file'; $result = Folder::correctSlashFor($path); $this->assertEquals('\\', $result); }