本文整理汇总了PHP中FunctionalTester::seeInDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::seeInDatabase方法的具体用法?PHP FunctionalTester::seeInDatabase怎么用?PHP FunctionalTester::seeInDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::seeInDatabase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: it_should_apply_number_placeholder_to_taxonomy_terms_too
/**
* @test
* it should apply number placeholder to taxonomy terms too
*/
public function it_should_apply_number_placeholder_to_taxonomy_terms_too(FunctionalTester $I)
{
$postIds = $I->haveManyPostsInDatabase(3, ['terms' => ['taxonomy_{{n}}' => ['term_{{n}}']]]);
for ($i = 0; $i < 3; $i++) {
$termId = $I->grabTermIdFromDatabase(['name' => 'term_' . $i]);
$termTaxonomyId = $I->grabTermTaxonomyIdFromDatabase(['term_id' => $termId, 'taxonomy' => 'taxonomy_' . $i]);
$I->seeInDatabase($I->grabTermRelationshipsTableName(), ['object_id' => $postIds[$i], 'term_taxonomy_id' => $termTaxonomyId, 'term_order' => 0]);
$I->seeInDatabase($I->grabTermTaxonomyTableName(), ['term_taxonomy_id' => $termTaxonomyId, 'taxonomy' => 'taxonomy_' . $i, 'count' => 1]);
}
}
示例2: it_should_allow_using_number_placeholder_when_inserting_many
/**
* @test
* it should allow using number placeholder when inserting many
*/
public function it_should_allow_using_number_placeholder_when_inserting_many(FunctionalTester $I)
{
$overrides = ['link_url' => 'http://example.com/{{n}}', 'link_name' => 'Example {{n}}', 'link_image' => 'http://example.com/images/image-{{n}}.jpg', 'link_target' => '_blank', 'link_description' => '{{n}} example link', 'link_visible' => 'N', 'link_owner' => 12, 'link_rating' => 14, 'link_updated' => Date::fromString('today'), 'link_rel' => 'nofollow', 'link_notes' => 'Not a real {{n}} image', 'link_rss' => 'http://example.com/rss/{{n}}'];
$ids = $I->haveManyLinksInDatabase(5, $overrides);
$table = $I->grabLinksTableName();
for ($i = 0; $i < count($ids); $i++) {
$I->assertTrue(is_int($ids[$i]));
foreach ($overrides as $key => $value) {
$I->seeInDatabase($table, ['link_id' => $ids[$i], $key => str_replace('{{n}}', $i, $value)]);
}
}
}
示例3: memberCanReturnBox
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);
}
示例4: it_should_add_the_main_site_address_by_default
/**
* @test
* it should add the main site address by default
*/
public function it_should_add_the_main_site_address_by_default(FunctionalTester $I)
{
$I->haveMultisiteInDatabase();
$I->seeInDatabase($I->grabSiteTableName(), ['domain' => $I->getSiteDomain(), 'path' => '/']);
}
示例5: it_should_serialize_object_comment_meta
/**
* @test
* it should serialize object comment meta
*/
public function it_should_serialize_object_comment_meta(FunctionalTester $I)
{
$postId = $I->havePostInDatabase();
$commentId = $I->haveCommentInDatabase($postId);
$meta = (object) ['one' => 1, 'two' => 2];
$I->haveCommentMetaInDatabase($commentId, 'foo', $meta);
$I->seeInDatabase($I->grabCommentmetaTableName(), ['comment_id' => $commentId, 'meta_key' => 'foo', 'meta_value' => serialize($meta)]);
}
示例6: it_should_allow_having_numbered_meta_for_many_posts_using_meta_input
/**
* @test
* it should allow having numbered meta for many posts using meta_input
*/
public function it_should_allow_having_numbered_meta_for_many_posts_using_meta_input(FunctionalTester $I)
{
$meta = ['one_{{n}}' => 'meta {{n}}', 'two_{{n}}' => '{{n}} meta {{n}}'];
$ids = $I->haveManyPostsInDatabase(3, ['meta_input' => $meta]);
for ($i = 0; $i < 3; $i++) {
$id = $ids[$i];
$I->seeInDatabase($I->grabPostsTableName(), ['ID' => $id]);
foreach ($meta as $meta_key => $meta_value) {
$I->seeInDatabase($I->grabPostmetaTableName(), ['post_id' => $id, 'meta_key' => str_replace('{{n}}', $i, $meta_key), 'meta_value' => str_replace('{{n}}', $i, $meta_value)]);
}
}
}
示例7: it_should_allow_setting_an_option_in_a_secondary_site
/**
* @test
* it should allow setting an option in a secondary site
*/
public function it_should_allow_setting_an_option_in_a_secondary_site(FunctionalTester $I)
{
$I->useBlog(2);
$I->haveOptionInDatabase('key', 'value');
$table = $I->grabPrefixedTableNameFor('options');
$I->seeInDatabase($table, ['option_name' => 'key', 'option_value' => 'value']);
}
示例8: FunctionalTester
$I = new FunctionalTester($scenario);
$I->am('an user');
$I->wantTo('Update my profile');
//setup
$I->amAuthenticatedWithCredentials();
$I->amOnAction('ProfileController@edit');
$user = \App\User::find(1);
//save
$_email = $user->email;
$_firstname = $user->profile->firstname;
$_lastname = $user->profile->lastname;
$_phone = $user->profile->phone;
//modify user
$I->fillField(['name' => 'email'], 'johndoe@foe.com');
$I->fillField(['id' => 'firstname'], 'John');
$I->fillField(['id' => 'lastname'], 'Doe');
$I->fillField(['id' => 'phone'], '+33616391876');
$I->click('submit-edit');
$I->cantSeeInField(['name' => 'email'], $_email);
$I->cantSeeInField(['id' => 'firstname'], $_firstname);
$I->cantSeeInField(['id' => 'lastname'], $_lastname);
$I->cantSeeInField(['id' => 'phone'], $_phone);
//reset user test
$I->fillField(['name' => 'email'], $_email);
$I->fillField(['id' => 'firstname'], $_firstname);
$I->fillField(['id' => 'lastname'], $_lastname);
$I->fillField(['id' => 'phone'], $_phone);
$I->click('submit-edit');
$I->seeInDatabase('users', ['email' => $_email]);
$I->seeInDatabase('users_profiles', ['phone' => $_phone]);
示例9: it_should_serialize_meta_value_when_adding_array_post_meta
/**
* @test
* it should serialize meta value when adding array post meta
*/
public function it_should_serialize_meta_value_when_adding_array_post_meta(FunctionalTester $I)
{
$id = $I->havePostInDatabase();
$meta = ['one', 'two', 'three'];
$I->havePostmetaInDatabase($id, 'foo', $meta);
$I->seeInDatabase($I->grabPostmetaTableName(), ['post_id' => $id, 'meta_key' => 'foo', 'meta_value' => serialize($meta)]);
}
示例10: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->am('an administrator');
$I->wantTo('add a new user');
Auth::loginUsingId(1);
$I->amOnPage('/admin/users/create');
$I->submitForm('//form', ['name' => 'Tom', 'email' => 'tom@email.com']);
$I->see('En epost er sendt');
$I->seeInDatabase('users', ['email' => 'tom@email.com', 'rights' => '[]']);
示例11: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('register for a new account');
$I->lookForwardTo('be a member');
$I->amOnPage('/register');
$I->see('Register', 'h1');
$I->fillField('Email:', 'joe@sample.com');
$I->fillField('Password:', '1234');
$I->click('Register Now');
$I->seeCurrentUrlEquals('/login');
$I->see('You may now sign in!', '.flash');
$I->seeInDatabase('users', ['email' => 'joe@sample.com']);
示例12: chargeAndBillUser
/**
* Confirm the gocardless method gets correctly called
*
* @param FunctionalTester $I
*/
public function chargeAndBillUser(FunctionalTester $I)
{
$authId = str_random();
$amount = rand(5, 30);
$userId = 31;
$chargeDate = Carbon::now()->day(10);
//Generate helper mock
$goCardlessHelper = m::mock('\\BB\\Helpers\\GoCardlessHelper');
$goCardlessHelper->shouldReceive('getNameFromReason')->withArgs(['subscription'])->once()->andReturn('Subscription');
$goCardlessHelper->shouldReceive('newBill')->withArgs([$authId, $amount, 'Subscription'])->once()->andReturn(false);
$repo = new \BB\Repo\SubscriptionChargeRepository(app('\\BB\\Entities\\SubscriptionCharge'), app('\\BB\\Repo\\PaymentRepository'), $goCardlessHelper);
//Call the method and confirm the mock gets called correctly
$repo->createChargeAndBillDD($userId, $chargeDate, $amount, 'processing', $authId);
$I->seeInDatabase('subscription_charge', ['user_id' => $userId, 'amount' => $amount]);
}
示例13: 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')]);
}
示例14: it_can_have_users
public function it_can_have_users(FunctionalTester $I)
{
$I->wantTo('have a user');
$I->haveUserInDatabase('someUser', 23);
$I->seeInDatabase('wp_users', ['ID' => 23, 'user_login' => 'someUser']);
}
示例15: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('sign in');
$I->amOnPage('user/login');
$I->fillField('email', 'admin@gmail.com');
$I->fillField('password', 'adminn');
$I->click('.btn-primary');
$I->amOnPage('/');
$I->see('admin');
$I->see('PHP');
$I->seeInDatabase('users', ['email' => 'admin@gmail.com']);
$I->seeRecord('users', ['email' => 'admin@gmail.com']);