Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit ffb8473

Browse files
committed
More conditions on injecting zend-router configuration
zend-router is always required, so we need to check for the absence of v2 routing classes before injecting zend-router configuration. Similarly, in the `UrlTest`, we need to set the types to test against based on presence of v2 routing classes, not v3 routing classes.
1 parent 671f0ff commit ffb8473

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

test/Helper/Navigation/AbstractTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ protected function setUp()
138138

139139
(new ServiceManagerConfig())->configureServiceManager($sm);
140140

141-
if (class_exists(RouterConfigProvider::class)) {
141+
if (! class_exists(V2RouteMatch::class) && class_exists(RouterConfigProvider::class)) {
142142
$routerConfig = new Config((new RouterConfigProvider())->getDependencyConfig());
143143
$routerConfig->configureServiceManager($sm);
144144
}

test/Helper/UrlIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function setUp()
6868
$this->serviceManager = new ServiceManager();
6969
(new ServiceManagerConfig($serviceConfig))->configureServiceManager($this->serviceManager);
7070

71-
if (class_exists(RouterConfigProvider::class)) {
71+
if (! class_exists(V2HttpRoute\Literal::class) && class_exists(RouterConfigProvider::class)) {
7272
$routerConfig = new Config((new RouterConfigProvider())->getDependencyConfig());
7373
$routerConfig->configureServiceManager($this->serviceManager);
7474
}

test/Helper/UrlTest.php

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,30 @@ class UrlTest extends \PHPUnit_Framework_TestCase
5252
*/
5353
protected function setUp()
5454
{
55-
$this->routeMatchType = class_exists(NextGenRouteMatch::class)
56-
? NextGenRouteMatch::class
57-
: RouteMatch::class;
55+
$this->routeMatchType = class_exists(RouteMatch::class)
56+
? RouteMatch::class
57+
: NextGenRouteMatch::class;
5858

59-
$this->literalRouteType = class_exists(NextGenLiteralRoute::class)
60-
? NextGenLiteralRoute::class
61-
: LiteralRoute::class;
59+
$this->literalRouteType = class_exists(LiteralRoute::class)
60+
? LiteralRoute::class
61+
: NextGenLiteralRoute::class;
6262

63-
$this->segmentRouteType = class_exists(NextGenSegmentRoute::class)
64-
? NextGenSegmentRoute::class
65-
: SegmentRoute::class;
63+
$this->segmentRouteType = class_exists(SegmentRoute::class)
64+
? SegmentRoute::class
65+
: NextGenSegmentRoute::class;
6666

67-
$this->treeRouteStackType = class_exists(NextGenTreeRouteStack::class)
68-
? NextGenTreeRouteStack::class
69-
: TreeRouteStack::class;
67+
$this->treeRouteStackType = class_exists(TreeRouteStack::class)
68+
? TreeRouteStack::class
69+
: NextGenTreeRouteStack::class;
7070

71-
$this->wildcardRouteType = class_exists(NextGenWildcardRoute::class)
72-
? NextGenWildcardRoute::class
73-
: WildcardRoute::class;
71+
$this->wildcardRouteType = class_exists(WildcardRoute::class)
72+
? WildcardRoute::class
73+
: NextGenWildcardRoute::class;
74+
75+
$routerClass = class_exists(Router::class)
76+
? Router::class
77+
: NextGenRouter::class;
7478

75-
$routerClass = class_exists(NextGenRouter::class)
76-
? NextGenRouter::class
77-
: Router::class;
7879
$router = new $routerClass();
7980
$router->addRoute('home', [
8081
'type' => $this->literalRouteType,

0 commit comments

Comments
 (0)