| @@ 167-178 (lines=12) @@ | ||
| 164 | $this->assertNull($matcher->reverseMatch('foo')); |
|
| 165 | } |
|
| 166 | ||
| 167 | public function testSerialize() |
|
| 168 | { |
|
| 169 | $matcher = new HostElement([1]); |
|
| 170 | $matcher->setRequest(new SimplifiedRequest(['host' => 'ez.no', 'pathinfo' => '/foo/bar'])); |
|
| 171 | $sa = new SiteAccess('test', 'test', $matcher); |
|
| 172 | $serializedSA1 = serialize($sa); |
|
| 173 | ||
| 174 | $matcher->setRequest(new SimplifiedRequest(['host' => 'ez.no', 'pathinfo' => '/foo/bar/baz'])); |
|
| 175 | $serializedSA2 = serialize($sa); |
|
| 176 | ||
| 177 | $this->assertSame($serializedSA1, $serializedSA2); |
|
| 178 | } |
|
| 179 | ||
| 180 | private function createRouter(): Router |
|
| 181 | { |
|
| @@ 85-101 (lines=17) @@ | ||
| 82 | $this->assertSame('uri:regexp', $matcher->getName()); |
|
| 83 | } |
|
| 84 | ||
| 85 | public function testSerialize() |
|
| 86 | { |
|
| 87 | $matcher = new RegexMatcher( |
|
| 88 | [ |
|
| 89 | 'regex' => '^/foo(\\w+)bar', |
|
| 90 | 'itemNumber' => 2, |
|
| 91 | ] |
|
| 92 | ); |
|
| 93 | $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar'])); |
|
| 94 | $sa = new SiteAccess('test', 'test', $matcher); |
|
| 95 | $serializedSA1 = serialize($sa); |
|
| 96 | ||
| 97 | $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar/baz'])); |
|
| 98 | $serializedSA2 = serialize($sa); |
|
| 99 | ||
| 100 | $this->assertSame($serializedSA1, $serializedSA2); |
|
| 101 | } |
|
| 102 | ||
| 103 | protected function createRouter(): Router |
|
| 104 | { |
|