Fixed the regex to match the commit and the path.
This commit is contained in:
parent
a643cbbc0c
commit
380df7380b
@ -44,4 +44,21 @@ class IDF_Tests_TestSource extends UnitTestCase
|
|||||||
$this->assertEqual($mime, $m[0]);
|
$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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -147,37 +147,37 @@ $ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/attachment/(\d+)/(.*)$#',
|
|||||||
|
|
||||||
// ---------- SCM ----------------------------------------
|
// ---------- SCM ----------------------------------------
|
||||||
|
|
||||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/tree/([\S^/]+)/$#',
|
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/tree/([^/]+)/$#',
|
||||||
'base' => $base,
|
'base' => $base,
|
||||||
'priority' => 4,
|
'priority' => 4,
|
||||||
'model' => 'IDF_Views_Source',
|
'model' => 'IDF_Views_Source',
|
||||||
'method' => 'treeBase');
|
'method' => 'treeBase');
|
||||||
|
|
||||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/tree/([\S^/]+)/(.*)$#',
|
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/tree/([^/]+)/(.*)$#',
|
||||||
'base' => $base,
|
'base' => $base,
|
||||||
'priority' => 4,
|
'priority' => 4,
|
||||||
'model' => 'IDF_Views_Source',
|
'model' => 'IDF_Views_Source',
|
||||||
'method' => 'tree');
|
'method' => 'tree');
|
||||||
|
|
||||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/changes/([\S^/]+)/$#',
|
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/changes/([^/]+)/$#',
|
||||||
'base' => $base,
|
'base' => $base,
|
||||||
'priority' => 4,
|
'priority' => 4,
|
||||||
'model' => 'IDF_Views_Source',
|
'model' => 'IDF_Views_Source',
|
||||||
'method' => 'changeLog');
|
'method' => 'changeLog');
|
||||||
|
|
||||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/commit/([\S^/]+)/$#',
|
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/commit/([^/]+)/$#',
|
||||||
'base' => $base,
|
'base' => $base,
|
||||||
'priority' => 4,
|
'priority' => 4,
|
||||||
'model' => 'IDF_Views_Source',
|
'model' => 'IDF_Views_Source',
|
||||||
'method' => 'commit');
|
'method' => 'commit');
|
||||||
|
|
||||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/download/([\S^/]+)/$#',
|
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/download/([^/]+)/$#',
|
||||||
'base' => $base,
|
'base' => $base,
|
||||||
'priority' => 4,
|
'priority' => 4,
|
||||||
'model' => 'IDF_Views_Source',
|
'model' => 'IDF_Views_Source',
|
||||||
'method' => 'download');
|
'method' => 'download');
|
||||||
|
|
||||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/file/([\S^/]+)/(.*)$#',
|
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/file/([^/]+)/(.*)$#',
|
||||||
'base' => $base,
|
'base' => $base,
|
||||||
'priority' => 4,
|
'priority' => 4,
|
||||||
'model' => 'IDF_Views_Source',
|
'model' => 'IDF_Views_Source',
|
||||||
|
Loading…
Reference in New Issue
Block a user