本文整理汇总了PHP中FunctionalTester::seeCurrentRouteIs方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::seeCurrentRouteIs方法的具体用法?PHP FunctionalTester::seeCurrentRouteIs怎么用?PHP FunctionalTester::seeCurrentRouteIs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::seeCurrentRouteIs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: openPageByAction
public function openPageByAction(FunctionalTester $I)
{
$I->amOnAction('PostsController@index');
$I->seeCurrentUrlEquals('/posts');
$I->seeCurrentRouteIs('posts.index');
}
示例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
$I = new FunctionalTester($scenario);
$I->wantTo('Add a product to cart');
$product = $I->createModel(DanPowell\Shop\Models\Product::class, [], 'published', 1);
$I->amOnRoute('shop.product.show', $product->slug);
$I->click('Add to Cart');
$I->seeCurrentRouteIs('shop.cart.show');
$I->see('Product added to cart', '.alert');
$I->see($product->title, '.CartTable-product-title');
示例4: login_with_not_activated_account
public function login_with_not_activated_account(FunctionalTester $I)
{
$I->am('Unlogged user with a not activated account');
$I->wantTo('Login');
$I->expectTo('see an error message explaining that my account is not activated, with a link to resend the activation email');
/***************************************************************************************************************
* settings
**************************************************************************************************************/
// we create a user
$this->_credentials = ['last_name' => 'NOM', 'first_name' => 'Prénom', 'email' => 'autre@test.fr', 'password' => 'password'];
$user = \Sentinel::register($this->_credentials);
/***************************************************************************************************************
* run test
**************************************************************************************************************/
$I->amOnPage('/');
$I->seeCurrentRouteIs('home');
$I->click(trans('template.front.header.my_account'));
$I->seeCurrentRouteIs('login.index');
$I->fillField('email', 'autre@test.fr');
$I->fillField('password', 'password');
$I->click(trans('auth.login.action.login'));
$I->seeCurrentRouteIs('login.index');
$I->see(trans('global.modal.alert.title.error'), 'h3');
$I->see(trans('auth.message.activation.failure'));
$I->see(strip_tags(trans('auth.message.activation.email.resend', ['url' => route('account.activation_email', ['email' => $user->email]), 'email' => $user->email])));
}
示例5: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('Update Blog Tests');
// Not signed tests
$I->amOnRoute('blog.edit', 47);
$I->seeCurrentUrlEquals('/auth/login');
// Sign in
$I->signIn();
// Update Blog
$I->amOnRoute('blog.edit', 47);
$I->see('Edit Blog');
$I->fillField('form input[name=title]', 'New Blog by FunctionalTester');
$I->selectOption('form select[name=category_id]', '2');
$I->fillField('form textarea[name=body]', 'bodybodybody \\n by FunctionalTester');
$I->click('form [type=submit]');
$I->seeCurrentUrlMatches('~^/blog/(\\d+)$~');
$I->seeCurrentRouteIs('blog.show', 47);
示例6: FunctionalTester
/**
* ------------------------------------
* 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');
$I->see('My city');
示例7: access_to_the_leading_team_page
public function access_to_the_leading_team_page(FunctionalTester $I)
{
$I->am('Anybody');
$I->wantTo('access to the leading team page');
$I->expectTo('see that the user shown in the category they belong');
/***************************************************************************************************************
* settings
**************************************************************************************************************/
// we create a member of the student leading board
$credentials = ['last_name' => 'Student', 'first_name' => 'President', 'email' => 'student@president.fr', 'status_id' => config('user.status_key.student_president'), 'board_id' => config('user.board_key.student_leading_board'), 'password' => 'test'];
Sentinel::register($credentials, true);
// we create a member of the student leading board
$credentials = ['last_name' => 'Deactivated', 'first_name' => 'Student vice-president', 'email' => 'vice-student@president.fr', 'status_id' => config('user.status_key.user'), 'board_id' => config('user.board_key.student_leading_board'), 'password' => 'test'];
Sentinel::register($credentials);
// we create a member of the leading board
$credentials = ['last_name' => 'Regular', 'first_name' => 'President', 'email' => 'regular@president.fr', 'status_id' => config('user.status_key.president'), 'board_id' => config('user.board_key.leading_board'), 'password' => 'test'];
Sentinel::register($credentials, true);
// we create a member of the executive committee
$credentials = ['last_name' => 'Communication', 'first_name' => 'Responsible', 'email' => 'communication@una-club.fr', 'status_id' => config('user.status_key.communication_commission'), 'board_id' => config('user.board_key.executive_committee'), 'password' => 'test'];
Sentinel::register($credentials, true);
// we create an employee
$credentials = ['last_name' => 'Coach', 'first_name' => 'Employee', 'email' => 'coach@una-club.fr', 'status_id' => config('user.status_key.employee'), 'password' => 'test'];
Sentinel::register($credentials, true);
/***************************************************************************************************************
* run test
**************************************************************************************************************/
$I->amOnPage('/');
$I->seeCurrentRouteIs('home');
$I->click(trans('template.front.header.leading_team'));
$I->see('Student', '.student_leading_board');
$I->see('President', '.student_leading_board');
$I->see(trans('users.config.status.student_president'), '.student_leading_board');
$I->dontSee('Deactivated', '.student_leading_board');
$I->dontSee('Student vice-president', '.student_leading_board');
$I->dontSee(trans('users.config.status.user'), '.student_leading_board');
$I->see('Regular', '.leading_board');
$I->see('President', '.leading_board');
$I->see(trans('users.config.status.president'), '.leading_board');
$I->see('Communication', '.executive_committee');
$I->see('Responsible', '.executive_committee');
$I->see(trans('users.config.status.communication_commission'), '.executive_committee');
$I->see('Coach', '.employee');
$I->see('Employee', '.employee');
$I->see(trans('users.config.status.employee'), '.employee');
}
示例8: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('Add a product to cart that has bad extras');
// Create the models
$product = $I->createModel(DanPowell\Shop\Models\Product::class, [], 'inStock', 1);
// Extra 1 - This extra has a few options and will be selected
$extra1 = $I->makeModel(DanPowell\Shop\Models\Extra::class, [], 'inStock', 1);
$extra1 = $product->extras()->save($extra1);
$option1 = $I->makeModel(DanPowell\Shop\Models\Option::class, [], 'text', 1);
$option1 = $extra1->options()->save($option1);
$I->amOnRoute('shop.product.show', $product->slug);
// Select the extra 1, but DON'T fill out the option value
$I->checkOption('extra[' . $extra1->id . ']');
$I->submitForm('#addToCart', []);
$I->dontSee('Product added to cart', '.alert');
$I->seeCurrentRouteIs('shop.product.show');
$I->seeFormHasErrors();
示例9: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('Update Article Tests');
// Not signed tests
$I->amOnRoute('article.edit', 19);
$I->seeCurrentUrlEquals('/auth/login');
// Sign in
$I->signIn();
// Update Article
$I->amOnRoute('article.edit', 19);
$I->see('Edit Article');
$I->fillField('form input[name=title]', 'New Article by FunctionalTester');
$I->selectOption('form select[name=category_id]', '1');
$I->fillField('form textarea[name=body]', 'bodybodybody \\n by FunctionalTester');
$I->click('form [type=submit]');
$I->seeCurrentUrlMatches('~^/article/(\\d+)$~');
$I->seeCurrentRouteIs('article.show', 19);
示例10: routesWithTrailingSlashes
public function routesWithTrailingSlashes(FunctionalTester $I)
{
$I->amOnPage('/contact-us////////');
$I->see('Contact Us');
$I->seeCurrentRouteIs('front.contact');
}
示例11: checkHomePageContainsDataSetInAdmin
public function checkHomePageContainsDataSetInAdmin(FunctionalTester $I)
{
$I->am('Admin');
$I->wantTo('check on the home page that the data saved from the admin panel are shown');
$I->expectTo('see the saved data on the home page');
/***************************************************************************************************************
* settings
**************************************************************************************************************/
// we create the admin role
$admin_role = $this->_createAdminRole();
// we attach it to the logged user
$admin_role->users()->attach($this->_user);
// we create a slide
$this->_createSlide();
/***************************************************************************************************************
* run test
**************************************************************************************************************/
$I->amOnPage('/');
$I->seeCurrentRouteIs('home');
$I->see($this->_slide->title, 'h2');
$I->see($this->_slide->quote, '.quote');
$I->seeElement('//img[@src="' . url('img/slides/' . $this->_slide->picto) . '"]');
$I->seeElement('//div[@data-background-image="' . url('img/slides/' . $this->_slide->background_image) . '"]');
$I->see(json_decode(file_get_contents(storage_path('app/home/content.json')))->title, 'h2');
$I->see(json_decode(file_get_contents(storage_path('app/home/content.json')))->description);
$I->seeElement('//a[@href="' . json_decode(file_get_contents(storage_path('app/home/content.json')))->video_link . '"]');
}
示例12: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('Create an order');
// Add a product to the cart
$product = $I->createModel(DanPowell\Shop\Models\Product::class, [], 'published', 1);
$I->amOnRoute('shop.product.show', $product->slug);
$I->click('Add to Cart');
// Checkout
$I->click('Checkout');
$order = $I->makeModel(DanPowell\Shop\Models\Order::class, [], null, 1);
$I->submitForm('#createOrder', $order->toArray());
$I->seeCurrentRouteIs('shop.order.confirm');
// Continue to confirmation
//$I->click('Continue to confirmation');
// Check delivery option exists in config
// Check delivery option matches cart total
// Check billing & delivery country exists in config
示例13: delete_current_role_denied
public function delete_current_role_denied(FunctionalTester $I)
{
$I->am('Admin');
$I->wantTo('delete the Admin role');
$I->expectTo('see an error message explaining that deleting the role we use is not possible');
$admin = $this->_createAdminRole();
$admin->users()->attach($this->_user);
$I->amOnRoute('permissions.index');
$I->submitForm('#delete_' . $admin->id, []);
$I->seeCurrentRouteIs('permissions.index');
$I->see(trans('global.modal.alert.title.error'), 'h3');
$I->see(strip_tags(trans('permissions.message.delete.denied', ['name' => $admin->name])));
$I->see($admin->name, '.table-list');
}
示例14: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('Update Topic Tests');
// Not signed tests
$I->amOnRoute('topic.edit', 1);
$I->seeCurrentUrlEquals('/auth/login');
// Sign in
$I->signIn();
// Update topic
$I->amOnRoute('topic.edit', 1);
$I->see('Edit Topic');
$I->fillField('form input[name=title]', 'New Topic by FunctionalTester');
$I->selectOption('form select[name=node_id]', '4');
$I->fillField('form textarea[name=body]', 'bodybodybody \\n by FunctionalTester');
$I->click('form [type=submit]');
$I->seeCurrentUrlMatches('~^/topic/(\\d+)$~');
$I->seeCurrentRouteIs('topic.show', 1);
示例15: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('Add a duplicate product to cart that has low stock');
$product = $I->createModel(DanPowell\Shop\Models\Product::class, [], 'inStock', 1);
$I->amOnRoute('shop.product.show', $product->slug);
$I->submitForm('#addToCart', ['quantity' => 6]);
$I->seeCurrentRouteIs('shop.cart.show');
$I->see('Product added to cart', '.alert');
$I->amOnRoute('shop.product.show', $product->slug);
$I->submitForm('#addToCart', ['quantity' => 6]);
$I->seeCurrentRouteIs('shop.product.show', $product->slug);
$I->dontSee('Product added to cart', '.alert');
$I->see('not enough product stock');
$I->seeFormHasErrors();