for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Tests\Ds\Router\Dispatcher;
use Ds\Router\Dispatcher\Dispatcher;
use Tests\Ds\Router\Helpers\Reflection;
class DisparcherTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Dispatcher
*/
public $dispatcher;
public function setUp()
$options = [];
$this->dispatcher = new Dispatcher($options);
}
public function testWithNamespace()
$ns = 'myNamespace';
$dispatcher = $this->dispatcher->withNamespace($ns);
$addedNamespaces = Reflection::getProperty(Dispatcher::class, 'namespaces', $dispatcher);
$this->assertEquals([$ns => $ns], $addedNamespaces);
public function testWithNamespaces()
$namespaces = [
'\my\namespace','another','one\more'
];
$expected = [
$namespaces[0] => $namespaces[0],
$namespaces[1] => $namespaces[1],
$namespaces[2] => $namespaces[2]
$dispatcher = $this->dispatcher->withNamespaces($namespaces);
$this->assertEquals($expected, $addedNamespaces);