/** * @covers ::setSource * * @throws InvalidArgumentException * @throws ParserConfigurationException * @throws SourceUnavailableException * @throws UnexpectedValueException */ public function testValidSource() { $iniFile = dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'lite_php_browscap.ini'; $source = new File($iniFile); $parser = new Parser(); $parser->setSource($source); static::assertSame($source, $parser->getSource()); }
/** * @covers ::getBrowser * @covers ::autoUpdate * @covers ::update * * @throws InvalidArgumentException * @throws ParserConfigurationException * @throws ParserConditionNotSatisfiedException * @throws ParserRuntimeException * @throws SourceUnavailableException */ public function testGetBrowserWithAutoUpdate() { $directory = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'parser' . DIRECTORY_SEPARATOR; $iniFile = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'lite_php_browscap.ini'; $parser = new Parser($directory); $source = new File($iniFile); $parser->setSource($source); $browscap = new Browscap(); $browscap->setParser($parser); $browscap->setAutoUpdateProbability(100); $result = $browscap->getBrowser(); static::assertInternalType('object', $result); static::assertSame($source->getVersion(), $parser->getReader()->getVersion()); }