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

Commit 2b88b48

Browse files
committed
Ensure dependencies are correct
- Added zendframework/zend-expressive-router (as it's required for URI generation) - Updated zendframework/zend-expressive-template to `^1.0.1`, as that's the first version supporting the `RenderingException`. - Added zendframework/zend-diactoros as a dev dependency - Added zendframework/zend-expressive as a dev/suggest dependency
1 parent 5ca2984 commit 2b88b48

File tree

5 files changed

+24
-20
lines changed

5 files changed

+24
-20
lines changed

composer.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@
1919
"require": {
2020
"php": ">=5.5",
2121
"container-interop/container-interop": "^1.1",
22-
"zendframework/zend-expressive-template": "^1.0",
22+
"psr/http-message": "^1.0",
23+
"zendframework/zend-expressive-router": "^1.0",
24+
"zendframework/zend-expressive-template": "^1.0.1",
2325
"zendframework/zend-filter": "^2.5",
2426
"zendframework/zend-i18n": "^2.5",
2527
"zendframework/zend-servicemanager": "^2.5",
2628
"zendframework/zend-view": "^2.5"
2729
},
2830
"require-dev": {
2931
"phpunit/phpunit": "^4.7",
30-
"squizlabs/php_codesniffer": "^2.3"
32+
"squizlabs/php_codesniffer": "^2.3",
33+
"zendframework/zend-diactoros": "^1.2",
34+
"zendframework/zend-expressive": "~1.0.0-dev@dev"
3135
},
3236
"autoload": {
3337
"psr-4": {
@@ -41,6 +45,7 @@
4145
},
4246
"suggest": {
4347
"mouf/pimple-interop": "^1.0 to use Pimple for dependency injection",
44-
"aura/di": "3.0.*@beta to make use of Aura.Di dependency injection container"
48+
"aura/di": "3.0.*@beta to make use of Aura.Di dependency injection container",
49+
"zendframework/zend-expressive": "^1.0 if you wish to use the ApplicationUrlDelegatorFactory"
4550
}
4651
}

src/UrlHelper.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77

88
namespace Zend\Expressive\ZendView;
99

10-
use Zend\Expressive\Exception;
10+
use Zend\Expressive\Router\Exception\RuntimeException;
1111
use Zend\Expressive\Router\RouterInterface;
1212
use Zend\Expressive\Router\RouteResult;
1313
use Zend\Expressive\Router\RouteResultObserverInterface;
14+
use Zend\Expressive\Template\Exception\RenderingException;
1415
use Zend\View\Helper\AbstractHelper;
1516

1617
class UrlHelper extends AbstractHelper implements RouteResultObserverInterface
@@ -37,17 +38,16 @@ public function __construct(RouterInterface $router)
3738
* @param string $route
3839
* @param array $params
3940
* @return string
40-
* @throws Exception\RenderingException if no route provided, and no result
41-
* match present.
42-
* @throws Exception\RenderingException if no route provided, and result
43-
* match is a routing failure.
44-
* @throws Exception\RuntimeException if router cannot generate URI for
45-
* given route.
41+
* @throws RenderingException if no route provided, and no result match
42+
* present.
43+
* @throws RenderingException if no route provided, and result match is a
44+
* routing failure.
45+
* @throws RuntimeException if router cannot generate URI for given route.
4646
*/
4747
public function __invoke($route = null, $params = [])
4848
{
4949
if ($route === null && $this->result === null) {
50-
throw new Exception\RenderingException(
50+
throw new RenderingException(
5151
'Attempting to use matched result when none was injected; aborting'
5252
);
5353
}
@@ -82,13 +82,12 @@ public function setRouteResult(RouteResult $result)
8282
/**
8383
* @param array $params
8484
* @return string
85-
* @throws Exception\RenderingException if current result is a routing
86-
* failure.
85+
* @throws RenderingException if current result is a routing failure.
8786
*/
8887
private function generateUriFromResult(array $params)
8988
{
9089
if ($this->result->isFailure()) {
91-
throw new Exception\RenderingException(
90+
throw new RenderingException(
9291
'Attempting to use matched result when routing failed; aborting'
9392
);
9493
}

src/ZendViewRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
namespace Zend\Expressive\ZendView;
1111

12-
use Zend\Expressive\Exception;
1312
use Zend\Expressive\Template\ArrayParametersTrait;
1413
use Zend\Expressive\Template\DefaultParamsTrait;
14+
use Zend\Expressive\Template\Exception;
1515
use Zend\Expressive\Template\TemplatePath;
1616
use Zend\Expressive\Template\TemplateRendererInterface;
1717
use Zend\View\Model\ModelInterface;

test/UrlHelperTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111

1212
use ArrayObject;
1313
use PHPUnit_Framework_TestCase as TestCase;
14-
use Zend\Expressive\Exception;
14+
use Zend\Expressive\Router\Exception\RuntimeException;
1515
use Zend\Expressive\Router\RouterInterface;
1616
use Zend\Expressive\Router\RouteResult;
1717
use Zend\Expressive\Router\RouteResultObserverInterface;
18+
use Zend\Expressive\Template\Exception;
1819
use Zend\Expressive\ZendView\UrlHelper;
1920

2021
class UrlHelperTest extends TestCase
@@ -48,9 +49,9 @@ public function testRaisesExceptionOnInvocationIfNoRouteProvidedAndResultIndicat
4849

4950
public function testRaisesExceptionOnInvocationIfRouterCannotGenerateUriForRouteProvided()
5051
{
51-
$this->router->generateUri('foo', [])->willThrow(Exception\RuntimeException::class);
52+
$this->router->generateUri('foo', [])->willThrow(RuntimeException::class);
5253
$helper = $this->createHelper();
53-
$this->setExpectedException(Exception\RuntimeException::class);
54+
$this->setExpectedException(RuntimeException::class);
5455
$helper('foo');
5556
}
5657

test/ZendViewRendererTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
use ArrayObject;
1313
use PHPUnit_Framework_TestCase as TestCase;
14-
use Zend\Expressive\Exception;
15-
use Zend\Expressive\Exception\InvalidArgumentException;
14+
use Zend\Expressive\Template\Exception\InvalidArgumentException;
1615
use Zend\Expressive\Template\TemplatePath;
1716
use Zend\Expressive\ZendView\ZendViewRenderer;
1817
use Zend\View\Model\ViewModel;

0 commit comments

Comments
 (0)