From 178ee48cd32ee4ed7990b0a4a6c2ef6f3a3f223a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 7 Mar 2016 23:20:07 +0700 Subject: [PATCH 1/2] Fixes #24 : Fixes Fatal error in Catchall::factory --- src/Router/Console/Catchall.php | 2 +- test/Router/Console/CatchallTest.php | 33 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 test/Router/Console/CatchallTest.php diff --git a/src/Router/Console/Catchall.php b/src/Router/Console/Catchall.php index b13797eea..77e7d943f 100644 --- a/src/Router/Console/Catchall.php +++ b/src/Router/Console/Catchall.php @@ -85,7 +85,7 @@ public function __construct(array $defaults = []) */ public static function factory($options = []) { - return new static($options['defaults']); + return new static(isset($options['defaults']) ? $options['defaults'] : []); } /** diff --git a/test/Router/Console/CatchallTest.php b/test/Router/Console/CatchallTest.php new file mode 100644 index 000000000..ef5622fe5 --- /dev/null +++ b/test/Router/Console/CatchallTest.php @@ -0,0 +1,33 @@ + []]] + ]; + } + + /** + * @dataProvider provideFactoryOptions + */ + public function testFactory($options) + { + $this->assertInstanceOf(Catchall::class, Catchall::factory($options)); + } +} From 78a7ea89e0daf78bdf0c1505919248246cf03a5f Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 7 Mar 2016 23:24:53 +0700 Subject: [PATCH 2/2] unused statement --- test/Router/Console/CatchallTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/Router/Console/CatchallTest.php b/test/Router/Console/CatchallTest.php index ef5622fe5..3ca151fde 100644 --- a/test/Router/Console/CatchallTest.php +++ b/test/Router/Console/CatchallTest.php @@ -3,14 +3,13 @@ * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Mvc\Router\Console; use PHPUnit_Framework_TestCase as TestCase; -use Zend\Console\Request as ConsoleRequest; use Zend\Mvc\Router\Console\Catchall; class CatchallTest extends TestCase