diff options
Diffstat (limited to 'tests/Router/RouteTest.php')
-rw-r--r-- | tests/Router/RouteTest.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/Router/RouteTest.php b/tests/Router/RouteTest.php new file mode 100644 index 0000000..4a72d27 --- /dev/null +++ b/tests/Router/RouteTest.php @@ -0,0 +1,42 @@ +<?php + +namespace Jasny\Router; + +use Jasny\Router\Route; + +/** + * @covers Jasny\Router\Route + */ +class RouteTest extends \PHPUnit_Framework_TestCase +{ + public function provider() + { + return [ + [['foo' => '$1', 'color' => 'red', 'number' => 42]], + [(object)['foo' => '$1', 'color' => 'red', 'number' => 42]] + ]; + } + + /** + * @dataProvider provider + * + * @param array|stdClass $values + */ + public function testConstructionWithObject($values) + { + $route = new Route($values); + + $this->assertAttributeSame('$1', 'foo', $route); + $this->assertAttributeSame('red', 'color', $route); + $this->assertAttributeSame(42, 'number', $route); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Route values should be an array, not a string + */ + public function testConstructionInvalidArgument() + { + new Route('foo'); + } +} |