當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。