public function testDeleteClientOk() { $user = App\User::all()->last(); $client = App\Client::count(); $this->actingAs($user)->call('delete', '/client/' . App\Client::all()->last()->Id); $this->assertNotEquals($client - 1, App\Client::count()); }
/** * A basic test example. * * @return void */ public function testAddClientOk() { $user = App\User::first(); $client = App\Client::all()->last(); $this->actingAs($user)->withSession(['foo' => 'bar'])->visit('/')->click('Clients')->see('List of clients')->click('Add client')->type('Gica', 'Name')->type('Bradford, Laisteridge Lane, Revis Barber Halls, BD71LD', 'Address')->type('07511376542', 'PhoneNo')->type('*****@*****.**', 'Email')->press('Add client')->seeInDatabase('clients', ['Id' => $client->Id + 1]); }
| 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. | */ Route::get('/', 'WelcomeController@index'); Route::get('dashboard', 'PagesController@dashboard'); Route::get('login', 'PagesController@login'); Route::get('home', function () { if (Auth::guest()) { return Redirect::to('login'); } else { return view('pages.dashboard')->with('users', App\User::all())->with('task_categories', App\TaskCategory::all())->with('tasks', App\Task::all())->with('companies', App\Company::all())->with('contracts', App\Contract::all())->with('solutions', App\Solution::all())->with('clients', App\Client::all())->with('employees', App\Employee::all()); } }); // model routes.. Route::post('tc/store', 'TaskCategoryController@store'); Route::post('tc/edit/{id}', array('uses' => 'TaskCategoryController@edit', 'as' => 'route.edit')); Route::patch('tc/{id}', array('uses' => 'TaskCategoryController@update', 'as' => 'route.update')); Route::delete('tc/{id}', array('uses' => 'TaskCategoryController@destroy', 'as' => 'route.destroy')); Route::post('task/store', 'TaskController@store'); Route::post('task/edit/{id}', array('uses' => 'TaskController@edit', 'as' => 'task.edit')); Route::post('task/approve/{id}', array('uses' => 'TaskController@approve', 'as' => 'task.approve')); Route::patch('task/{id}', array('uses' => 'TaskController@update', 'as' => 'task.update')); Route::delete('task/{id}', array('uses' => 'TaskController@destroy', 'as' => 'task.destroy')); Route::post('client/store', 'ClientController@store'); Route::post('client/edit/{id}', array('uses' => 'ClientController@edit', 'as' => 'client.edit')); Route::patch('client/{id}', array('uses' => 'ClientController@update', 'as' => 'client.update'));