| @@ 56-64 (lines=9) @@ | ||
| 53 | /** |
|
| 54 | * Test immutable Route::withMethod() |
|
| 55 | */ |
|
| 56 | public function testWithMethod() |
|
| 57 | { |
|
| 58 | $expected = 'POST'; |
|
| 59 | $route = $this->route->withMethod($expected); |
|
| 60 | $this->assertSame( |
|
| 61 | $expected, |
|
| 62 | Helpers\Reflection::getProperty(Route::class, 'method', $route) |
|
| 63 | ); |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * Test immutable Route::withPattern() |
|
| @@ 69-77 (lines=9) @@ | ||
| 66 | /** |
|
| 67 | * Test immutable Route::withPattern() |
|
| 68 | */ |
|
| 69 | public function testWithPattern() |
|
| 70 | { |
|
| 71 | $expected = '/my-pattern/foo'; |
|
| 72 | $route = $this->route->withPattern($expected); |
|
| 73 | $this->assertSame( |
|
| 74 | $expected, |
|
| 75 | Helpers\Reflection::getProperty(Route::class, 'pattern', $route) |
|
| 76 | ); |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * |
|
| @@ 95-104 (lines=10) @@ | ||
| 92 | /** |
|
| 93 | * |
|
| 94 | */ |
|
| 95 | public function testWithHandlerString() |
|
| 96 | { |
|
| 97 | $expected = 'controller::class'; |
|
| 98 | $route = $this->route->withHandler($expected); |
|
| 99 | ||
| 100 | $this->assertSame( |
|
| 101 | $expected, |
|
| 102 | Helpers\Reflection::getProperty(Route::class, 'handler', $route) |
|
| 103 | ); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * |
|
| @@ 109-122 (lines=14) @@ | ||
| 106 | /** |
|
| 107 | * |
|
| 108 | */ |
|
| 109 | public function testWithHandlerClosure() |
|
| 110 | { |
|
| 111 | $expected = function () { |
|
| 112 | return 'closure'; |
|
| 113 | }; |
|
| 114 | $route = $this->route->withHandler($expected); |
|
| 115 | ||
| 116 | $actual = Helpers\Reflection::getProperty(Route::class, 'handler', $route); |
|
| 117 | ||
| 118 | $this->assertSame( |
|
| 119 | $expected, |
|
| 120 | $actual |
|
| 121 | ); |
|
| 122 | } |
|
| 123 | ||
| 124 | /** |
|
| 125 | * |
|