當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Client::getCrawler方法代碼示例

本文整理匯總了PHP中Symfony\Bundle\FrameworkBundle\Client::getCrawler方法的典型用法代碼示例。如果您正苦於以下問題:PHP Client::getCrawler方法的具體用法?PHP Client::getCrawler怎麽用?PHP Client::getCrawler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Bundle\FrameworkBundle\Client的用法示例。


在下文中一共展示了Client::getCrawler方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

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

示例2: submitThemeUploadForm

 /**
  * @return void
  */
 private function submitThemeUploadForm()
 {
     $form = $this->client->getCrawler()->selectButton('Install')->form();
     $_FILES['file'] = ['name' => "{$this->fileName}.zip", 'type' => 'application/zip', 'tmp_name' => "{$this->fileName}.zip", 'error' => 0, 'size' => 0];
     $this->submitEditForm($this->client, $form, ['form' => 'upload']);
 }
開發者ID:forkcms,項目名稱:forkcms,代碼行數:9,代碼來源:UploadThemeTest.php

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

示例4: getCrawler

 /**
  * Returns the current Crawler instance.
  *
  * @return Crawler|null A Crawler instance
  *
  * @api
  */
 public function getCrawler()
 {
     return $this->subject->getCrawler();
 }
開發者ID:kleijnweb,項目名稱:swagger-bundle,代碼行數:11,代碼來源:ApiTestClient.php


注:本文中的Symfony\Bundle\FrameworkBundle\Client::getCrawler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。