@@ -36,10 +36,10 @@ public function testSingletonDefaults()
36
36
$ this ->assertEquals (200 , $ response ->getStatusCode ());
37
37
$ this ->assertSame ('singleton update ' , $ response ->getContent ());
38
38
39
- $ this ->assertSame ('http://localhost/avatar ' , route ('avatar.destroy ' ));
40
- $ response = $ this ->delete ('/avatar ' );
41
- $ this ->assertEquals (200 , $ response ->getStatusCode ());
42
- $ this ->assertSame ('singleton destroy ' , $ response ->getContent ());
39
+ // $this->assertSame('http://localhost/avatar', route('avatar.destroy'));
40
+ // $response = $this->delete('/avatar');
41
+ // $this->assertEquals(404 , $response->getStatusCode());
42
+ // $this->assertSame('singleton destroy', $response->getContent());
43
43
}
44
44
45
45
public function testCreatableSingleton ()
@@ -55,6 +55,11 @@ public function testCreatableSingleton()
55
55
$ response = $ this ->post ('/avatar ' );
56
56
$ this ->assertEquals (200 , $ response ->getStatusCode ());
57
57
$ this ->assertSame ('singleton store ' , $ response ->getContent ());
58
+
59
+ $ this ->assertSame ('http://localhost/avatar ' , route ('avatar.destroy ' ));
60
+ $ response = $ this ->delete ('/avatar ' );
61
+ $ this ->assertEquals (200 , $ response ->getStatusCode ());
62
+ $ this ->assertSame ('singleton destroy ' , $ response ->getContent ());
58
63
}
59
64
60
65
public function testApiSingleton ()
@@ -130,9 +135,9 @@ public function testSingletonExcept()
130
135
$ this ->assertEquals (200 , $ response ->getStatusCode ());
131
136
$ this ->assertSame ('singleton update ' , $ response ->getContent ());
132
137
133
- $ response = $ this ->delete ('/avatar ' );
134
- $ this ->assertEquals (200 , $ response ->getStatusCode ());
135
- $ this ->assertSame ('singleton destroy ' , $ response ->getContent ());
138
+ // $response = $this->delete('/avatar');
139
+ // $this->assertEquals(200, $response->getStatusCode());
140
+ // $this->assertSame('singleton destroy', $response->getContent());
136
141
}
137
142
138
143
public function testSingletonName ()
@@ -169,6 +174,30 @@ public function testNestedSingleton()
169
174
$ this ->assertEquals (200 , $ response ->getStatusCode ());
170
175
$ this ->assertSame ('singleton update for 123 ' , $ response ->getContent ());
171
176
177
+ $ response = $ this ->delete ('/videos/123/thumbnail ' );
178
+ $ this ->assertEquals (405 , $ response ->getStatusCode ());
179
+ }
180
+
181
+ public function testCreatableNestedSingleton ()
182
+ {
183
+ Route::singleton ('videos.thumbnail ' , NestedSingletonTestController::class)->creatable ();
184
+
185
+ $ response = $ this ->get ('/videos/123/thumbnail ' );
186
+ $ this ->assertEquals (200 , $ response ->getStatusCode ());
187
+ $ this ->assertSame ('singleton show for 123 ' , $ response ->getContent ());
188
+
189
+ $ response = $ this ->get ('/videos/123/thumbnail/edit ' );
190
+ $ this ->assertEquals (200 , $ response ->getStatusCode ());
191
+ $ this ->assertSame ('singleton edit for 123 ' , $ response ->getContent ());
192
+
193
+ $ response = $ this ->put ('/videos/123/thumbnail ' );
194
+ $ this ->assertEquals (200 , $ response ->getStatusCode ());
195
+ $ this ->assertSame ('singleton update for 123 ' , $ response ->getContent ());
196
+
197
+ $ response = $ this ->patch ('/videos/123/thumbnail ' );
198
+ $ this ->assertEquals (200 , $ response ->getStatusCode ());
199
+ $ this ->assertSame ('singleton update for 123 ' , $ response ->getContent ());
200
+
172
201
$ response = $ this ->delete ('/videos/123/thumbnail ' );
173
202
$ this ->assertEquals (200 , $ response ->getStatusCode ());
174
203
$ this ->assertSame ('singleton destroy for 123 ' , $ response ->getContent ());
0 commit comments