| @@ 139-156 (lines=18) @@ | ||
| 136 | * @throws \Nnx\EntryNameResolver\Exception\InvalidContextException |
|
| 137 | * @throws \PHPUnit_Framework_AssertionFailedError |
|
| 138 | */ |
|
| 139 | public function testSetterGetterEntryBodyNamePattern() |
|
| 140 | { |
|
| 141 | /** @noinspection PhpIncludeInspection */ |
|
| 142 | $this->setApplicationConfig( |
|
| 143 | include TestPaths::getPathToContextResolverAppConfig() |
|
| 144 | ); |
|
| 145 | ||
| 146 | ||
| 147 | /** @var EntryNameResolverManager $entryNameResolverManager */ |
|
| 148 | $entryNameResolverManager = $this->getApplicationServiceLocator()->get(EntryNameResolverManagerInterface::class); |
|
| 149 | ||
| 150 | /** @var ResolverByClassName $resolverByClassName */ |
|
| 151 | $resolverByClassName = $entryNameResolverManager->get(ResolverByClassName::class); |
|
| 152 | ||
| 153 | $expectedPattern = 'testPattern'; |
|
| 154 | $valid = $resolverByClassName === $resolverByClassName->setEntryBodyNamePattern($expectedPattern); |
|
| 155 | static::assertTrue($valid); |
|
| 156 | } |
|
| 157 | } |
|
| 158 | ||
| @@ 73-93 (lines=21) @@ | ||
| 70 | * @throws \Zend\Stdlib\Exception\LogicException |
|
| 71 | * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException |
|
| 72 | */ |
|
| 73 | public function testResolveEntryNameByContext($entryName, array $map, $context, $resolvedEntryName) |
|
| 74 | { |
|
| 75 | /** @noinspection PhpIncludeInspection */ |
|
| 76 | $this->setApplicationConfig( |
|
| 77 | include TestPaths::getPathToContextResolverAppConfig() |
|
| 78 | ); |
|
| 79 | ||
| 80 | ||
| 81 | /** @var EntryNameResolverManager $entryNameResolverManager */ |
|
| 82 | $entryNameResolverManager = $this->getApplicationServiceLocator()->get(EntryNameResolverManagerInterface::class); |
|
| 83 | ||
| 84 | /** @var ResolverByModuleContextMap $resolverByModuleContextMap */ |
|
| 85 | $resolverByModuleContextMap = $entryNameResolverManager->get(ResolverByModuleContextMap::class); |
|
| 86 | ||
| 87 | ||
| 88 | $resolverByModuleContextMap->setContextMap($map); |
|
| 89 | ||
| 90 | $actualResolvedEntryName = $resolverByModuleContextMap->resolveEntryNameByContext($entryName, $context); |
|
| 91 | ||
| 92 | static::assertEquals($resolvedEntryName, $actualResolvedEntryName); |
|
| 93 | } |
|
| 94 | ||
| 95 | ||
| 96 | /** |
|