|
|
|
@ -208,6 +208,57 @@ class RouterTest extends TestCase
|
|
|
|
|
$this->check('before/after');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testUrlParametersWithRealSlash()
|
|
|
|
|
{
|
|
|
|
|
$this->router->map('/redirect/@id', function ($id) {
|
|
|
|
|
echo $id;
|
|
|
|
|
});
|
|
|
|
|
$this->request->url = '/redirect/before/after';
|
|
|
|
|
|
|
|
|
|
$this->check('404');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testUrlParametersWithJapanese()
|
|
|
|
|
{
|
|
|
|
|
$this->router->map('/わたしはひとです', function () {
|
|
|
|
|
echo 'はい';
|
|
|
|
|
});
|
|
|
|
|
$this->request->url = '/わたしはひとです';
|
|
|
|
|
|
|
|
|
|
$this->check('はい');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testUrlParametersWithJapaneseAndParam()
|
|
|
|
|
{
|
|
|
|
|
$this->router->map('/わたしはひとです/@name', function ($name) {
|
|
|
|
|
echo $name;
|
|
|
|
|
});
|
|
|
|
|
$this->request->url = '/'.urlencode('わたしはひとです').'/'.urlencode('ええ');
|
|
|
|
|
|
|
|
|
|
$this->check('ええ');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Passing URL parameters matched with regular expression for a URL containing Cyrillic letters:
|
|
|
|
|
public function testRegExParametersCyrillic()
|
|
|
|
|
{
|
|
|
|
|
$this->router->map('/категория/@name:[абвгдеёжзийклмнопрстуфхцчшщъыьэюя]+', function ($name) {
|
|
|
|
|
echo $name;
|
|
|
|
|
});
|
|
|
|
|
$this->request->url = '/'.urlencode('категория').'/'.urlencode('цветя');
|
|
|
|
|
|
|
|
|
|
$this->check('цветя');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testRegExOnlyCyrillicUrl()
|
|
|
|
|
{
|
|
|
|
|
$this->router->map('/категория/цветя', function () {
|
|
|
|
|
echo 'цветя';
|
|
|
|
|
});
|
|
|
|
|
$this->request->url = '/категория/цветя';
|
|
|
|
|
|
|
|
|
|
$this->check('цветя');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Passing URL parameters matched with regular expression
|
|
|
|
|
public function testRegExParameters()
|
|
|
|
|
{
|
|
|
|
@ -394,17 +445,6 @@ class RouterTest extends TestCase
|
|
|
|
|
$this->check('404');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Passing URL parameters matched with regular expression for a URL containing Cyrillic letters:
|
|
|
|
|
public function testRegExParametersCyrillic()
|
|
|
|
|
{
|
|
|
|
|
$this->router->map('/категория/@name:[абвгдеёжзийклмнопрстуфхцчшщъыьэюя]+', function ($name) {
|
|
|
|
|
echo $name;
|
|
|
|
|
});
|
|
|
|
|
$this->request->url = '/' . urlencode('категория') . '/' . urlencode('цветя');
|
|
|
|
|
|
|
|
|
|
$this->check('цветя');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetAndClearRoutes()
|
|
|
|
|
{
|
|
|
|
|
$this->router->map('/path1', [$this, 'ok']);
|
|
|
|
|