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

Commit 1cbac66

Browse files
committed
Merge branch 'hotfix/21-instanceof-missing-dep'
Close #21
2 parents 396fa03 + cc79951 commit 1cbac66

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file, in reverse
88

99
- Nothing.
1010

11+
### Changed
12+
13+
- Nothing.
14+
1115
### Deprecated
1216

1317
- Nothing.
@@ -18,7 +22,8 @@ All notable changes to this project will be documented in this file, in reverse
1822

1923
### Fixed
2024

21-
- Nothing.
25+
- [#21](https://github.com/zendframework/zend-mvc-console/pull/21) adds a missing import statement for `Zend\Router\RouteMatch` to the
26+
`ConsoleViewHelperManagerDelegatorFactory` class.
2227

2328
## 1.1.11 - 2016-08-29
2429

src/Service/ConsoleViewHelperManagerDelegatorFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Interop\Container\ContainerInterface;
1111
use Zend\Console\Console;
12+
use Zend\Router\RouteMatch;
1213
use Zend\ServiceManager\DelegatorFactoryInterface;
1314
use Zend\ServiceManager\ServiceLocatorInterface;
1415
use Zend\View\Helper as ViewHelper;

test/Service/ConsoleViewHelperManagerDelegatorFactoryTest.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* @link http://github.com/zendframework/zend-mvc-console for the canonical source repository
4-
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
4+
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (http://www.zend.com)
55
* @license http://framework.zend.com/license/new-bsd New BSD License
66
*/
77

@@ -10,7 +10,12 @@
1010
use Interop\Container\ContainerInterface;
1111
use PHPUnit_Framework_TestCase as TestCase;
1212
use Prophecy\Argument;
13+
use ReflectionMethod;
14+
use Zend\Mvc\Application;
1315
use Zend\Mvc\Console\Service\ConsoleViewHelperManagerDelegatorFactory;
16+
use Zend\Mvc\MvcEvent;
17+
use Zend\Router\RouteMatch;
18+
use Zend\Router\RouteStackInterface;
1419
use Zend\View\HelperPluginManager;
1520
use Zend\View\Helper;
1621

@@ -57,4 +62,30 @@ public function testInjectsPluginFactoriesWhenInConsoleEnvironment()
5762
$this->factory->__invoke($this->container, 'ViewHelperManager', $this->callback)
5863
);
5964
}
65+
66+
public function testCreateUrlHelperFactoryInjectsHelperWithRouterAndRouteMatchWhenPresent()
67+
{
68+
$container = $this->prophesize(ContainerInterface::class);
69+
70+
$router = $this->prophesize(RouteStackInterface::class);
71+
$container->get('HttpRouter')->will([$router, 'reveal']);
72+
73+
$routeMatch = $this->prophesize(RouteMatch::class);
74+
75+
$mvcEvent = $this->prophesize(MvcEvent::class);
76+
$mvcEvent->getRouteMatch()->will([$routeMatch, 'reveal']);
77+
78+
$application = $this->prophesize(Application::class);
79+
$application->getMvcEvent()->will([$mvcEvent, 'reveal']);
80+
$container->get('Application')->will([$application, 'reveal']);
81+
82+
$r = new ReflectionMethod($this->factory, 'createUrlHelperFactory');
83+
$r->setAccessible(true);
84+
$factory = $r->invoke($this->factory, $container->reveal());
85+
86+
$helper = $factory();
87+
88+
$this->assertAttributeSame($router->reveal(), 'router', $helper);
89+
$this->assertAttributeSame($routeMatch->reveal(), 'routeMatch', $helper);
90+
}
6091
}

0 commit comments

Comments
 (0)