@@ -90,12 +90,15 @@ public function get_one_created_page_from_db()
9090
9191 }
9292 /**
93- * A basic test to create a page from api
93+ * Author: Indra Shastri
94+ * Date:03-03-2018
95+ * A basic test to update a page from api
96+ *
9497 *
9598 * @return void
9699 */
97100 /** @test */
98- public function create_a_new_page_in_db_and_get_response ()
101+ public function update_a_page_in_db_and_get_response ()
99102 {
100103 $ page = make (Page::class);
101104 $ payload = [
@@ -107,12 +110,12 @@ public function create_a_new_page_in_db_and_get_response()
107110 "seo_description " => "<p> </p>↵<h1>SEO Description</h1>↵<p>some seco desctription</p>↵<p>askdsaj;ldsjfd</p> " ,
108111 "status " => "1 " ,
109112 ];
110- $ response = $ this ->json ('POST ' , '/api/v1/pages ' , $ payload , $ this ->headers );
111- $ response
112- ->assertStatus (200 )
113- ->assertJson ([
113+ $ response = "" ;
114+ $ response = $ this ->json ('PUT ' , '/api/v1/pages/1 ' , $ payload , $ this ->headers );
115+
116+ $ response ->assertStatus (200 );
117+ $ response ->assertJson ([
114118 "data " =>[
115- "id " => $ page ->id ,
116119 "title " => $ page ->title ,
117120 "status_label " => $ page ->status_label ,
118121 "status " => ($ page ->isActive ()) ? 'Active ' :'InActive ' ,
@@ -121,5 +124,55 @@ public function create_a_new_page_in_db_and_get_response()
121124 ]);
122125
123126 }
124-
127+ /**
128+ * Author: Indra Shastri
129+ * Date:03-03-2018
130+ * A basic test to create a page from api
131+ *
132+ * @return void
133+ */
134+ /** @test */
135+ public function create_a_new_page_in_db_and_get_response ()
136+ {
137+ $ page = make (Page::class);
138+ $ payload = [
139+ "title " => $ page ->title ,
140+ "description " => $ page ->description ,
141+ "cannonical_link " => $ page ->cannonical_link ,
142+ "seo_title " => "some tittle " ,
143+ "seo_keyword " => "some keywords " ,
144+ "seo_description " => "<p> </p>↵<h1>SEO Description</h1>↵<p>some seco desctription</p>↵<p>askdsaj;ldsjfd</p> " ,
145+ "status " => "1 " ,
146+ ];
147+ $ response = "" ;
148+ $ response = $ this ->json ('POST ' , '/api/v1/pages ' , $ payload , $ this ->headers );
149+ $ response ->assertStatus (201 );
150+ $ response ->assertJson ([
151+ "data " => [
152+ "title " => $ page ->title ,
153+ "status_label " => $ page ->status_label ,
154+ "status " => ($ page ->isActive ()) ? 'Active ' : 'InActive ' ,
155+ "created_by " => $ this ->user ->first_name ,
156+ "created_at " => (\Carbon \Carbon::now ())->toDateString ()
157+ ],
158+ ]);
159+
160+ }
161+ /**
162+ * Author: Indra Shastri
163+ * Date:03-03-2018
164+ * A basic test to create a page from api
165+ *
166+ * @return void
167+ */
168+ /** @test */
169+ public function delete_page_in_db_and_get_response (){
170+ $ page = create (Page::class);
171+ $ payload =[];
172+ $ response = $ this ->json ('DELETE ' , '/api/v1/pages/ ' .$ page ->id , $ payload , $ this ->headers );
173+ $ response ->assertStatus (200 )
174+ ->assertJson ([
175+ "message " => "The Page was successfully deleted. "
176+ ]);
177+ }
125178}
0 commit comments