BrowscapTest\UserAgentsTest::testUserAgentsStandard PHP Method

testUserAgentsStandard() public method

public testUserAgentsStandard ( string $userAgent, array $expectedProperties )
$userAgent string
$expectedProperties array
    public function testUserAgentsStandard($userAgent, $expectedProperties)
    {
        if (!is_array($expectedProperties) || !count($expectedProperties)) {
            self::markTestSkipped('Could not run test - no properties were defined to test');
        }
        static $updatedStandardCache = false;
        if (!$updatedStandardCache) {
            self::$browscapUpdater->getCache()->flush();
            self::$browscapUpdater->convertFile(self::$buildFolder . '/php_browscap.ini');
            $updatedStandardCache = true;
        }
        $actualProps = (array) self::$browscap->getBrowser($userAgent);
        foreach ($expectedProperties as $propName => $propValue) {
            if (!self::$propertyHolder->isOutputProperty($propName)) {
                continue;
            }
            if (!self::$propertyHolder->isStandardModeProperty($propName)) {
                continue;
            }
            $propName = strtolower($propName);
            self::assertArrayHasKey($propName, $actualProps, 'Actual result does not have "' . $propName . '" property');
            self::assertSame($propValue, $actualProps[$propName], 'Expected actual "' . $propName . '" to be "' . $propValue . '" (was "' . $actualProps[$propName] . '"; used pattern: ' . $actualProps['browser_name_pattern'] . ')');
        }
    }