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


PHP Client::followRedirect方法代码示例

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


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

示例1: loginAsUser

 /**
  * @return Crawler
  * @throws \Exception
  */
 protected static function loginAsUser()
 {
     $uri = self::$container->get('router')->generate('login_route');
     $crawler = self::$client->request('GET', $uri);
     $form = $crawler->selectButton('login_btn')->form(['_username' => 'test', '_password' => '12345678']);
     self::$client->submit($form);
     self::assertTrue(self::$client->getResponse()->isRedirection());
     return self::$client->followRedirect();
 }
开发者ID:Gemorroj,项目名称:forum,代码行数:13,代码来源:ForumWebTestCase.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: testAdd

 public function testAdd()
 {
     $crawler = $this->client->request('GET', '/member/add');
     $this->assertEquals(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());
     $this->assertEquals(1, $crawler->filter('div.app_member_add')->count());
     $this->assertEquals(1, $crawler->selectButton('add')->count());
     $button = $crawler->selectButton('add')->first();
     $form = $button->form(array('member[firstname]' => 'John', 'member[lastname]' => 'Doe', 'member[gender]' => 'm', 'member[birthday]' => '11/04/1980', 'member[birthplace]' => 'New-York City', 'member[address]' => 'Main street', 'member[zip]' => '01234', 'member[city]' => 'Washington D.C.'));
     $form['member[photo]']->upload(__DIR__ . '/../../photo.jpg');
     $this->client->submit($form);
     $this->assertTrue($this->client->getResponse()->isRedirect());
     $crawler = $this->client->followRedirect();
     $this->assertEquals(1, $crawler->filter('div.flash.success')->count());
 }
开发者ID:thomasage,项目名称:asso,代码行数:14,代码来源:MemberControllerTest.php

示例4: testCreationPageEleveur_Success

 public function testCreationPageEleveur_Success()
 {
     // Création de compte
     $user = $this->testUtils->createUser()->getUser();
     // Formulaire de création de page eleveur
     $crawler = $this->client->request('GET', '/');
     $this->assertEquals('Nom de l\'élevage', $crawler->filter('form[name="creation-page-eleveur"] label')->text());
     $this->assertEquals('Créer ma page éleveur', $crawler->filter('form[name="creation-page-eleveur"] [type="submit"]')->text());
     $creationPageEleveurForm = $crawler->filter('form[name="creation-page-eleveur"]')->form();
     $rand = rand();
     $nomElevage = 'Les Chartreux de Tatouine ' . $rand;
     $creationPageEleveurForm['creation-page-eleveur[nom]'] = $nomElevage;
     $this->client->submit($creationPageEleveurForm);
     // Redirection vers sa page eleveur fraichement créé
     $this->assertEquals(302, $this->client->getResponse()->getStatusCode());
     $this->client->followRedirect();
     $this->assertTrue($this->client->getResponse()->isOk());
     $this->assertEquals('/elevage/les-chartreux-de-tatouine-' . $rand, $this->client->getRequest()->getRequestUri());
 }
开发者ID:apflieger,项目名称:zigotoo,代码行数:19,代码来源:DefaultControllerTest.php

示例5: testConfirmation

 public function testConfirmation()
 {
     $user = $this->testUtils->createUser()->getUser();
     $crawler = $this->client->request('GET', '/contact');
     $form = $crawler->filter('form')->form();
     $form['form[message]'] = 'test';
     $this->client->submit($form);
     $this->assertEquals(Response::HTTP_FOUND, $this->client->getResponse()->getStatusCode());
     $confirmationCrawler = $this->client->followRedirect();
     $this->assertContains('Nous vous répondrons à l\'adresse ' . $user->getEmail(), $confirmationCrawler->filter('#confirmation')->text());
 }
开发者ID:apflieger,项目名称:zigotoo,代码行数:11,代码来源:ContactControllerTest.php

示例6: runTroughStep5

 /**
  * @param \Symfony\Component\DomCrawler\Crawler $crawler
  * @param \Symfony\Bundle\FrameworkBundle\Client $client
  *
  * @return mixed
  */
 private function runTroughStep5($crawler, $client)
 {
     $form = $crawler->selectButton('Finish installation')->form();
     $client->submit($form, array('install_login[email]' => 'test@test.com', 'install_login[password][first]' => 'password', 'install_login[password][second]' => 'password'));
     $crawler = $client->followRedirect();
     // we should be redirected to step 6
     self::assertEquals(200, $client->getResponse()->getStatusCode());
     self::assertStringEndsWith('/install/6', $client->getHistory()->current()->getUri());
     self::assertGreaterThan(0, $crawler->filter('h2:contains("Installation complete")')->count());
     return $crawler;
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:17,代码来源:InstallerControllerTest.php

示例7: testLogout

 /**
  * @depends testLogin
  */
 public function testLogout(Client $client)
 {
     $this->setSecurityContextUser();
     $crawler = $client->getCrawler();
     $crawler = $client->request('GET', self::URL_DECONNECTION);
     $this->assertEquals(302, $client->getResponse()->getStatusCode());
     $this->assertEquals(self::URL_DECONNECTION, $client->getRequest()->getRequestUri());
     $crawler = $client->followRedirect();
     $this->assertEquals(200, $client->getResponse()->getStatusCode());
     $this->assertEquals('/en/', $client->getRequest()->getRequestUri());
 }
开发者ID:pigroupe,项目名称:SfynxAuthBundle,代码行数:14,代码来源:LoginTest.php

示例8: logout

 /**
  * @param  \Symfony\Bundle\FrameworkBundle\Client $client
  * @return WebTestCase
  */
 protected function logout(Client $client)
 {
     $client->request('GET', static::URL_DECONNECTION);
     $client->followRedirect();
     return $this;
 }
开发者ID:pigroupe,项目名称:SfynxAuthBundle,代码行数:10,代码来源:WebTestCase.php

示例9: assertIs404

 /**
  * @param Client $client
  */
 protected function assertIs404($client)
 {
     $client->followRedirect();
     $this->assertEquals(404, $client->getResponse()->getStatusCode());
     $this->assertStringEndsWith('404', $client->getHistory()->current()->getUri());
 }
开发者ID:biggtfish,项目名称:forkcms,代码行数:9,代码来源:WebTestCase.php

示例10: followRedirect

 /**
  * Follow redirects?
  *
  * @return Crawler
  *
  * @throws \LogicException If request was not a redirect
  *
  * @api
  */
 public function followRedirect()
 {
     return $this->subject->followRedirect();
 }
开发者ID:kleijnweb,项目名称:swagger-bundle,代码行数:13,代码来源:ApiTestClient.php


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