public static setVersionTruncation ( integer | null $type ) | ||
$type | integer | null | Any of the VERSION_TRUNCATION_* constants |
public static function setVersionTruncation($type)
{
if (in_array($type, array(self::VERSION_TRUNCATION_BUILD, self::VERSION_TRUNCATION_NONE, self::VERSION_TRUNCATION_MAJOR, self::VERSION_TRUNCATION_MINOR, self::VERSION_TRUNCATION_PATCH))) {
self::$maxMinorParts = $type;
}
}
/** * @dataProvider getVersionTruncationFixtures */ public function testVersionTruncation($useragent, $truncationType, $osVersion, $clientVersion) { ParserAbstract::setVersionTruncation($truncationType); $dd = new DeviceDetector($useragent); $dd->parse(); $this->assertEquals($osVersion, $dd->getOs('version')); $this->assertEquals($clientVersion, $dd->getClient('version')); ParserAbstract::setVersionTruncation(ParserAbstract::VERSION_TRUNCATION_NONE); }