'application/x-httpd-php', 'whatever.pht' => 'application/x-httpd-php', 'README' => 'text/plain', ); foreach ($files as $file => $mime) { $m = IDF_Views_Source::getMimeType($file); $this->assertEqual($mime, $m[0]); } } public function testRegexCommit() { $regex = '#^/p/([\-\w]+)/source/tree/([^\/]+)/(.*)$#'; $tests = array('/p/test_project/source/tree/default/current/sources' => array('test_project', 'default', 'current/sources'), '/p/test_project/source/tree/3.6/current/sources' => array('test_project', '3.6', 'current/sources'), ); foreach ($tests as $test => $res) { $m = array(); $t = preg_match($regex, $test, $m); $this->assertEqual($res[0], $m[1]); $this->assertEqual($res[1], $m[2]); $this->assertEqual($res[2], $m[3]); } } }