You are here

public function RouteTest::testSerializeWhenCompiled in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/routing/Tests/RouteTest.php \Symfony\Component\Routing\Tests\RouteTest::testSerializeWhenCompiled()

Tests that the compiled version is also serialized to prevent the overhead of compiling it again after unserialize.

File

vendor/symfony/routing/Tests/RouteTest.php, line 254

Class

RouteTest

Namespace

Symfony\Component\Routing\Tests

Code

public function testSerializeWhenCompiled() {
  $route = new Route('/prefix/{foo}', array(
    'foo' => 'default',
  ), array(
    'foo' => '\\d+',
  ));
  $route
    ->setHost('{locale}.example.net');
  $route
    ->compile();
  $serialized = serialize($route);
  $unserialized = unserialize($serialized);
  $this
    ->assertEquals($route, $unserialized);
  $this
    ->assertNotSame($route, $unserialized);
}