コード例 #1
0
 public function memberCanClaimBox(FunctionalTester $I)
 {
     $I->am('a member');
     $I->wantTo('make sure I can claim a box');
     //Load and login a known member
     $user = User::find(1);
     $I->amLoggedAs($user);
     //Create a box payment
     $I->haveInDatabase('payments', ['user_id' => $user->id, 'reason' => 'storage-box', 'source' => 'other', 'amount' => 5.0, 'status' => 'paid']);
     //$user->storage_box_payment_id = $paymentId;
     //$user->save();
     $I->amOnPage('/storage_boxes');
     //Make sure it has seen our payment
     $I->see("Total Paid &pound5");
     //Claim a box
     $I->see('Claim');
     $I->click('Claim');
     //We should end up back on the page
     $I->canSeeCurrentUrlEquals('/storage_boxes');
     //The page should now have our name next to the claimed box
     $I->see($user->name);
     //The box should be ours
     $I->seeInDatabase('storage_boxes', ['user_id' => $user->id]);
     //Add another payment
     $I->haveInDatabase('payments', ['user_id' => $user->id, 'reason' => 'storage-box', 'source' => 'other', 'amount' => 10.0, 'status' => 'paid']);
     $I->amOnPage('/storage_boxes');
     //Make sure it has seen our new payment
     $I->see("Total Paid &pound15");
     //We should now be able to claim another box
     $I->see('Claim');
     $I->click('Claim');
 }
コード例 #2
0
 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');
 }
コード例 #3
0
 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');
 }
コード例 #4
0
 /**
  * @test
  * it should allow grabbing a site transient while using secondary blog
  */
 public function it_should_allow_grabbing_a_site_transient_while_using_secondary_blog(FunctionalTester $I)
 {
     $table = $I->grabPrefixedTableNameFor('options');
     $I->haveInDatabase($table, ['option_name' => '_site_transient_key', 'option_value' => 'foo']);
     $I->useBlog(2);
     $value = $I->grabSiteTransientFromDatabase('key');
     $I->assertEquals('foo', $value);
 }
コード例 #5
0
<?php

$I = new FunctionalTester($scenario);
$I->amOnPage('/logout');
//setup
$I->am('a user');
$I->wantTo('login into my account');
$I->haveInDatabase('users', ['email' => '*****@*****.**', 'password' => bcrypt('password'), 'created_at' => '2015-03-29 19:48:28', 'updated_at' => '2015-03-29 19:48:28']);
//action
$I->amOnPage('/login');
$I->see('Connexion');
$I->fillField(['name' => 'email'], '*****@*****.**');
$I->fillField(['name' => 'password'], 'password');
$I->click('submit-login');
//verify
$I->seeCurrentActionIs('DashboardController@index');
$I->canSeeAuthentication();
コード例 #6
0
 /**
  * Payment status change updates sub charge
  *
  * @param FunctionalTester $I
  */
 public function paymentStatusSubChargeChange(FunctionalTester $I)
 {
     $I->haveInDatabase('users', ['id' => 17, 'active' => 1, 'status' => 'active', 'monthly_subscription' => 15]);
     $subChargeRepo = App::make('\\BB\\Repo\\SubscriptionChargeRepository');
     $paymentRepo = new \BB\Repo\PaymentRepository(new \BB\Entities\Payment());
     $subChargeDate = Carbon::create(2015, 1, 10, 0, 0, 0);
     $subCharge = $subChargeRepo->createCharge(17, $subChargeDate, 0, 'due');
     //Sub charge is due
     $I->seeInDatabase('subscription_charge', ['id' => $subCharge->id, 'status' => 'due', 'amount' => 0]);
     $paymentId = $paymentRepo->recordSubscriptionPayment(17, 'test', 1, 10, 'pending');
     $I->seeInDatabase('payments', ['id' => $paymentId, 'reason' => 'subscription', 'source' => 'test', 'reference' => $subCharge->id, 'status' => 'pending']);
     //When a payment has started the sub charge should be processing
     $I->seeInDatabase('subscription_charge', ['id' => $subCharge->id, 'status' => 'processing', 'amount' => 10]);
     $paymentDate = Carbon::create(2015, 1, 18, 0, 0, 0);
     $paymentRepo->markPaymentPaid($paymentId, $paymentDate);
     $I->seeInDatabase('payments', ['id' => $paymentId, 'reason' => 'subscription', 'source' => 'test', 'reference' => $subCharge->id, 'status' => 'paid']);
     //When the payment is paid the charge should be paid with a value and date
     $I->seeInDatabase('subscription_charge', ['id' => $subCharge->id, 'status' => 'paid', 'amount' => 10, 'payment_date' => $paymentDate->format('Y-m-d')]);
 }
コード例 #7
0
ファイル: WPDbCest.php プロジェクト: Bostonncity/wp-browser
 public function it_should_delete_usermeta(FunctionalTester $I)
 {
     $I->wantTo('delete a user meta');
     $table = 'wp_usermeta';
     $I->haveInDatabase($table, ['umeta_id' => null, 'user_id' => 21, 'meta_key' => 'someKey', 'meta_value' => 'someValue']);
     $I->seeUserMetaInDatabase(['user_id' => 21, 'meta_key' => 'someKey', 'meta_value' => 'someValue']);
     $I->dontHaveUserMetaInDatabase(['user_id' => 21, 'meta_key' => 'someKey', 'meta_value' => 'someValue']);
     $I->dontSeeInDatabase($table, ['user_id' => 21, 'meta_key' => 'someKey', 'meta_value' => 'someValue']);
 }
<?php

use Carbon\Carbon;
$I = new FunctionalTester($scenario);
$I->am('a member');
$I->wantTo('view recent member activity');
$user = $I->getActiveKeyholderMember();
$I->amLoggedAs($user);
$keyFob = $I->getMemberKeyFob($user->id);
$I->haveInDatabase('access_log', ['user_id' => $user->id, 'key_fob_id' => $keyFob->id, 'response' => '200', 'service' => 'main-door', 'created_at' => Carbon::now()]);
$I->amOnPage('activity');
//$I->seeCurrentUrlEquals('activity?date=2014-10-01');
$I->see($user->name);