public function memberCantCreateEntry(FunctionalTester $I)
 {
     $I->am('a member');
     $I->wantTo('make sure I cant create an equipment entry');
     //Load and login a known member
     $I->loginNormalMember();
     $I->amOnPage('/equipment');
     $I->cantSee('Record a new item');
     $I->amOnPage('/equipment/create');
     $I->canSeeResponseCodeIs(403);
 }
 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 memberCantAddCash(FunctionalTester $I)
 {
     $I->am('a member');
     $I->wantTo('make sure I cant add cash payments to my account');
     //Load and login a known member
     $user = User::find(1);
     Auth::login($user);
     //I cant see option
     $I->amOnPage('/account/' . $user->id . '');
     $I->cantSee('Record a cash balance payment');
     //Make sure they cant post payment directly
     //Confirm that posting directly generates a validation exception
     $I->sendPOST('/account/' . $user->id . '/payment/cash/create', ['reason' => 'balance', 'amount' => 4.69, 'return_path' => '/']);
     $I->seeResponseCodeIs(403);
     //One final check
     $I->cantSeeInDatabase('payments', ['amount' => 4.69]);
 }
 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 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');
 }
Esempio n. 6
0
 public function search_user(FunctionalTester $I)
 {
     $I->am('Admin');
     $I->wantTo('search a user');
     $I->expectTo('see the searched user');
     /***************************************************************************************************************
      * settings
      **************************************************************************************************************/
     // we create the admin role and attach the logged user to it
     $admin_role = $this->_createAdminRole();
     $admin_role->users()->attach($this->_user);
     // we create a new user
     $credentials = ['last_name' => 'Autre', 'first_name' => 'autre', 'email' => '*****@*****.**', 'status_id' => config('user.status_key.communication_commission'), 'board_id' => config('user.board_key.leading_board'), 'password' => 'autre'];
     $user1 = \Sentinel::register($credentials, true);
     // we create another user
     $credentials = ['last_name' => 'Other', 'first_name' => 'other', 'email' => '*****@*****.**', 'status_id' => config('user.status_key.communication_commission'), 'board_id' => config('user.board_key.leading_board'), 'password' => 'other'];
     $user2 = \Sentinel::register($credentials, true);
     /***************************************************************************************************************
      * run test
      **************************************************************************************************************/
     $I->amOnRoute('users.index');
     $I->see(strip_tags(trans('global.table_list.results.status', ['start' => 1, 'stop' => 2, 'total' => 2])));
     $I->see($user1->last_name, '.table-list');
     $I->see($user1->first_name, '.table-list');
     $I->see($user2->last_name, '.table-list');
     $I->see($user2->first_name, '.table-list');
     $I->seeInField('#input_lines', config('tablelist.default.lines'));
     $I->seeInField('#input_search', '');
     $I->fillField('#input_search', 'oth');
     $I->submitForm('#line_search_form', []);
     $I->cantSee($user1->last_name, '.table-list');
     $I->cantSee($user1->first_name, '.table-list');
     $I->see($user2->last_name, '.table-list');
     $I->see($user2->first_name, '.table-list');
     $I->see(strip_tags(trans('global.table_list.results.status', ['start' => 1, 'stop' => 1, 'total' => 1])));
 }
<?php

$I = new FunctionalTester($scenario);
$I->am('member');
$I->wantTo('confirm I can see member menu items only');
$I->loginNormalMember();
$I->amOnPage('/');
$I->canSeeLink('Your Membership');
$I->canSeeLink('Logout');
$I->cantSee('Admin');