$badPath) { $goodPath = AntTools::repairFilePath($badPath); $this->assertEquals($expectedPaths[$index], $goodPath, "Expected '$expectedPaths[$index]' but got '{$goodPath}' for input '{$badPath}'"); } } public function testUrlRepair() { $badUrls = array( "example.com\path", "example.com/path/", "example.com//path", "example.com/path/to//file", "example.com\path\\to\\file", "example.com\path\\to\\file?download=yes" ); $expectedUrls = array( "example.com/path", "example.com/path/", "example.com/path", "example.com/path/to/file", "example.com/path/to/file", "example.com/path/to/file?download=yes" ); foreach ($badUrls as $index => $badurl) { $goodUrl = AntTools::repairURL($badurl); $this->assertEquals($expectedUrls[$index], $goodUrl, "Expected '$expectedUrls[$index]' but got '{$goodUrl}' for input '{$badurl}'"); } } public function testGetFileList() { $basedir = dirname(__DIR__, 1); $srcdir = $basedir . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Content'; $result = AntTools::getFileList($srcdir); $this->assertNotEmpty($result); } public function testGetFileListWithExtension() { $basedir = dirname(__DIR__, 1); $srcdir = $basedir . DIRECTORY_SEPARATOR . 'src'; $files = AntTools::getFileList($srcdir, 'md'); foreach ($files as $file) { $this->assertEquals('md', pathinfo($file, PATHINFO_EXTENSION), "Expected file extension to be 'md', but got '" . pathinfo($file, PATHINFO_EXTENSION) . "' for file '{$file}'"); } } }