blob: 4a72d277ee1bc4b7554379a2f454c703528792c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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');
}
}
|