public function testDeleteNews() { $user = factory('App\\User')->create(); $this->actingAs($user); // generate database factory('App\\Message', 2)->create(); $this->delete('/messages/2')->seeJson(['deleted' => true]); $this->assertEquals(1, App\Message::all()->count()); }
<?php get('guestbook', function () { return view('guestbook'); }); /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ //API get('api/messages', function () { return App\Message::all(); }); post('api/messages', function () { return App\Message::create(Request::all()); });