/** * Magic Method * * @param string $name * * @return mixed Value of property */ public function __get($name) { switch ($name) { case 'request': return $this->request; break; case 'matchInfo': return $this->request->getMatchInfo(); break; case 'modelDevices': return $this->modelDevices; break; case 'userAgentsWithDeviceID': return $this->request->getUserAgentsWithDeviceID(); break; case 'id': case 'userAgent': case 'fallBack': case 'actualDeviceRoot': return $this->modelDevices[0]->{$name}; break; default: if ($this->getVirtualCapabilityProvider()->exists($name)) { return $this->getVirtualCapabilityProvider()->get($name); } return $this->getCapability($name); break; } }
public function testConstruct() { $userAgent = 'testUA'; $header = array(Constants::HEADER_HTTP_USERAGENT => $userAgent); $object = new GenericRequest($header, $userAgent, null, false); self::assertSame($userAgent, $object->getUserAgent()); self::assertSame($userAgent, $object->getUserAgentNormalized()); self::assertSame($header, $object->getRequest()); self::assertFalse($object->isXhtmlDevice()); self::assertNull($object->getUserAgentProfile()); self::assertSame(hash('sha512', $userAgent), $object->getId()); self::assertInstanceOf('\\Wurfl\\Request\\MatchInfo', $object->getMatchInfo()); self::assertSame(array(), $object->getUserAgentsWithDeviceID()); self::assertSame($userAgent, $object->getOriginalHeader(Constants::HEADER_HTTP_USERAGENT)); self::assertNull($object->getOriginalHeader(Constants::HEADER_DEVICE_STOCK_UA)); }