本文整理汇总了PHP中FunctionalTester::haveInDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::haveInDatabase方法的具体用法?PHP FunctionalTester::haveInDatabase怎么用?PHP FunctionalTester::haveInDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::haveInDatabase方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: memberCanClaimBox
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 £5");
//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 £15");
//We should now be able to claim another box
$I->see('Claim');
$I->click('Claim');
}
示例2: adminCanDeclineExpenses
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: adminCantEditStartedProposal
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: it_should_allow_grabbing_a_site_transient_while_using_secondary_blog
/**
* @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: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->amOnPage('/logout');
//setup
$I->am('a user');
$I->wantTo('login into my account');
$I->haveInDatabase('users', ['email' => 'john.doe@mail.com', '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'], 'john.doe@mail.com');
$I->fillField(['name' => 'password'], 'password');
$I->click('submit-login');
//verify
$I->seeCurrentActionIs('DashboardController@index');
$I->canSeeAuthentication();
示例6: paymentStatusSubChargeChange
/**
* 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: it_should_delete_usermeta
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']);
}
示例8: FunctionalTester
<?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);