本文整理汇总了PHP中FunctionalTester::have方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::have方法的具体用法?PHP FunctionalTester::have怎么用?PHP FunctionalTester::have使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::have方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FunctionalTester
<?php
/**
* ------------------------------------
* Notify user being "@"
* ------------------------------------
*/
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Notify a User when he/she is being AT on a newly Reply');
$SuperMan = $I->have('User', ['name' => 'SuperMan']);
$user = $I->signIn();
$topic = $I->postATopic(['title' => 'My Awsome Topic.', 'user_id' => $user->id]);
// another user leave a reply
$randomUser = $I->signIn();
$I->amOnRoute('topics.show', $topic->id);
$I->fillField(['name' => 'body'], 'The Awsome Reply. @SuperMan');
$I->click('#reply-create-submit');
$I->see('The Awsome Reply. <a href="' . route('users.show', $SuperMan->id) . '">@SuperMan</a>');
// sign in the author
$user = $I->signIn($SuperMan);
$I->seeRecord('users', ['id' => $user->id, 'notification_count' => 1]);
$I->amOnRoute('notifications.index');
$I->see('My Awsome Topic.');
$I->see('The Awsome Reply. <a href="' . route('users.show', $SuperMan->id) . '">@SuperMan</a>');
$I->see($randomUser->name);
$I->seeRecord('users', ['id' => $user->id, 'notification_count' => 0]);
示例2: FunctionalTester
<?php
/**
* ------------------------------------
* Reply deletion
* ------------------------------------
*/
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Delete a reply as a visitor, normal member and admin.');
$topic = $I->postATopic(['title' => 'My Awsome Topic.']);
$reply = $I->have('Reply', ['topic_id' => $topic->id]);
// Testing as a visitor
$I->am('as a visitor');
$I->amOnRoute('topics.show', $topic->id);
$I->dontSeeElement('#reply-delete-' . $reply->id);
$I->amOnRoute('topics.delete', $topic->id);
$I->seeCurrentRouteIs('login-required');
// Test as a normal member
$I->am('as a member');
$I->signIn();
$I->dontSeeElement('#reply-delete-' . $reply->id);
$I->amOnRoute('topics.delete', $topic->id);
$I->seeCurrentRouteIs('admin-required');
// Testing as a admin user
$I->am('a Phphub admin');
$I->signInAsAdmin();
$I->amOnRoute('topics.show', $topic->id);
$I->seeElement('#reply-delete-' . $reply->id);
$I->click('#reply-delete-' . $reply->id);
$I->dontSeeRecord('replies', ['id' => $reply->id]);
示例3: FunctionalTester
<?php
/**
* ------------------------------------
* Testing User Show
* ------------------------------------
*/
$I = new FunctionalTester($scenario);
$I->am('as a visitor');
$I->wantTo('See a user profile.');
$user = $I->have('User', ['name' => 'SuperMeOriganal2', 'created_at' => Carbon::now()->toDateTimeString()]);
$I->seeRecord('users', ['id' => $user->id]);
$I->amOnRoute('users.show', $user->id);
$I->see('SuperMeOriganal2');
示例4: FunctionalTester
<?php
/**
* ------------------------------------
* User favorites
* ------------------------------------
*/
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Visit a users.favorites as a Visitor and as a Member.');
$user = $I->have('User');
$topic = $I->postATopic(['title' => 'My Awsome Topic.']);
$favorite = $I->have('Favorite', ['user_id' => $user->id, 'topic_id' => $topic->id]);
// --------------- As a visitor --------------
$I->am('as a Visitor');
$I->amOnRoute('users.favorites', $user->id);
$I->see('My Awsome Topic.');
// --------------- As a member --------------
$I->am('as a Member');
$I->signIn();
$I->amOnRoute('users.favorites', $user->id);
$I->see('My Awsome Topic.');
示例5: FunctionalTester
<?php
/**
* ------------------------------------
* User editing
* ------------------------------------
*/
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Editing user profile as a Visitor and the Owner.');
$user = $I->have('User');
// --------------- As a visitor --------------
$I->am('as a Visitor');
$I->amOnRoute('users.show', $user->id);
$I->dontSeeElement('#user-edit-button');
$I->amOnRoute('users.edit', $user->id);
$I->seeCurrentRouteIs('login-required');
// --------------- As a member --------------
$user = $I->signIn();
$I->am('as the Owner');
$I->amOnRoute('users.show', $user->id);
$I->seeElement('#user-edit-button');
$I->click('#user-edit-button');
$I->seeCurrentRouteIs('users.edit', $user->id);
$I->fillField(['name' => 'city'], 'My city');
$I->fillField(['name' => 'company'], 'My company');
$I->fillField(['name' => 'twitter_account'], 'My twitter_account');
$I->fillField(['name' => 'personal_website'], 'My personal_website');
$I->fillField(['name' => 'signature'], 'My signature');
$I->fillField(['name' => 'introduction'], 'My introduction');
$I->click('#user-edit-submit');
示例6: FunctionalTester
<?php
/**
* ------------------------------------
* User replies
* ------------------------------------
*/
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Visit a users.replies as a Visitor and as a Member.');
$user = $I->have('User');
$topic = $I->postATopic(['title' => 'My Awsome Topic.']);
$data = ['body' => 'My Awsome Reply.', 'topic_id' => $topic->id, 'user_id' => $user->id];
$reply = $I->have('Reply', $data);
// --------------- As a visitor --------------
$I->am('as a Visitor');
$I->amOnRoute('users.replies', $user->id);
$I->see('My Awsome Topic.');
$I->see('My Awsome Reply.');
// --------------- As a member --------------
$I->am('as a Member');
$I->signIn();
$I->amOnRoute('users.replies', $user->id);
$I->see('My Awsome Topic.');
$I->see('My Awsome Reply.');
示例7: FunctionalTester
<?php
/**
* ------------------------------------
* Reply creation
* ------------------------------------
*/
$I = new FunctionalTester($scenario);
Route::enableFilters();
$I->wantTo('Creating a new reply as a visitor and member.');
$topic = $I->have('Topic');
// Test Login Redirect
$I->am('a Phphub visitor');
$I->amOnRoute('topics.show', $topic->id);
$I->fillField(['name' => 'body'], 'My first reply body.');
$I->click('#reply-create-submit');
$I->seeCurrentRouteIs('login-required');
// Test as a member
$I->signIn();
$I->am('as a Phphub member');
$I->amOnRoute('topics.show', $topic->id);
$I->fillField(['name' => 'body'], 'My first reply body.');
$I->click('#reply-create-submit');
$I->see('My first reply body.');