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