lithium\tests\cases\net\http\RouteTest::testRouteExporting PHP Метод

testRouteExporting() публичный Метод

Tests exporting a the details of a compiled route to an array.
public testRouteExporting ( )
    public function testRouteExporting()
    {
        $result = new Route(array('template' => '/{:controller}/{:action}', 'params' => array('action' => 'view')));
        $result = $result->export();
        $expected = array('template' => '/{:controller}/{:action}', 'pattern' => '@^(?:/(?P<controller>[^\\/]+))(?:/(?P<action>[^\\/]+)?)?$@u', 'params' => array('action' => 'view'), 'defaults' => array('action' => 'view'), 'match' => array(), 'meta' => array(), 'keys' => array('controller' => 'controller', 'action' => 'action'), 'subPatterns' => array(), 'persist' => array('controller'), 'handler' => null);
        $this->assertEqual($expected, $result);
        $result = new Route(array('template' => '/images/image_{:width}x{:height}.{:format}', 'params' => array('format' => 'png')));
        $ptrn = '@^/images/image_(?P<width>[^\\/]+)x(?P<height>[^\\/]+)\\.(?P<format>[^\\/]+)?$@u';
        $expected = array('template' => '/images/image_{:width}x{:height}.{:format}', 'pattern' => $ptrn, 'params' => array('format' => 'png', 'action' => 'index'), 'match' => array('action' => 'index'), 'meta' => array(), 'keys' => array('width' => 'width', 'height' => 'height', 'format' => 'format'), 'defaults' => array('format' => 'png'), 'subPatterns' => array(), 'persist' => array(), 'handler' => null);
        $result = $result->export();
        $this->assertEqual($expected, $result);
    }