public function memberCanReturnBox(FunctionalTester $I) { $I->am('a member'); $I->wantTo('make sure I can return a box I own'); //Load and login a known member $user = User::find(1); $I->amLoggedAs($user); //Setup a box a already claimed $box = \BB\Entities\StorageBox::first(); $box->user_id = $user->id; $box->save(); $I->amOnPage('/storage_boxes'); //Make sure the db is correct $I->seeInDatabase('storage_boxes', ['user_id' => $user->id]); //The page should have our name next to the claimed box $I->see($user->name); $I->click('Return Box'); //We should be gone from the DB $I->dontSeeInDatabase('storage_boxes', ['user_id' => $user->id]); $I->cantSee($user->name); }
/** * Get all the active boxes * @return mixed */ public function getAll() { return $this->model->where('active', 1)->get(); }