Ejemplo n.º 1
0
 public function memberCantVisitRolesPage(FunctionalTester $I)
 {
     $I->am('a member');
     $I->wantTo('make sure I can\'t view the roles page');
     //Load and login a known member
     $user = User::find(1);
     \Auth::login($user);
     $I->amOnPage('/roles');
     $I->canSeeResponseCodeIs(403);
 }
 public function teamMemberCanEditLog(FunctionalTester $I)
 {
     $I->am('a laser team member');
     $I->wantTo('make sure I can edit laser logs');
     //Load and login a known admin member
     $user = $I->loginLaserTeamMember();
     $otherUser = User::find(1);
     $I->amOnPage('/equipment/laser');
     $I->see($otherUser->name);
     $I->selectOption('form[name=equipmentLog] select[name=reason]', 'testing');
     $I->click('Update');
 }
Ejemplo n.º 3
0
 public function memberCanLeave(FunctionalTester $I)
 {
     $I->am('a member');
     $I->wantTo('leave build brighton');
     //Load and login a known member
     $user = User::find(1);
     Auth::login($user);
     $I->amOnPage('/account/' . $user->id . '');
     $I->canSee('Active');
     $I->click("Leave Build Brighton");
     $I->canSee('Leaving');
 }
 public function financeMemberCanVisitPaymentPage(FunctionalTester $I)
 {
     $I->am('a member of the finance group');
     $I->wantTo('make sure I can view the payments page');
     //Load and login a known member
     $user = User::find(3);
     $role = Role::findByName('finance');
     $role->users()->attach($user->id);
     Auth::login($user);
     $I->amOnPage('/payments');
     $I->seeCurrentUrlEquals('/payments');
     $I->see('Payments');
 }
 public function adminCanDeclineExpenses(FunctionalTester $I)
 {
     $I->am('an admin');
     $I->wantTo('make sure I can decline an expense');
     //Create a proposal that's currently open
     $I->haveInDatabase('expenses', ['id' => 4, 'category' => 'consumables', 'description' => 'Another Description', 'user_id' => '3', 'amount' => 1234, 'expense_date' => Carbon::now()]);
     //Load and login a known member
     $user = User::find(3);
     Auth::login($user);
     $I->amOnPage('/expenses');
     $I->canSee('Expenses');
     $I->canSee('Another Description');
     $I->cantSee('Declined by');
     $I->click('Decline');
     $I->canSee('Declined by');
 }
 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);
 }
 public function confirmEmail($id, $hash)
 {
     $user = User::find($id);
     if ($user && $user->hash == $hash) {
         $user->emailConfirmed();
         \Notification::success('Email address confirmed, thank you');
         return \Redirect::route('account.show', $user->id);
     }
     \Notification::error('Error confirming email address');
     return \Redirect::route('home');
 }
 public function adminCantEditStartedProposal(FunctionalTester $I)
 {
     $I->am('an admin');
     $I->wantTo('make sure I cannt edit a proposal thats been started');
     //Create a proposal that's currently open
     $startDate = Carbon::now()->subDays(2)->format('Y-m-d');
     $endDate = Carbon::now()->addDays(2)->format('Y-m-d');
     $I->haveInDatabase('proposals', ['id' => 2, 'title' => 'Proposal 2', 'description' => 'Demo Description', 'user_id' => '3', 'start_date' => $startDate, 'end_date' => $endDate]);
     //Load and login a known member
     $user = User::find(3);
     Auth::login($user);
     $I->amOnPage('/proposals/2');
     //I can visit the edit page
     $I->cantSee('Edit Proposal');
 }
<?php

use BB\Entities\User;
$I = new FunctionalTester($scenario);
$I->am('a member');
$I->wantTo('confirm I cant see other peoples edit page');
//Load and login a known member
$user = User::find(1);
Auth::login($user);
$otherUser = User::find(3);
$I->amOnPage('/account/' . $otherUser->id . '/profile/edit');
$I->seeResponseCodeIs(403);
<?php

use BB\Entities\User;
$I = new FunctionalTester($scenario);
$I->am('a member');
$I->wantTo('update my profile photo');
//Load and login a known member
$user = User::find(1);
Auth::login($user);
$I->amOnPage('/account/' . $user->id . '/profile/edit');
$I->canSee('Profile Photo');
$I->attachFile('Profile Photo', 'test-image.png');
$I->click('Save');
$I->seeCurrentUrlEquals('/members/' . $user->id);
 public function loginEquipmentTeamMember()
 {
     $user = User::find(4);
     \Auth::login($user);
     return $user;
 }