public function testGetName() { $browser = new Browser(); $this->assertEquals('', $browser->getName()); $browser->reset(['name' => 'Chrome', 'version' => new Version(['value' => '47.0.2526.73', 'details' => 1])]); $this->assertEquals('Chrome', $browser->getName()); }
/** * * @param Model\Browser $browser * @param \WhichBrowser\Model\Browser $browserRaw */ private function hydrateBrowser(Model\Browser $browser, \WhichBrowser\Model\Browser $browserRaw) { if ($this->isRealResult($browserRaw->getName(), 'browser', 'name') === true) { $browser->setName($browserRaw->getName()); $browser->getVersion()->setComplete($this->getRealResult($browserRaw->getVersion())); return; } if (isset($browserRaw->using) && $browserRaw->using instanceof \WhichBrowser\Model\Using) { /* @var $usingRaw \WhichBrowser\Model\Using */ $usingRaw = $browserRaw->using; if ($this->isRealResult($usingRaw->getName()) === true) { $browser->setName($usingRaw->getName()); $browser->getVersion()->setComplete($this->getRealResult($usingRaw->getVersion())); } } }