/** * @covers ::getDataVersionHash * * @throws InvalidArgumentException * @throws ParserConditionNotSatisfiedException * @throws ParserConfigurationException * @throws UnexpectedValueException */ public function testDataVersion() { $class = new \ReflectionClass('\\Crossjoin\\Browscap\\Parser\\Sqlite\\Parser'); $method = $class->getMethod('getDataVersionHash'); $method->setAccessible(true); $parser = new Parser(); $parser2 = new Parser(); $parser2->setPropertyFilter(new Disallowed(['AolVersion'])); $dataVersion = $method->invokeArgs($parser, []); $dataVersion2 = $method->invokeArgs($parser2, []); static::assertNotSame($dataVersion, $dataVersion2); static::assertSame(40, strlen($dataVersion)); static::assertSame(40, strlen($dataVersion2)); }
/** * @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()); }