File tree Expand file tree Collapse file tree 5 files changed +52
-0
lines changed Expand file tree Collapse file tree 5 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 12
12
use Blueprint \Models \Statements \QueryStatement ;
13
13
use Blueprint \Models \Statements \RedirectStatement ;
14
14
use Blueprint \Models \Statements \RenderStatement ;
15
+ use Blueprint \Models \Statements \ResourceStatement ;
15
16
use Blueprint \Models \Statements \RespondStatement ;
16
17
use Blueprint \Models \Statements \SendStatement ;
17
18
use Blueprint \Models \Statements \SessionStatement ;
@@ -376,6 +377,9 @@ protected function buildTestCases(Controller $controller)
376
377
$ assertion .= ')); ' ;
377
378
378
379
array_unshift ($ assertions ['response ' ], $ assertion );
380
+ } elseif ($ statement instanceof ResourceStatement) {
381
+ $ assertions ['response ' ][] = '$response->assertOk(); ' ;
382
+ $ assertions ['response ' ][] = '$response->assertJsonStructure([]); ' ;
379
383
} elseif ($ statement instanceof RespondStatement) {
380
384
$ tested_bits |= self ::TESTS_RESPONDS ;
381
385
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ public function index_behaves_as_expected()
24
24
$ certificates = factory (Certificate::class, 3 )->create ();
25
25
26
26
$ response = $ this ->get (route ('certificate.index ' ));
27
+
28
+ $ response ->assertOk ();
29
+ $ response ->assertJsonStructure ([]);
27
30
}
28
31
29
32
@@ -67,6 +70,9 @@ public function store_saves()
67
70
->get ();
68
71
$ this ->assertCount (1 , $ certificates );
69
72
$ certificate = $ certificates ->first ();
73
+
74
+ $ response ->assertOk ();
75
+ $ response ->assertJsonStructure ([]);
70
76
}
71
77
72
78
@@ -78,6 +84,9 @@ public function show_behaves_as_expected()
78
84
$ certificate = factory (Certificate::class)->create ();
79
85
80
86
$ response = $ this ->get (route ('certificate.show ' , $ certificate ));
87
+
88
+ $ response ->assertOk ();
89
+ $ response ->assertJsonStructure ([]);
81
90
}
82
91
83
92
@@ -115,6 +124,9 @@ public function update_behaves_as_expected()
115
124
116
125
$ certificate ->refresh ();
117
126
127
+ $ response ->assertOk ();
128
+ $ response ->assertJsonStructure ([]);
129
+
118
130
$ this ->assertEquals ($ name , $ certificate ->name );
119
131
$ this ->assertEquals ($ certificate_type ->id , $ certificate ->certificate_type_id );
120
132
$ this ->assertEquals ($ reference , $ certificate ->reference );
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ public function index_behaves_as_expected()
24
24
$ certificates = factory (Certificate::class, 3 )->create ();
25
25
26
26
$ response = $ this ->get (route ('certificate.index ' ));
27
+
28
+ $ response ->assertOk ();
29
+ $ response ->assertJsonStructure ([]);
27
30
}
28
31
29
32
@@ -67,6 +70,9 @@ public function store_saves()
67
70
->get ();
68
71
$ this ->assertCount (1 , $ certificates );
69
72
$ certificate = $ certificates ->first ();
73
+
74
+ $ response ->assertOk ();
75
+ $ response ->assertJsonStructure ([]);
70
76
}
71
77
72
78
@@ -78,6 +84,9 @@ public function show_behaves_as_expected()
78
84
$ certificate = factory (Certificate::class)->create ();
79
85
80
86
$ response = $ this ->get (route ('certificate.show ' , $ certificate ));
87
+
88
+ $ response ->assertOk ();
89
+ $ response ->assertJsonStructure ([]);
81
90
}
82
91
83
92
@@ -115,6 +124,9 @@ public function update_behaves_as_expected()
115
124
116
125
$ certificate ->refresh ();
117
126
127
+ $ response ->assertOk ();
128
+ $ response ->assertJsonStructure ([]);
129
+
118
130
$ this ->assertEquals ($ name , $ certificate ->name );
119
131
$ this ->assertEquals ($ certificate_type ->id , $ certificate ->certificate_type_id );
120
132
$ this ->assertEquals ($ reference , $ certificate ->reference );
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ public function index_behaves_as_expected()
23
23
$ certificateTypes = factory (CertificateType::class, 3 )->create ();
24
24
25
25
$ response = $ this ->get (route ('certificate-type.index ' ));
26
+
27
+ $ response ->assertOk ();
28
+ $ response ->assertJsonStructure ([]);
26
29
}
27
30
28
31
@@ -54,6 +57,9 @@ public function store_saves()
54
57
->get ();
55
58
$ this ->assertCount (1 , $ certificateTypes );
56
59
$ certificateType = $ certificateTypes ->first ();
60
+
61
+ $ response ->assertOk ();
62
+ $ response ->assertJsonStructure ([]);
57
63
}
58
64
59
65
@@ -65,6 +71,9 @@ public function show_behaves_as_expected()
65
71
$ certificateType = factory (CertificateType::class)->create ();
66
72
67
73
$ response = $ this ->get (route ('certificate-type.show ' , $ certificateType ));
74
+
75
+ $ response ->assertOk ();
76
+ $ response ->assertJsonStructure ([]);
68
77
}
69
78
70
79
@@ -94,6 +103,9 @@ public function update_behaves_as_expected()
94
103
95
104
$ certificateType ->refresh ();
96
105
106
+ $ response ->assertOk ();
107
+ $ response ->assertJsonStructure ([]);
108
+
97
109
$ this ->assertEquals ($ name , $ certificateType ->name );
98
110
}
99
111
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ public function index_behaves_as_expected()
23
23
$ categories = factory (Category::class, 3 )->create ();
24
24
25
25
$ response = $ this ->get (route ('category.index ' ));
26
+
27
+ $ response ->assertOk ();
28
+ $ response ->assertJsonStructure ([]);
26
29
}
27
30
28
31
@@ -60,6 +63,9 @@ public function store_saves()
60
63
->get ();
61
64
$ this ->assertCount (1 , $ categories );
62
65
$ category = $ categories ->first ();
66
+
67
+ $ response ->assertOk ();
68
+ $ response ->assertJsonStructure ([]);
63
69
}
64
70
65
71
@@ -71,6 +77,9 @@ public function show_behaves_as_expected()
71
77
$ category = factory (Category::class)->create ();
72
78
73
79
$ response = $ this ->get (route ('category.show ' , $ category ));
80
+
81
+ $ response ->assertOk ();
82
+ $ response ->assertJsonStructure ([]);
74
83
}
75
84
76
85
@@ -104,6 +113,9 @@ public function update_behaves_as_expected()
104
113
105
114
$ category ->refresh ();
106
115
116
+ $ response ->assertOk ();
117
+ $ response ->assertJsonStructure ([]);
118
+
107
119
$ this ->assertEquals ($ name , $ category ->name );
108
120
$ this ->assertEquals ($ image , $ category ->image );
109
121
$ this ->assertEquals ($ active , $ category ->active );
You can’t perform that action at this time.
0 commit comments