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

Commit 9b44720

Browse files
committed
Merge branch 'hotfix/93'
Close #93 Fixes #24
2 parents b20fd60 + 2d0c432 commit 9b44720

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ All notable changes to this project will be documented in this file, in reverse
2424
- [#96](https://github.com/zendframework/zend-mvc/pull/96) fixes shared event
2525
detachment/attachment within the `Forward` plugin to work with both v2 and v3
2626
of zend-eventmanager.
27+
- [#93](https://github.com/zendframework/zend-mvc/pull/93) ensures that the
28+
Console `Catchall` route factory will not fail when the `defaults` `$options`
29+
array key is missing.
2730

2831
## 2.7.1 - 2016-03-02
2932

src/Router/Console/Catchall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function __construct(array $defaults = [])
8585
*/
8686
public static function factory($options = [])
8787
{
88-
return new static($options['defaults']);
88+
return new static(isset($options['defaults']) ? $options['defaults'] : []);
8989
}
9090

9191
/**

test/Router/Console/CatchallTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Zend Framework (http://framework.zend.com/)
4+
*
5+
* @link http://github.com/zendframework/zf2 for the canonical source repository
6+
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
7+
* @license http://framework.zend.com/license/new-bsd New BSD License
8+
*/
9+
10+
namespace ZendTest\Mvc\Router\Console;
11+
12+
use PHPUnit_Framework_TestCase as TestCase;
13+
use Zend\Mvc\Router\Console\Catchall;
14+
15+
class CatchallTest extends TestCase
16+
{
17+
public function provideFactoryOptions()
18+
{
19+
return [
20+
[[]],
21+
[['defaults' => []]]
22+
];
23+
}
24+
25+
/**
26+
* @dataProvider provideFactoryOptions
27+
*/
28+
public function testFactoryReturnsInstanceForAnyOptionsArray($options)
29+
{
30+
$this->assertInstanceOf(Catchall::class, Catchall::factory($options));
31+
}
32+
}

0 commit comments

Comments
 (0)