/** * @expectedException \UserAgentParser\Exception\NoResultFoundException */ public function testNoResultFound() { if (!defined('CREDENTIALS_UDGER_COM_KEY')) { $this->markTestSkipped('no credentials available. Please provide tests/credentials.php'); } $this->markTestIncomplete('Currently i have no valid API key to create more integration tests'); $provider = new UdgerCom($this->getClient(), CREDENTIALS_UDGER_COM_KEY); $result = $provider->parse('...'); }
/** * Device only */ public function testParseDevice() { $info = new stdClass(); $info->device_name = 'watch'; $rawResult = new stdClass(); $rawResult->info = $info; $responseQueue = [new Response(200, ['Content-Type' => 'application/json'], json_encode($rawResult))]; $provider = new UdgerCom($this->getClient($responseQueue), 'apiKey123'); $result = $provider->parse('A real user agent...'); $expectedResult = ['device' => ['model' => null, 'brand' => null, 'type' => 'watch', 'isMobile' => null, 'isTouch' => null]]; $this->assertProviderResult($result, $expectedResult); }