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


PHP Client::click方法代码示例

本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Client::click方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::click方法的具体用法?PHP Client::click怎么用?PHP Client::click使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Bundle\FrameworkBundle\Client的用法示例。


在下文中一共展示了Client::click方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testLogin

 /**
  * @dataProvider provideLoginData
  */
 public function testLogin(Client $client, $securedUrl, $login, $expectedMessage)
 {
     // client follow redirects
     $client->followRedirects();
     // go to secured page -> got login required
     $crawler = $client->request('GET', $securedUrl);
     $this->assertEquals(TrustedSsoController::LOGIN_REQUIRED_MESSAGE, $crawler->filter('#message')->text());
     // click link -> got login form
     $crawler = $client->click($crawler->filter('#url')->link());
     $this->assertEquals('login', $crawler->filter('form')->attr('id'));
     // fill form & submit -> got expected message
     $form = $crawler->filter('input[type=submit]')->form();
     $crawler = $client->submit($form, array('login[username]' => $login, 'login[password]' => $login));
     $this->assertEquals($expectedMessage, $crawler->filter('#message')->text());
     if (!$login === self::LOGIN_INVALID) {
         // check validation attributes
         $attrs = static::$kernel->getContainer()->get('security.context')->getToken()->getValidationAttributes();
         $this->assertEquals(array('attr1' => 'val1', 'attr2' => 'val2'), $attrs);
     }
     // logout -> got logout redirect
     $crawler = $client->request('GET', '/secured/logout');
     $this->assertEquals(TrustedSsoController::LOGOUT_REDIRECT_MESSAGE, $crawler->filter('#message')->text());
     // click link -> got logout done
     $crawler = $client->click($crawler->filter('#url')->link());
     $this->assertEquals(ServerController::LOGOUT_MESSAGE, $crawler->filter('#message')->text());
     // click link -> go to homepage
     $crawler = $client->click($crawler->filter('#url')->link());
     $this->assertEquals(TestController::HOME_MESSAGE, $crawler->filter('#message')->text());
 }
开发者ID:nicolasbui,项目名称:BeSimpleSsoAuthBundle,代码行数:32,代码来源:LoginTest.php

示例2: testOut

 public function testOut()
 {
     $this->client->request('GET', '/');
     $crawler = $this->client->followRedirect();
     $link = $crawler->filter('a#logout')->eq(0)->link();
     $this->client->click($link);
     //suivre redirection vers page login quand click sur 'logout'
     $this->assertEquals('Sonata\\UserBundle\\Controller\\SecurityFOSUser1Controller::logoutAction', $this->client->getRequest()->attributes->get('_controller'));
     $this->assertEquals(302, $this->client->getResponse()->getStatusCode());
 }
开发者ID:WildCodeSchool,项目名称:projet-gesty,代码行数:10,代码来源:ProfileController___.php

示例3: testEdit

 public function testEdit()
 {
     $crawler = $this->client->request('GET', '/member');
     $this->assertEquals(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());
     $this->assertEquals(1, $crawler->filter('div.app_member_index')->count());
     $this->assertGreaterThanOrEqual(1, $crawler->selectLink('Show')->count());
     $crawler = $this->client->click($crawler->selectLink('Show')->first()->link());
     $this->assertEquals(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());
     $this->assertEquals(1, $crawler->filter('div.app_member_show')->count());
     $this->assertGreaterThanOrEqual(1, $crawler->selectLink('Edit')->count());
     $crawler = $this->client->click($crawler->selectLink('Edit')->first()->link());
     $this->assertEquals(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());
     $this->assertEquals(1, $crawler->filter('div.app_member_edit')->count());
 }
开发者ID:thomasage,项目名称:asso,代码行数:14,代码来源:MemberControllerTest.php

示例4: logoutAction

 /**
  * Performs logout action and returns same client after log out.
  *
  * @param Client $client
  *
  * @return Client
  */
 public function logoutAction(Client $client)
 {
     $crawler = $client->request('GET', '/settings/login');
     $link = $crawler->filter('a:contains("Logout")')->link();
     $client->click($link);
     return $client;
 }
开发者ID:asev,项目名称:SettingsBundle,代码行数:14,代码来源:LoginTestHelper.php

示例5: pagination

 /**
  * @param Crawler $crawler
  * @return boolean|Crawler
  * TODO: Поиск записей по всем доступным страницам.
  */
 protected function pagination(Crawler $crawler)
 {
     $nextPageCrawler = $crawler->selectLink('След.');
     if ($nextPageCrawler && $nextPageCrawler->getNode(0) && false === mb_stripos($nextPageCrawler->getNode(0)->getAttribute('class'), 'ui-disabled', null, 'UTF-8')) {
         return self::$client->click($nextPageCrawler->link());
     }
     return false;
 }
开发者ID:Gemorroj,项目名称:forum,代码行数:13,代码来源:ForumWebTestCase.php

示例6: testPreviewOwner

 public function testPreviewOwner()
 {
     $pageEleveur = $this->testUtils->createUser()->toEleveur()->getPageEleveur();
     $crawler = $this->client->request('GET', '/elevage/' . $pageEleveur->getSlug());
     $this->assertContains(self::FLAG_JS_EDITABLE, $crawler->html());
     $previewLink = $crawler->filter('#eleveur-toolbar #preview')->link();
     $crawnlerPreview = $this->client->click($previewLink);
     $this->assertNotContains(self::FLAG_JS_EDITABLE, $crawnlerPreview->html());
 }
开发者ID:apflieger,项目名称:zigotoo,代码行数:9,代码来源:PageEleveurControllerTest.php

示例7: testLinkContact

 public function testLinkContact()
 {
     $crawler = $this->client->request('GET', '/');
     $this->client->click($crawler->filter('footer a[href="/contact"]')->link());
     $this->assertEquals(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());
 }
开发者ID:apflieger,项目名称:zigotoo,代码行数:6,代码来源:DefaultControllerTest.php

示例8: _goToSummary

 /**
  * Moves forward to the summary page
  *
  * @param \Symfony\Bundle\FrameworkBundle\Client $client HTTP test client
  * @return \Symfony\Component\DomCrawler\Crawler Crawler HTTP crawler
  */
 protected function _goToSummary($client)
 {
     $crawler = $client->request('GET', '/unittest/de/EUR/list');
     $link = $crawler->filter('.catalog-list-items .product a:contains("Unittest: Bundle")')->link();
     $crawler = $client->click($link);
     $form = $crawler->filter('.catalog-detail .addbasket .btn-action')->form();
     $crawler = $client->submit($form);
     $link = $crawler->filter('.basket-standard .btn-action')->link();
     $crawler = $client->click($link);
     $form = $crawler->filter('.checkout-standard form')->form();
     $form['ca_billingoption']->select($crawler->filter('.checkout-standard-address .item-address input')->attr('value'));
     $crawler = $client->submit($form);
     $form = $crawler->filter('.checkout-standard form')->form();
     $form['c_deliveryoption']->select($crawler->filter('.checkout-standard-delivery .item-service input')->attr('value'));
     $crawler = $client->submit($form);
     $form = $crawler->filter('.checkout-standard form')->form();
     $form['c_paymentoption']->select($crawler->filter('.checkout-standard-payment .item-service input')->attr('value'));
     $crawler = $client->submit($form);
     return $crawler;
 }
开发者ID:gvandencruche,项目名称:aimeos-symfony,代码行数:26,代码来源:CheckoutControllerTest.php

示例9: testLogIn

 public function testLogIn()
 {
     $link = $this->crawler->filter('a:contains("Zaloguj się")')->link();
     $log = $this->client->click($link);
     $this->assertContains("Formularz logowania", $log->filter('.container h1')->text());
 }
开发者ID:mgugniewicz,项目名称:dodajurlop,代码行数:6,代码来源:DefaultControllerWebTest.php

示例10: click

 /**
  * Clicks on a given link.
  *
  * @param Link $link A Link instance
  *
  * @return Crawler
  *
  * @api
  */
 public function click(Link $link)
 {
     return $this->subject->click($link);
 }
开发者ID:kleijnweb,项目名称:swagger-bundle,代码行数:13,代码来源:ApiTestClient.php


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