Browscap\Data\PropertyHolder::isLiteModeProperty PHP Method

isLiteModeProperty() public method

Determine if the specified property is an property that should be included in the "full" versions of the files only
public isLiteModeProperty ( string $propertyName ) : boolean
$propertyName string
return boolean
    public function isLiteModeProperty($propertyName)
    {
        $outputProperties = ['Parent' => 1, 'Comment' => 1, 'Browser' => 1, 'Platform' => 1, 'Version' => 1, 'isMobileDevice' => 1, 'isTablet' => 1, 'Device_Type' => 1];
        return isset($outputProperties[$propertyName]);
    }

Usage Example

Beispiel #1
0
 /**
  * @dataProvider userAgentDataProvider
  * @coversNothing
  *
  * @param string $userAgent
  * @param array  $expectedProperties
  * @param bool   $lite
  *
  * @group integration
  * @group useragenttest
  * @group lite
  */
 public function testUserAgentsLite($userAgent, $expectedProperties, $lite = true)
 {
     if (!is_array($expectedProperties) || !count($expectedProperties)) {
         self::markTestSkipped('Could not run test - no properties were defined to test');
     }
     if (!$lite) {
         self::markTestSkipped('Test skipped - Browser/Platform/Version not defined for Lite Mode');
     }
     self::$browscap->iniFilename = 'lite_browscap.ini';
     self::$browscap->localFile = self::$buildFolder . '/lite_php_browscap.ini';
     self::$browscap->cacheFilename = 'cache-lite.php';
     self::$browscap->doAutoUpdate = false;
     self::$browscap->silent = false;
     self::$browscap->updateMethod = Browscap::UPDATE_LOCAL;
     static $updatedLiteCache = false;
     if (!$updatedLiteCache) {
         self::$browscap->updateCache();
         $updatedLiteCache = true;
     }
     $actualProps = (array) self::$browscap->getBrowser($userAgent);
     foreach ($expectedProperties as $propName => $propValue) {
         if (!self::$propertyHolder->isOutputProperty($propName)) {
             continue;
         }
         if (!self::$propertyHolder->isLiteModeProperty($propName)) {
             continue;
         }
         self::assertArrayHasKey($propName, $actualProps, 'Actual properties did not have "' . $propName . '" property');
         self::assertSame($propValue, $actualProps[$propName], 'Expected actual "' . $propName . '" to be "' . $propValue . '" (was "' . $actualProps[$propName] . '"; used pattern: ' . $actualProps['browser_name_pattern'] . ')');
     }
 }
All Usage Examples Of Browscap\Data\PropertyHolder::isLiteModeProperty