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


PHP Client::getRequest方法代码示例

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


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

示例1: testRegisterSuccess

 public function testRegisterSuccess()
 {
     $this->form[self::USERNAME_FIELD] = self::USERNAME;
     $this->form[self::EMAIL_FIELD] = self::EMAIL;
     $this->form[self::PASSWORD_FIELD] = self::PASSWORD;
     $this->form[self::REPEAT_PASSWORD_FIELD] = self::PASSWORD;
     $this->crawler = $this->client->submit($this->form);
     $this->assertEmpty($this->crawler->filter(self::ERROR_SELECTOR));
     $this->assertNotEquals(self::REGISTRATION_URL, $this->client->getRequest()->getRequestUri());
 }
开发者ID:GrossumUA,项目名称:Symfony3-Base-Instance,代码行数:10,代码来源:RegistrationControllerTest.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: 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

示例4: 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

示例5: assertSEOCompatible

 protected function assertSEOCompatible(Client $client, $type = 'article')
 {
     $crawler = $client->getCrawler();
     $url = $client->getRequest()->getUri();
     $title = $crawler->filter('title')->text();
     // title
     $this->assertNotEmpty($title, 'The title is empty.');
     // meta
     $this->assertCount(1, $crawler->filter('meta[charset=UTF-8]'));
     $this->assertCount(1, $crawler->filter('meta[property="og:title"][content="' . $title . '"]'));
     $this->assertCount(1, $crawler->filter('meta[property="og:type"][content="' . $type . '"]'));
     $this->assertCount(1, $crawler->filter('meta[property="og:url"][content="' . $url . '"]'));
     // img
     // $this->assertCount(0, $crawler->filter('img[alt=""]'));
     $crawler->filter('img:not([alt])')->each(function ($node, $i) {
         $this->assertTrue(false, 'An image with no alt attribute has been found src=' . $node->attr('src'));
     });
 }
开发者ID:pigroupe,项目名称:SfynxAuthBundle,代码行数:18,代码来源:WebTestCase.php

示例6: printLastResponse

 /**
  * @Then print last response
  */
 public function printLastResponse()
 {
     $response = $this->client->getResponse();
     $request = $this->client->getRequest();
     printf("%s %d %s\n%s", $request->getMethod(), $response->getStatusCode(), $request->getUri(), $response->getContent());
 }
开发者ID:Im0rtality,项目名称:rest-api-bundle,代码行数:9,代码来源:FeatureContext.php

示例7: getRequest

 /**
  * Returns the current origin Request instance.
  *
  * The origin request is the request instance that is sent
  * to the code that handles requests.
  *
  * @return object|null A Request instance
  *
  * @see doRequest()
  *
  * @api
  */
 public function getRequest()
 {
     return $this->subject->getRequest();
 }
开发者ID:kleijnweb,项目名称:swagger-bundle,代码行数:16,代码来源:ApiTestClient.php


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