public function testEncodeIsCorrect() { $provider = new UserAgentStringCom($this->getClient()); $userAgent = 'JUC (Linux; U; 4.0.1; zh-cn; HTC_HD7_4G_T9399+_For_AT&T; 480*800) UCWEB7.9.4.145/139/800'; $result = $provider->parse($userAgent); $this->assertEquals('UC Browser', $result->getBrowser()->getName()); }
/** * OS only */ public function testVersionUnderscore() { $rawResult = new stdClass(); $rawResult->agent_type = 'Browser'; $rawResult->agent_version = '6_0_2'; $rawResult->os_versionNumber = '6_5_4'; $responseQueue = [new Response(200, ['Content-Type' => 'application/json'], json_encode($rawResult))]; $provider = new UserAgentStringCom($this->getClient($responseQueue)); $result = $provider->parse('A real user agent...'); $expectedResult = ['browser' => ['name' => null, 'version' => ['major' => 6, 'minor' => 0, 'patch' => 2, 'alias' => null, 'complete' => '6_0_2']], 'operatingSystem' => ['name' => null, 'version' => ['major' => 6, 'minor' => 5, 'patch' => 4, 'alias' => null, 'complete' => '6_5_4']]]; $this->assertProviderResult($result, $expectedResult); }