| @@ 115-126 (lines=12) @@ | ||
| 112 | $this->assertNull($matcher->reverseMatch('foo')); |
|
| 113 | } |
|
| 114 | ||
| 115 | public function testSerialize() |
|
| 116 | { |
|
| 117 | $matcher = new HostElement([1]); |
|
| 118 | $matcher->setRequest(new SimplifiedRequest(['host' => 'ez.no', 'pathinfo' => '/foo/bar'])); |
|
| 119 | $sa = new SiteAccess('test', 'test', $matcher); |
|
| 120 | $serializedSA1 = serialize($sa); |
|
| 121 | ||
| 122 | $matcher->setRequest(new SimplifiedRequest(['host' => 'ez.no', 'pathinfo' => '/foo/bar/baz'])); |
|
| 123 | $serializedSA2 = serialize($sa); |
|
| 124 | ||
| 125 | $this->assertSame($serializedSA1, $serializedSA2); |
|
| 126 | } |
|
| 127 | ||
| 128 | protected function createRouter(): Router |
|
| 129 | { |
|
| @@ 83-99 (lines=17) @@ | ||
| 80 | $this->assertSame('uri:regexp', $matcher->getName()); |
|
| 81 | } |
|
| 82 | ||
| 83 | public function testSerialize() |
|
| 84 | { |
|
| 85 | $matcher = new RegexMatcher( |
|
| 86 | [ |
|
| 87 | 'regex' => '^/foo(\\w+)bar', |
|
| 88 | 'itemNumber' => 2, |
|
| 89 | ] |
|
| 90 | ); |
|
| 91 | $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar'])); |
|
| 92 | $sa = new SiteAccess('test', 'test', $matcher); |
|
| 93 | $serializedSA1 = serialize($sa); |
|
| 94 | ||
| 95 | $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar/baz'])); |
|
| 96 | $serializedSA2 = serialize($sa); |
|
| 97 | ||
| 98 | $this->assertSame($serializedSA1, $serializedSA2); |
|
| 99 | } |
|
| 100 | ||
| 101 | protected function createRouter(): Router |
|
| 102 | { |
|