当前位置: 首页>>代码示例>>PHP>>正文


PHP FunctionalTester::have方法代码示例

本文整理汇总了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]);
开发者ID:adminrt,项目名称:phphub,代码行数:27,代码来源:NotificationReplyAtUserCept.php

示例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]);
开发者ID:adminrt,项目名称:phphub,代码行数:31,代码来源:ReplyDeletionCept.php

示例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');
开发者ID:TopJohn,项目名称:phphub,代码行数:14,代码来源:UserShowCept.php

示例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.');
开发者ID:jianoll,项目名称:phphub,代码行数:22,代码来源:UserFavoritesCept.php

示例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');
开发者ID:adminrt,项目名称:phphub,代码行数:31,代码来源:UserEditCept.php

示例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.');
开发者ID:adminrt,项目名称:phphub,代码行数:25,代码来源:UserRepliesCept.php

示例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.');
开发者ID:adminrt,项目名称:phphub,代码行数:24,代码来源:ReplyCreationCept.php


注:本文中的FunctionalTester::have方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。