public function testBranchAdd() { $user = factory(App\User::class)->create(); $faker = Faker\Factory::create(); $branch_name = $faker->company; $branch_phone = $faker->phoneNumber; $branch_fax = $faker->phoneNumber; $branch_email = $faker->email; $branch_address_line_1 = $faker->streetAddress; $branch_address_line_2 = $faker->secondaryAddress; $branch_city = $faker->city; $branch_postcode = $faker->postcode; $this->actingAs($user)->visit('/branch/add')->type($branch_name, 'name')->type($branch_phone, 'phone')->type($branch_fax, 'fax')->type($branch_email, 'email')->type($branch_address_line_1, 'address_line_1')->type($branch_address_line_2, 'address_line_2')->type($branch_city, 'address_town')->type($branch_postcode, 'address_postcode')->press("Add Branch")->visit('/branches')->see($branch_name); $branch = App\Branch::where('name', $branch_name)->first(); $this->seeInDatabase('branches', ['name' => $branch_name]); $this->actingAs($user)->visit('/branch/' . $branch->id)->see($branch_name)->see($branch_phone)->see($branch_fax)->see($branch_email)->see($branch_address_line_1)->see($branch_address_line_2)->see($branch_city)->see($branch_postcode); $branch->remove(); }
public function run() { DB::table('branches')->delete(); App\Branch::create(['name' => 'all']); }