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