Exemplo n.º 1
0
 public function testMatchWith()
 {
     $route = new Route('/blog/:id-:slug', function ($id, $slug) {
         return 'hello';
     });
     $route->with(['id' => '[0-9]+']);
     $this->assertTrue($route->match('/blog/12-my-title'));
     $this->assertEquals('12', $route->getMatches()[0]);
     $this->assertFalse($route->match('/blog/my-title-12'));
     $this->assertEquals(0, count($route->getMatches()));
 }
Exemplo n.º 2
0
<?php

require 'process.php';
require 'controller/SomeController.php';
use Gear\Routing\Route;
//$subfolder = "path/to/project";
$route = new Route();
$route->addRoute('/some-route', 'SomeController');
//$route->match($subfolder);
$route->match();