/** * Device only */ public function testParseDevice() { $parser = $this->getParser(); $parser->expects($this->any())->method('getClient')->will($this->returnValue([])); $parser->expects($this->any())->method('getOs')->will($this->returnValue([])); $parser->expects($this->any())->method('getDevice')->will($this->returnValue(1)); $parser->expects($this->any())->method('getModel')->will($this->returnValue('iPhone')); $parser->expects($this->any())->method('getBrandName')->will($this->returnValue('Apple')); $parser->expects($this->any())->method('getDeviceName')->will($this->returnValue('smartphone')); $parser->expects($this->any())->method('isMobile')->will($this->returnValue(true)); $parser->expects($this->any())->method('isTouchEnabled')->will($this->returnValue(true)); $provider = new PiwikDeviceDetector(); $provider->setParser($parser); $result = $provider->parse('A real user agent...'); $expectedResult = ['device' => ['model' => 'iPhone', 'brand' => 'Apple', 'type' => 'smartphone', 'isMobile' => true, 'isTouch' => true]]; $this->assertProviderResult($result, $expectedResult); }