예제 #1
0
 public function testNotNullNodes()
 {
     $keyword = 'GTX 970';
     $client = new Client();
     $searchEngine = $this->container->get('app.service.search_engine.one_a.search');
     $crawler = $client->request('GET', $searchEngine::URL . $keyword);
     $parsedData = $this->parser->parse($crawler);
     foreach ($parsedData as $data) {
         $this->assertNotNull($data['image'], 'Got null response, on image parse');
         $this->assertNotNull($data['name'], 'Got null response, on name parse');
         $this->assertNotNull($data['price'], 'Got null response, on price parse');
         $this->assertNotNull($data['link'], 'Got null response, on link parse');
     }
 }
예제 #2
0
 /**
  * @param string $keyword
  * @return mixed
  */
 public function search($keyword)
 {
     $crawler = $this->client->request('GET', self::URL . $keyword);
     $parsedData = $this->parser->parse($crawler);
     return $parsedData;
 }