| @@ 15-45 (lines=31) @@ | ||
| 12 | use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\HostText; |
|
| 13 | use eZ\Publish\Core\Search\Tests\TestCase; |
|
| 14 | ||
| 15 | final class HostTextNormalizerTest extends TestCase |
|
| 16 | { |
|
| 17 | public function testNormalize() |
|
| 18 | { |
|
| 19 | $normalizer = new HostTextNormalizer(); |
|
| 20 | $normalizer->setSerializer(new SerializerStub()); |
|
| 21 | ||
| 22 | $matcher = new HostText([ |
|
| 23 | 'prefix' => 'foo', |
|
| 24 | 'suffix' => 'bar', |
|
| 25 | ]); |
|
| 26 | ||
| 27 | $this->assertEquals( |
|
| 28 | [ |
|
| 29 | 'siteAccessesConfiguration' => [ |
|
| 30 | 'prefix' => 'foo', |
|
| 31 | 'suffix' => 'bar', |
|
| 32 | ], |
|
| 33 | ], |
|
| 34 | $normalizer->normalize($matcher) |
|
| 35 | ); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function testSupportsNormalization() |
|
| 39 | { |
|
| 40 | $normalizer = new HostTextNormalizer(); |
|
| 41 | ||
| 42 | $this->assertTrue($normalizer->supportsNormalization($this->createMock(HostText::class))); |
|
| 43 | $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class))); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| @@ 15-45 (lines=31) @@ | ||
| 12 | use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex\Host; |
|
| 13 | use eZ\Publish\Core\Search\Tests\TestCase; |
|
| 14 | ||
| 15 | final class RegexHostNormalizerTest extends TestCase |
|
| 16 | { |
|
| 17 | public function testNormalize() |
|
| 18 | { |
|
| 19 | $normalizer = new RegexHostNormalizer(); |
|
| 20 | $normalizer->setSerializer(new SerializerStub()); |
|
| 21 | ||
| 22 | $matcher = new Host([ |
|
| 23 | 'regex' => '/^Foo(.*)/(.*)/', |
|
| 24 | 'itemNumber' => 2, |
|
| 25 | ]); |
|
| 26 | ||
| 27 | $this->assertEquals( |
|
| 28 | [ |
|
| 29 | 'siteAccessesConfiguration' => [ |
|
| 30 | 'regex' => '/^Foo(.*)/(.*)/', |
|
| 31 | 'itemNumber' => 2, |
|
| 32 | ], |
|
| 33 | ], |
|
| 34 | $normalizer->normalize($matcher) |
|
| 35 | ); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function testSupportsNormalization() |
|
| 39 | { |
|
| 40 | $normalizer = new RegexHostNormalizer(); |
|
| 41 | ||
| 42 | $this->assertTrue($normalizer->supportsNormalization($this->createMock(Host::class))); |
|
| 43 | $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class))); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| @@ 15-45 (lines=31) @@ | ||
| 12 | use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\Regex\URI; |
|
| 13 | use eZ\Publish\Core\Search\Tests\TestCase; |
|
| 14 | ||
| 15 | final class RegexURINormalizerTest extends TestCase |
|
| 16 | { |
|
| 17 | public function testNormalize() |
|
| 18 | { |
|
| 19 | $normalizer = new RegexURINormalizer(); |
|
| 20 | $normalizer->setSerializer(new SerializerStub()); |
|
| 21 | ||
| 22 | $matcher = new URI([ |
|
| 23 | 'regex' => '/^Foo(.*)/(.*)/', |
|
| 24 | 'itemNumber' => 2, |
|
| 25 | ]); |
|
| 26 | ||
| 27 | $this->assertEquals( |
|
| 28 | [ |
|
| 29 | 'siteAccessesConfiguration' => [ |
|
| 30 | 'regex' => '/^Foo(.*)/(.*)/', |
|
| 31 | 'itemNumber' => 2, |
|
| 32 | ], |
|
| 33 | ], |
|
| 34 | $normalizer->normalize($matcher) |
|
| 35 | ); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function testSupportsNormalization() |
|
| 39 | { |
|
| 40 | $normalizer = new RegexURINormalizer(); |
|
| 41 | ||
| 42 | $this->assertTrue($normalizer->supportsNormalization($this->createMock(URI::class))); |
|
| 43 | $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class))); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| @@ 15-45 (lines=31) @@ | ||
| 12 | use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\URIText; |
|
| 13 | use eZ\Publish\Core\Search\Tests\TestCase; |
|
| 14 | ||
| 15 | final class URITextNormalizerTest extends TestCase |
|
| 16 | { |
|
| 17 | public function testNormalize() |
|
| 18 | { |
|
| 19 | $normalizer = new URITextNormalizer(); |
|
| 20 | $normalizer->setSerializer(new SerializerStub()); |
|
| 21 | ||
| 22 | $matcher = new URIText([ |
|
| 23 | 'prefix' => 'foo', |
|
| 24 | 'suffix' => 'bar', |
|
| 25 | ]); |
|
| 26 | ||
| 27 | $this->assertEquals( |
|
| 28 | [ |
|
| 29 | 'siteAccessesConfiguration' => [ |
|
| 30 | 'prefix' => 'foo', |
|
| 31 | 'suffix' => 'bar', |
|
| 32 | ], |
|
| 33 | ], |
|
| 34 | $normalizer->normalize($matcher) |
|
| 35 | ); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function testSupportsNormalization() |
|
| 39 | { |
|
| 40 | $normalizer = new URITextNormalizer(); |
|
| 41 | ||
| 42 | $this->assertTrue($normalizer->supportsNormalization($this->createMock(URIText::class))); |
|
| 43 | $this->assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class))); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||