code
stringlengths 31
1.39M
| docstring
stringlengths 23
16.8k
| func_name
stringlengths 1
126
| language
stringclasses 1
value | repo
stringlengths 7
63
| path
stringlengths 7
166
| url
stringlengths 50
220
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
public function testIsStandardModePropertyWithWriter(): void
{
$mockWriter = $this->getMockBuilder(CsvWriter::class)
->disableOriginalConstructor()
->onlyMethods(['getType'])
->getMock();
$mockWriter
->expects(static::once())
->method('getType')
->willReturn(WriterInterface::TYPE_CSV);
static::assertTrue($this->object->isStandardModeProperty('PropertyName', $mockWriter));
}
|
tests detecting a standard mode property
@throws ExpectationFailedException
|
testIsStandardModePropertyWithWriter
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/PropertyHolderTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/PropertyHolderTest.php
|
MIT
|
public static function outputPropertiesDataProvider(): array
{
return [
['Comment', true],
['Browser', true],
['Platform', true],
['Platform_Description', true],
['Device_Name', true],
['Device_Maker', true],
['RenderingEngine_Name', true],
['RenderingEngine_Description', true],
['Parent', true],
['Platform_Version', true],
['RenderingEngine_Version', true],
['Version', true],
['MajorVer', true],
['MinorVer', true],
['CssVersion', true],
['AolVersion', true],
['Alpha', true],
['Beta', true],
['Win16', true],
['Win32', true],
['Win64', true],
['Frames', true],
['IFrames', true],
['Tables', true],
['Cookies', true],
['BackgroundSounds', true],
['JavaScript', true],
['VBScript', true],
['JavaApplets', true],
['ActiveXControls', true],
['isMobileDevice', true],
['isSyndicationReader', true],
['isFake', true],
['isAnonymized', true],
['isModified', true],
['Crawler', true],
['lite', false],
['sortIndex', false],
['Parents', false],
['division', false],
['Browser_Type', true],
['Device_Type', true],
['Device_Pointing_Method', true],
['Browser_Maker', true],
['isTablet', true],
['PatternId', false],
];
}
|
Data Provider for the test testIsOutputProperty
@return array<int, array<int, bool|string>>
@throws void
|
outputPropertiesDataProvider
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/PropertyHolderTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/PropertyHolderTest.php
|
MIT
|
public function testIsOutputPropertyWithCsvWriter(): void
{
$mockWriterCsv = $this->getMockBuilder(CsvWriter::class)
->disableOriginalConstructor()
->onlyMethods(['getType'])
->getMock();
$mockWriterCsv
->expects(static::once())
->method('getType')
->willReturn(WriterInterface::TYPE_CSV);
static::assertTrue($this->object->isOutputProperty('PropertyName', $mockWriterCsv));
$mockWriterIni = $this->getMockBuilder(IniWriter::class)
->disableOriginalConstructor()
->onlyMethods(['getType'])
->getMock();
$mockWriterIni
->expects(static::exactly(2))
->method('getType')
->willReturn(WriterInterface::TYPE_INI);
static::assertTrue($this->object->isOutputProperty('PatternId', $mockWriterIni));
}
|
tests detecting a output property if a writer is given
@throws ExpectationFailedException
|
testIsOutputPropertyWithCsvWriter
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/PropertyHolderTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/PropertyHolderTest.php
|
MIT
|
public function testIsOutputPropertyWithIniWriter(): void
{
$mockWriterIni = $this->getMockBuilder(IniWriter::class)
->disableOriginalConstructor()
->onlyMethods(['getType'])
->getMock();
$mockWriterIni
->expects(static::exactly(2))
->method('getType')
->willReturn(WriterInterface::TYPE_INI);
static::assertTrue($this->object->isOutputProperty('PatternId', $mockWriterIni));
}
|
tests detecting a output property if a writer is given
@throws ExpectationFailedException
|
testIsOutputPropertyWithIniWriter
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/PropertyHolderTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/PropertyHolderTest.php
|
MIT
|
public static function checkValueInArrayProvider(): array
{
return [
['Device_Pointing_Method', 'touchscreen'],
['Browser_Bits', '32'],
['Platform_Bits', '64'],
];
}
|
Data Provider for the test testCheckValueInArray
@return array<int, array<int, int|string>>
@throws void
|
checkValueInArrayProvider
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/PropertyHolderTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/PropertyHolderTest.php
|
MIT
|
public function testCheckValueInArray(string $propertyName, string $propertyValue): void
{
$actualValue = $this->object->checkValueInArray($propertyName, $propertyValue);
static::assertSame($propertyValue, $actualValue);
}
|
@throws ExpectationFailedException
@throws InvalidArgumentException
@dataProvider checkValueInArrayProvider
|
testCheckValueInArray
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/PropertyHolderTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/PropertyHolderTest.php
|
MIT
|
public static function deprecatedPropertiesDataProvider(): array
{
return [
['Comment', false],
['Browser', false],
['Platform', false],
['Platform_Description', false],
['Device_Name', false],
['Device_Maker', false],
['RenderingEngine_Name', false],
['RenderingEngine_Description', false],
['Parent', false],
['Platform_Version', false],
['RenderingEngine_Version', false],
['Version', false],
['MajorVer', true],
['MinorVer', true],
['CssVersion', false],
['AolVersion', true],
['Alpha', false],
['Beta', false],
['Win16', true],
['Win32', true],
['Win64', true],
['Frames', false],
['IFrames', false],
['Tables', false],
['Cookies', false],
['BackgroundSounds', false],
['JavaScript', false],
['VBScript', false],
['JavaApplets', false],
['ActiveXControls', false],
['isMobileDevice', true],
['isSyndicationReader', false],
['isFake', false],
['isAnonymized', false],
['isModified', false],
['Crawler', true],
['lite', false],
['sortIndex', false],
['Parents', false],
['division', false],
['Browser_Type', false],
['Device_Type', false],
['Device_Pointing_Method', false],
['Browser_Maker', false],
['isTablet', true],
['PatternId', false],
];
}
|
Data Provider for the test isDeprecatedProperty
@return array<int, array<int, bool|string>>
@throws void
|
deprecatedPropertiesDataProvider
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/PropertyHolderTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/PropertyHolderTest.php
|
MIT
|
public function testGetter(): void
{
$userAgent = 'TestMatchName';
$properties = ['Parent' => 'def', 'Comment' => 'xyz'];
$children = [];
$platform = 'TestPlatform';
$engine = 'TestEngine';
$device = 'TestDevice';
$object = new UserAgent($userAgent, $properties, $children, $platform, $engine, $device);
static::assertSame($userAgent, $object->getUserAgent());
static::assertSame($properties, $object->getProperties());
static::assertTrue(is_iterable($object->getChildren()));
static::assertSame($platform, $object->getPlatform());
static::assertSame($engine, $object->getEngine());
static::assertSame($device, $object->getDevice());
}
|
tests setter and getter for the match property
@throws ExpectationFailedException
|
testGetter
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/UseragentTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/UseragentTest.php
|
MIT
|
public function testBuildWithoutStandardProperty(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the value for "standard" key is missing for browser "Test"');
$browserData = ['Browser' => 'def'];
$browserName = 'Test';
$this->object->build($browserData, $browserName);
}
|
@throws AssertionFailedException
@throws RuntimeException
@throws InvalidArgumentException
|
testBuildWithoutStandardProperty
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/BrowserFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/BrowserFactoryTest.php
|
MIT
|
public function testBuildWithWrongBrowserType(): void
{
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('unsupported browser type given for browser "Test"');
$browserData = ['properties' => ['Browser' => 'xyz'], 'standard' => true, 'lite' => false, 'type' => 'does not exist'];
$browserName = 'Test';
$this->object->build($browserData, $browserName);
}
|
@throws AssertionFailedException
@throws RuntimeException
@throws UnexpectedValueException
|
testBuildWithWrongBrowserType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/BrowserFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/BrowserFactoryTest.php
|
MIT
|
public function testBuildWithUnsupportedBrowserType(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Value "validator" is not an element of the valid values: application, bot, bot-syndication-reader, bot-trancoder, browser, email-client, feed-reader, library, multimedia-player, offline-browser, tool, transcoder, useragent-anonymizer, unknown');
$browserData = ['properties' => ['Browser' => 'xyz'], 'standard' => true, 'lite' => false, 'type' => 'validator'];
$browserName = 'Test';
$this->object->build($browserData, $browserName);
}
|
@throws AssertionFailedException
@throws RuntimeException
@throws InvalidArgumentException
|
testBuildWithUnsupportedBrowserType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/BrowserFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/BrowserFactoryTest.php
|
MIT
|
public function testCreateDataCollectionThrowsExceptionOnInvalidDirectory(): void
{
$collection = $this->getMockBuilder(DataCollection::class)
->disableOriginalConstructor()
->getMock();
$property = new ReflectionProperty($this->object, 'collection');
$property->setValue($this->object, $collection);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Directory "./platforms" does not exist.');
$this->object->createDataCollection('.');
}
|
tests throwing an exception while creating a data collaction when a dir is invalid
@throws AssertionFailedException
@throws ReflectionException
@throws RuntimeException
@throws LogicException
|
testCreateDataCollectionThrowsExceptionOnInvalidDirectory
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
MIT
|
public function testCreateDataCollection(): void
{
$collection = $this->getMockBuilder(DataCollection::class)
->disableOriginalConstructor()
->onlyMethods(['addPlatform', 'addDivision', 'addEngine', 'addDevice', 'addBrowser'])
->getMock();
$collection->expects(static::exactly(2))
->method('addPlatform')
->willReturnSelf();
$collection->expects(static::exactly(2))
->method('addEngine')
->willReturnSelf();
$collection->expects(static::once())
->method('addDevice')
->willReturnSelf();
$collection->expects(static::exactly(3))
->method('addBrowser')
->willReturnSelf();
$collection->expects(static::once())
->method('addDivision')
->willReturnSelf();
$property = new ReflectionProperty($this->object, 'collection');
$property->setValue($this->object, $collection);
$result = $this->object->createDataCollection(__DIR__ . '/../../../fixtures/build-ok');
static::assertInstanceOf(DataCollection::class, $result);
static::assertSame($collection, $result);
}
|
tests creating a data collection
@throws AssertionFailedException
@throws ReflectionException
@throws RuntimeException
@throws LogicException
|
testCreateDataCollection
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
MIT
|
public function testCreateDataCollectionFailsForDuplicateDeviceEntries(): void
{
$this->expectException(DuplicateDataException::class);
$this->expectExceptionMessage('it was tried to add device "unknown", but this was already added before');
$this->object->createDataCollection(
__DIR__ . '/../../../fixtures/duplicate-device-entries',
);
}
|
tests creating a data collection
@throws AssertionFailedException
@throws DuplicateDataException
@throws RuntimeException
@throws LogicException
|
testCreateDataCollectionFailsForDuplicateDeviceEntries
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
MIT
|
public function testCreateDataCollectionFailsForDuplicateBrowserEntries(): void
{
$this->expectException(DuplicateDataException::class);
$this->expectExceptionMessage('it was tried to add browser "chrome", but this was already added before');
$this->object->createDataCollection(
__DIR__ . '/../../../fixtures/duplicate-browser-entries',
);
}
|
tests creating a data collection
@throws AssertionFailedException
@throws DuplicateDataException
@throws RuntimeException
@throws LogicException
|
testCreateDataCollectionFailsForDuplicateBrowserEntries
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
MIT
|
public function testCreateDataCollectionFailsBecauseOfMissingFiles(): void
{
$path = __DIR__ . '/../../../fixtures/missing-file';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(sprintf('File "%s/core/default-browser.json" does not exist.', $path));
$this->object->createDataCollection($path);
}
|
tests creating a data collection
@throws AssertionFailedException
@throws \InvalidArgumentException
@throws RuntimeException
@throws LogicException
|
testCreateDataCollectionFailsBecauseOfMissingFiles
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
MIT
|
public function testCreateDataCollectionFailsBecauseOfInvalidChars(): void
{
$path = __DIR__ . '/../../../fixtures/non-ascii-chars';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(sprintf('File "%s/core/default-browser.json" contains Non-ASCII-Characters.', $path));
$this->object->createDataCollection($path);
}
|
tests creating a data collection
@throws AssertionFailedException
@throws \InvalidArgumentException
@throws RuntimeException
@throws LogicException
|
testCreateDataCollectionFailsBecauseOfInvalidChars
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
MIT
|
public function testCreateDataCollectionFailsBecauseOfInvalidJson(): void
{
$path = __DIR__ . '/../../../fixtures/invalid-json';
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage(sprintf('File "%s/core/default-browser.json" had invalid JSON.', $path));
$this->object->createDataCollection($path);
}
|
tests creating a data collection
@throws AssertionFailedException
@throws RuntimeException
@throws LogicException
|
testCreateDataCollectionFailsBecauseOfInvalidJson
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
MIT
|
public function testCreateDataCollectionFailsBecauseOfEmptyDirectory(): void
{
$path = __DIR__ . '/../../../fixtures/empty-directory';
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage(sprintf('Directory "%s/browsers" was empty.', $path));
$this->object->createDataCollection($path);
}
|
tests creating a data collection
@throws AssertionFailedException
@throws RuntimeException
@throws LogicException
|
testCreateDataCollectionFailsBecauseOfEmptyDirectory
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DataCollectionFactoryTest.php
|
MIT
|
public function testBuildWithoutStandardProperty(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the value for "standard" key is missing for device "Test"');
$deviceData = ['abc' => 'def'];
$deviceName = 'Test';
$this->object->build($deviceData, $deviceName);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws RuntimeException
|
testBuildWithoutStandardProperty
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DeviceFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DeviceFactoryTest.php
|
MIT
|
public function testBuildWithWrongDeviceType(): void
{
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('unsupported device type given for device "Test"');
$deviceData = ['properties' => ['abc' => 'xyz'], 'standard' => true, 'type' => 'does not exist'];
$deviceName = 'Test';
$this->object->build($deviceData, $deviceName);
}
|
@throws AssertionFailedException
@throws UnexpectedValueException
@throws RuntimeException
|
testBuildWithWrongDeviceType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DeviceFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DeviceFactoryTest.php
|
MIT
|
public function testBuildWithUnsupportedDeviceType(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Value "phablet" is not an element of the valid values: car-entertainment-system, console, desktop, digital-camera, ebook-reader, feature-phone, fone-pad, mobile-console, mobile-device, mobile-phone, smartphone, tablet, tv, tv-console, unknown');
$deviceData = ['properties' => ['abc' => 'xyz'], 'standard' => true, 'type' => 'phablet'];
$deviceName = 'Test';
$this->object->build($deviceData, $deviceName);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws RuntimeException
|
testBuildWithUnsupportedDeviceType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DeviceFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DeviceFactoryTest.php
|
MIT
|
protected function setUp(): void
{
$useragentFactory = $this->createMock(UserAgentFactory::class);
$useragentFactory
->expects(static::once())
->method('build')
->willReturn([]);
assert($useragentFactory instanceof UserAgentFactory);
$this->object = new DivisionFactory($useragentFactory);
}
|
@throws MethodNameAlreadyConfiguredException
@throws MethodCannotBeConfiguredException
@throws IncompatibleReturnValueException
@throws InvalidArgumentException
|
setUp
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/DivisionFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/DivisionFactoryTest.php
|
MIT
|
public function testBuildWithMissingInheritAndProperties(): void
{
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('required attibute "properties" is missing');
$engineData = ['abc' => 'def'];
$json = [];
$engineName = 'Test';
$this->object->build($engineData, $json, $engineName);
}
|
@throws AssertionFailedException
@throws RuntimeException
@throws UnexpectedValueException
|
testBuildWithMissingInheritAndProperties
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/EngineFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/EngineFactoryTest.php
|
MIT
|
public function testBuildWithMissingParent(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('parent Engine "abc" is missing for engine "Test"');
$engineData = ['abc' => 'def', 'inherits' => 'abc'];
$json = [];
$engineName = 'Test';
$this->object->build($engineData, $json, $engineName);
}
|
@throws AssertionFailedException
@throws RuntimeException
@throws InvalidArgumentException
|
testBuildWithMissingParent
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/EngineFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/EngineFactoryTest.php
|
MIT
|
public function testBuildWithRepeatingProperties(): void
{
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('the value for property "abc" has the same value in the keys "Test" and its parent "abc"');
$engineData = ['properties' => ['abc' => 'def'], 'inherits' => 'abc'];
$json = [
'abc' => [
'properties' => ['abc' => 'def'],
],
];
$engineName = 'Test';
$this->object->build($engineData, $json, $engineName);
}
|
@throws AssertionFailedException
@throws RuntimeException
@throws UnexpectedValueException
|
testBuildWithRepeatingProperties
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/EngineFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/EngineFactoryTest.php
|
MIT
|
public function testBuildMissingLiteProperty(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the value for "lite" key is missing for the platform with the key "Test"');
$platformData = ['abc' => 'def'];
$json = [];
$platformName = 'Test';
$this->object->build($platformData, $json, $platformName);
}
|
tests that the missing "lite" property is leading to an error
@throws AssertionFailedException
@throws RuntimeException
@throws InvalidArgumentException
|
testBuildMissingLiteProperty
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
MIT
|
public function testBuildMissingStandardProperty(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the value for "standard" key is missing for the platform with the key "Test"');
$platformData = ['abc' => 'def', 'lite' => false];
$json = [];
$platformName = 'Test';
$this->object->build($platformData, $json, $platformName);
}
|
tests that the missing "standard" property is leading to an error
@throws AssertionFailedException
@throws RuntimeException
@throws InvalidArgumentException
|
testBuildMissingStandardProperty
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
MIT
|
public function testBuildWithoutMatchProperty(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the value for the "match" key is missing for the platform with the key "Test"');
$platformData = ['properties' => ['abc' => 'def'], 'lite' => false, 'standard' => false, 'inherits' => 'abc'];
$json = [
'abc' => [
'properties' => ['abc' => 'def'],
'standard' => false,
'lite' => false,
],
];
$platformName = 'Test';
$this->object->build($platformData, $json, $platformName);
}
|
tests that the missing "match" property is leading to an error
@throws AssertionFailedException
@throws RuntimeException
@throws InvalidArgumentException
|
testBuildWithoutMatchProperty
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
MIT
|
public function testBuildWithMissingInheritAndProperties(): void
{
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('required attibute "properties" is missing');
$platformData = ['abc' => 'def', 'match' => 'test*', 'lite' => false, 'standard' => false];
$json = [];
$platformName = 'Test';
$this->object->build($platformData, $json, $platformName);
}
|
tests that the missing "inherits" property and missing "properties" property is leading to an error
@throws AssertionFailedException
@throws RuntimeException
@throws UnexpectedValueException
|
testBuildWithMissingInheritAndProperties
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
MIT
|
public function testBuildMissingParentPlatform(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('parent Platform "abc" is missing for platform "Test"');
$platformData = ['abc' => 'def', 'match' => 'test*', 'lite' => false, 'standard' => false, 'inherits' => 'abc'];
$json = [];
$platformName = 'Test';
$this->object->build($platformData, $json, $platformName);
}
|
tests that a missing parent platform is leading to an error
@throws AssertionFailedException
@throws RuntimeException
@throws InvalidArgumentException
|
testBuildMissingParentPlatform
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
MIT
|
public function testBuildWithRepeatingProperties(): void
{
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('the value for property "abc" has the same value in the keys "Test" and its parent "abc"');
$platformData = ['properties' => ['abc' => 'def'], 'match' => 'test*', 'lite' => false, 'standard' => false, 'inherits' => 'abc'];
$json = [
'abc' => [
'match' => 'test*',
'properties' => ['abc' => 'def'],
'standard' => false,
'lite' => false,
],
];
$platformName = 'Test';
$this->object->build($platformData, $json, $platformName);
}
|
@throws AssertionFailedException
@throws RuntimeException
@throws UnexpectedValueException
|
testBuildWithRepeatingProperties
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Factory/PlatformFactoryTest.php
|
MIT
|
public function testPatternIdCollectionOnNotEmptyDatacollectionWithChildrenPlatformsAndDevices(): void
{
static::assertSame('Android Browser 3.0', $this->object->replace('Android Browser #MAJORVER#.#MINORVER#', '3', '0'));
}
|
tests pattern id generation on a not empty data collection with children, platforms and devices
|
testPatternIdCollectionOnNotEmptyDatacollectionWithChildrenPlatformsAndDevices
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Helper/VersionNumberTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Helper/VersionNumberTest.php
|
MIT
|
public function testDivisionPropertyIsNotAvailable(): void
{
$divisionData = [];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "division" is missing in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testDivisionPropertyIsNotAvailable
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testDivisionPropertyIsNotString(): void
{
$divisionData = [
'division' => [],
];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "division" has to be a string in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testDivisionPropertyIsNotString
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testSortIndexPropertyIsNotAvailable(): void
{
$divisionData = ['division' => 'abc'];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "sortIndex" is missing in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testSortIndexPropertyIsNotAvailable
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testSortIndexPropertyIsNotInteger(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => false,
];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "sortIndex" has to be a integer in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testSortIndexPropertyIsNotInteger
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testSortIndexPropertyIsZero(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => -1,
];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "sortIndex" has to be a positive integer in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testSortIndexPropertyIsZero
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testLitePropertyIsNotAvailable(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "lite" is missing in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testLitePropertyIsNotAvailable
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testLitePropertyIsNotBoolean(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => 'false',
];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "lite" has to be an boolean in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testLitePropertyIsNotBoolean
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testStandardPropertyIsNotAvailable(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "standard" is missing in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testStandardPropertyIsNotAvailable
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testStandardPropertyIsNotBoolean(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => 'true',
];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "standard" has to be an boolean in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testStandardPropertyIsNotBoolean
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testUserAgentsPropertyIsNotAvailable(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "userAgents" is missing in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testUserAgentsPropertyIsNotAvailable
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testUserAgentsPropertyIsNotAnArray(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'userAgents' => [],
];
$fileName = 'abc.json';
$allDivisions = [];
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "userAgents" should be an non-empty array in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testUserAgentsPropertyIsNotAnArray
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testUserAgentPropertyIsNotAvailable(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'userAgents' => [[]],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "userAgent" is missing in userAgents section 0 in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testUserAgentPropertyIsNotAvailable
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testUserAgentPropertyIsNotString(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'userAgents' => [['userAgent' => []]],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "userAgent" has to be a string in userAgents section 0 in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testUserAgentPropertyIsNotString
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testPropertiesPropertyIsNotAvailable(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => [],
'userAgents' => [['userAgent' => 'abc']],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "properties" is missing in userAgents section 0 in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testPropertiesPropertyIsNotAvailable
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testPropertiesPropertyIsNotArray(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => [],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => 'bcd',
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "properties" should be an array in userAgents section 0 in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testPropertiesPropertyIsNotArray
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testParentPropertyIsMissingInProperties(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => [],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['abc'],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the "Parent" property is missing for key "abc" in file "abc.json"');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testParentPropertyIsMissingInProperties
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testWrongParentProperty(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => [],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'abc'],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the "Parent" property is not linked to the "DefaultProperties" for key "abc" in file "abc.json"');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testWrongParentProperty
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testCommentPropertyIsMissingInProperties(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => [],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'DefaultProperties'],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the "Comment" property is missing for key "abc" in file "abc.json"');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testCommentPropertyIsMissingInProperties
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testCommentPropertyIsNotString(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => [],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => []],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the "Comment" property has to be a string for key "abc" in file "abc.json"');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testCommentPropertyIsNotString
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testVersionPropertyIsNotString(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => ['0.0'],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => []],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the "Version" property has to be a string for key "abc" in file "abc.json"');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testVersionPropertyIsNotString
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testChildrenPropertyIsMissingInProperties(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => ['1'],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => '1.0'],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "children" is missing in userAgents section 0 in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testChildrenPropertyIsMissingInProperties
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testChildrenPropertyIsNotAnArray(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => ['1'],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => '1.0'],
'children' => 'xyz',
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('required attibute "children" should be an array in userAgents section 0 in File abc.json');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testChildrenPropertyIsNotAnArray
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testChildrenPropertyHasDirectMatch(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => ['1'],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => '1.0'],
'children' => ['match' => '123'],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the children property shall not have the "match" entry for key "abc" in file "abc.json"');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testChildrenPropertyHasDirectMatch
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testDevicesPropertyIsNotAnArray(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => ['1'],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => '1.0'],
'children' => [
['devices' => 'def'],
],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the "devices" entry for key "abc" has to be an array');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testDevicesPropertyIsNotAnArray
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testDevicePropertyIsNotString(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => ['1'],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => '1.0'],
'children' => [
[
'device' => [],
],
],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the "device" entry has to be a string for key "abc"');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testDevicePropertyIsNotString
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testMatchPropertyIsNotAvailable(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => ['1'],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => '1.0'],
'children' => [
['device' => 'abc'],
],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('each entry of the children property requires an "match" entry for key "abc"');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testMatchPropertyIsNotAvailable
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testMatchPropertyIsNotString(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => ['1'],
'userAgents' => [
[
'userAgent' => 'abc',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => '1.0'],
'children' => [
[
'device' => 'abc',
'match' => [],
],
],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the "match" entry for key "abc" has to be a string');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testMatchPropertyIsNotString
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testPlatformsPropertyIsNotAnArray(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => ['1'],
'userAgents' => [
[
'userAgent' => 'abc2',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => '1.0'],
'children' => [
[
'device' => 'abc',
'match' => 'abc',
'platforms' => 'abc',
],
],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the "platforms" entry for key "abc2" has to be an array');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testPlatformsPropertyIsNotAnArray
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testPropertiesPropertyIsNotAnArray(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => [],
'userAgents' => [
[
'userAgent' => 'abc#MAJORVER#',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => '#MAJORVER#'],
'children' => [
[
'device' => 'abc',
'match' => 'abc',
'properties' => 'test',
],
],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the "properties" entry for key "abc" has to be an array');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testPropertiesPropertyIsNotAnArray
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testPropertiesPropertyHasParent(): void
{
$divisionData = [
'division' => 'abc',
'sortIndex' => 1,
'lite' => false,
'standard' => true,
'versions' => [],
'userAgents' => [
[
'userAgent' => 'abc#MAJORVER#',
'properties' => ['Parent' => 'DefaultProperties', 'Comment' => 'test', 'Version' => '#MAJORVER#'],
'children' => [
[
'device' => 'abc',
'match' => 'abc',
'properties' => ['Parent' => 'test'],
],
],
],
],
];
$allDivisions = [];
$fileName = 'abc.json';
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('the Parent property must not set inside the children array for key "abc"');
$this->object->validate($divisionData, $fileName, $allDivisions, false);
}
|
@throws AssertionFailedException
@throws InvalidArgumentException
@throws LogicException
|
testPropertiesPropertyHasParent
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/DivisionDataValidatorTest.php
|
MIT
|
public function testCheckPropertyOk(): void
{
$properties = [
'Parent' => 'default',
'Comment' => 'Default Browser',
'Browser' => 'Default Browser',
'Browser_Type' => 'unknown',
'Browser_Bits' => 0,
'Browser_Maker' => 'unknown',
'Browser_Modus' => 'unknown',
'Version' => '0.0',
'MajorVer' => '0',
'MinorVer' => '0',
'Platform' => 'unknown',
'Platform_Version' => 'unknown',
'Platform_Description' => 'unknown',
'Platform_Bits' => 0,
'Platform_Maker' => 'unknown',
'Alpha' => false,
'Beta' => false,
'Win16' => false,
'Win32' => false,
'Win64' => false,
'Frames' => false,
'IFrames' => false,
'Tables' => false,
'Cookies' => false,
'BackgroundSounds' => false,
'JavaScript' => false,
'VBScript' => false,
'JavaApplets' => false,
'ActiveXControls' => false,
'isMobileDevice' => false,
'isTablet' => false,
'isSyndicationReader' => false,
'Crawler' => false,
'isFake' => false,
'isAnonymized' => false,
'isModified' => false,
'CssVersion' => 0,
'AolVersion' => 0,
'Device_Name' => 'unknown',
'Device_Maker' => 'unknown',
'Device_Type' => 'unknown',
'Device_Pointing_Method' => 'unknown',
'Device_Code_Name' => 'unknown',
'Device_Brand_Name' => 'unknown',
'RenderingEngine_Name' => 'unknown',
'RenderingEngine_Version' => 'unknown',
'RenderingEngine_Description' => 'unknown',
'RenderingEngine_Maker' => 'unknown',
'PatternId' => 'resources/core/default-browser.json::u0',
];
$this->object->validate($properties, 'test');
static::assertTrue(true);
}
|
tests if no error is raised if all went well
@throws ExpectationFailedException
@throws LogicException
@throws AssertionFailedException
|
testCheckPropertyOk
|
php
|
browscap/browscap
|
tests/BrowscapTest/Data/Validator/PropertiesValidatorTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Data/Validator/PropertiesValidatorTest.php
|
MIT
|
public function testGetType(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new CustomFilter($propertyHolder, ['Parent']);
static::assertSame(FilterInterface::TYPE_CUSTOM, $object->getType());
}
|
tests getter for the filter type
@throws ExpectationFailedException
|
testGetType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/CustomFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/CustomFilterTest.php
|
MIT
|
public function testIsOutput(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new CustomFilter($propertyHolder, ['Parent']);
$division = $this->createMock(Division::class);
static::assertTrue($object->isOutput($division));
}
|
tests detecting if a divion should be in the output
@throws ExpectationFailedException
|
testIsOutput
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/CustomFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/CustomFilterTest.php
|
MIT
|
public static function outputPropertiesDataProvider(): array
{
return [
['Comment', false],
['Browser', false],
['Platform', false],
['Platform_Description', false],
['Device_Name', false],
['Device_Maker', false],
['RenderingEngine_Name', false],
['RenderingEngine_Description', false],
['Parent', true],
['Platform_Version', false],
['RenderingEngine_Version', false],
['Version', false],
['MajorVer', false],
['MinorVer', false],
['CssVersion', false],
['AolVersion', false],
['Alpha', false],
['Beta', false],
['Win16', false],
['Win32', false],
['Win64', false],
['Frames', false],
['IFrames', false],
['Tables', false],
['Cookies', false],
['BackgroundSounds', false],
['JavaScript', false],
['VBScript', false],
['JavaApplets', false],
['ActiveXControls', false],
['isMobileDevice', false],
['isSyndicationReader', false],
['Crawler', false],
['lite', false],
['sortIndex', false],
['Parents', false],
['division', false],
['Browser_Type', false],
['Device_Type', false],
['Device_Pointing_Method', false],
['isTablet', false],
['Browser_Maker', false],
];
}
|
Data Provider for the test testIsOutputProperty
@return array<int, array<int, bool|string>>
@throws void
|
outputPropertiesDataProvider
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/CustomFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/CustomFilterTest.php
|
MIT
|
public function testIsOutputSectionAlways(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new CustomFilter($propertyHolder, ['Parent']);
static::assertTrue($object->isOutputSection([]));
static::assertTrue($object->isOutputSection(['lite' => false]));
static::assertTrue($object->isOutputSection(['lite' => true]));
}
|
tests if a section is always in the output
@throws ExpectationFailedException
|
testIsOutputSectionAlways
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/CustomFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/CustomFilterTest.php
|
MIT
|
public function testGetType(int $noOfFilters): void
{
for ($i = 0; $i < $noOfFilters; $i++) {
$mockFilter = $this->createMock(FilterInterface::class);
$mockFilter
->expects(static::never())
->method('getType');
$mockFilter
->expects(static::never())
->method('isOutput');
$mockFilter
->expects(static::never())
->method('isOutputSection');
$mockFilter
->expects(static::never())
->method('isOutputProperty');
$this->object->addFilter($mockFilter);
}
static::assertSame(FilterInterface::TYPE_COLLECTION, $this->object->getType());
}
|
tests getter for the filter type with filters of a different types, and without filters
@dataProvider dataProviderForTestGetType
|
testGetType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FilterCollectionTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FilterCollectionTest.php
|
MIT
|
public static function dataProviderForTestGetType(): array
{
$funcArgs = [];
foreach (range(0, 10) as $noOfFilters) {
$funcArgs[] = [$noOfFilters];
}
return $funcArgs;
}
|
Data Provider for testGetType
@return array<array<int>>
|
dataProviderForTestGetType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FilterCollectionTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FilterCollectionTest.php
|
MIT
|
public function testAddFilterAndIsOutput(): void
{
$division = $this->createMock(Division::class);
$mockFilter = $this->createMock(FilterInterface::class);
$mockFilter
->expects(static::once())
->method('isOutput')
->with($division)
->willReturn(true);
$this->object->addFilter($mockFilter);
self::assertTrue($this->object->isOutput($division));
}
|
tests setting and getting a writer
@throws MethodNameAlreadyConfiguredException
@throws MethodCannotBeConfiguredException
|
testAddFilterAndIsOutput
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FilterCollectionTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FilterCollectionTest.php
|
MIT
|
public function testAddFilterAndIsOutput2(): void
{
$division = $this->createMock(Division::class);
$mockFilter1 = $this->createMock(FilterInterface::class);
$mockFilter1
->expects(static::once())
->method('isOutput')
->with($division)
->willReturn(true);
$mockFilter2 = $this->createMock(FilterInterface::class);
$mockFilter2
->expects(static::once())
->method('isOutput')
->with($division)
->willReturn(false);
$mockFilter3 = $this->createMock(FilterInterface::class);
$mockFilter3
->expects(static::never())
->method('isOutput');
$this->object->addFilter($mockFilter1);
$this->object->addFilter($mockFilter2);
$this->object->addFilter($mockFilter3);
self::assertFalse($this->object->isOutput($division));
}
|
tests setting and getting a writer
@throws MethodNameAlreadyConfiguredException
@throws MethodCannotBeConfiguredException
|
testAddFilterAndIsOutput2
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FilterCollectionTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FilterCollectionTest.php
|
MIT
|
public function testAddFilterAndIsOutputSection(): void
{
$section = [];
$mockFilter = $this->createMock(FilterInterface::class);
$mockFilter
->expects(static::once())
->method('isOutputSection')
->with($section)
->willReturn(true);
$this->object->addFilter($mockFilter);
self::assertTrue($this->object->isOutputSection($section));
}
|
tests setting and getting a writer
@throws MethodNameAlreadyConfiguredException
@throws MethodCannotBeConfiguredException
|
testAddFilterAndIsOutputSection
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FilterCollectionTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FilterCollectionTest.php
|
MIT
|
public function testAddFilterAndIsOutputSection2(): void
{
$section = [];
$mockFilter1 = $this->createMock(FilterInterface::class);
$mockFilter1
->expects(static::once())
->method('isOutputSection')
->with($section)
->willReturn(true);
$mockFilter2 = $this->createMock(FilterInterface::class);
$mockFilter2
->expects(static::once())
->method('isOutputSection')
->with($section)
->willReturn(false);
$mockFilter3 = $this->createMock(FilterInterface::class);
$mockFilter3
->expects(static::never())
->method('isOutputSection');
$this->object->addFilter($mockFilter1);
$this->object->addFilter($mockFilter2);
$this->object->addFilter($mockFilter3);
self::assertFalse($this->object->isOutputSection($section));
}
|
tests setting and getting a writer
@throws MethodNameAlreadyConfiguredException
@throws MethodCannotBeConfiguredException
|
testAddFilterAndIsOutputSection2
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FilterCollectionTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FilterCollectionTest.php
|
MIT
|
public function testAddFilterAndIsOutputProperty(): void
{
$mockWriter = $this->createMock(WriterInterface::class);
$property = 'test';
$mockFilter = $this->createMock(FilterInterface::class);
$mockFilter
->expects(static::once())
->method('isOutputProperty')
->with($property, $mockWriter)
->willReturn(true);
$this->object->addFilter($mockFilter);
self::assertTrue($this->object->isOutputProperty($property, $mockWriter));
}
|
tests setting and getting a writer
@throws MethodNameAlreadyConfiguredException
@throws MethodCannotBeConfiguredException
|
testAddFilterAndIsOutputProperty
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FilterCollectionTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FilterCollectionTest.php
|
MIT
|
public function testAddFilterAndIsOutputProperty2(): void
{
$mockWriter = $this->createMock(WriterInterface::class);
$property = 'test';
$mockFilter1 = $this->createMock(FilterInterface::class);
$mockFilter1
->expects(static::once())
->method('isOutputProperty')
->with($property, $mockWriter)
->willReturn(true);
$mockFilter2 = $this->createMock(FilterInterface::class);
$mockFilter2
->expects(static::once())
->method('isOutputProperty')
->with($property, $mockWriter)
->willReturn(false);
$mockFilter3 = $this->createMock(FilterInterface::class);
$mockFilter3
->expects(static::never())
->method('isOutputProperty');
$this->object->addFilter($mockFilter1);
$this->object->addFilter($mockFilter2);
$this->object->addFilter($mockFilter3);
self::assertFalse($this->object->isOutputProperty($property, $mockWriter));
}
|
tests setting and getting a writer
@throws MethodNameAlreadyConfiguredException
@throws MethodCannotBeConfiguredException
|
testAddFilterAndIsOutputProperty2
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FilterCollectionTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FilterCollectionTest.php
|
MIT
|
public function testGetType(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new FullFilter($propertyHolder);
static::assertSame(FilterInterface::TYPE_FULL, $object->getType());
}
|
tests getter for the filter type
@throws ExpectationFailedException
|
testGetType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FullFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FullFilterTest.php
|
MIT
|
public function testIsOutput(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new FullFilter($propertyHolder);
$division = $this->createMock(Division::class);
static::assertTrue($object->isOutput($division));
}
|
tests detecting if a divion should be in the output
@throws ExpectationFailedException
|
testIsOutput
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FullFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FullFilterTest.php
|
MIT
|
public function testIsOutputSectionAlways(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new FullFilter($propertyHolder);
static::assertTrue($object->isOutputSection([]));
static::assertTrue($object->isOutputSection(['full' => false]));
static::assertTrue($object->isOutputSection(['full' => true]));
}
|
tests if a section is always in the output
@throws ExpectationFailedException
|
testIsOutputSectionAlways
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/FullFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/FullFilterTest.php
|
MIT
|
public function testGetType(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new LiteFilter($propertyHolder);
static::assertSame(FilterInterface::TYPE_LITE, $object->getType());
}
|
tests getter for the filter type
@throws ExpectationFailedException
|
testGetType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/LiteFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/LiteFilterTest.php
|
MIT
|
public function testIsOutput(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new LiteFilter($propertyHolder);
$division = $this->getMockBuilder(Division::class)
->disableOriginalConstructor()
->onlyMethods(['isLite'])
->getMock();
$division
->expects(static::once())
->method('isLite')
->willReturn(false);
static::assertFalse($object->isOutput($division));
}
|
tests detecting if a divion should be in the output
@throws ExpectationFailedException
|
testIsOutput
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/LiteFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/LiteFilterTest.php
|
MIT
|
public static function outputPropertiesDataProvider(): array
{
return [
['Comment', true],
['Browser', true],
['Platform', true],
['Platform_Description', false],
['Device_Name', false],
['Device_Maker', false],
['RenderingEngine_Name', false],
['RenderingEngine_Description', false],
['Parent', true],
['Platform_Version', false],
['RenderingEngine_Version', false],
['Version', true],
['MajorVer', false],
['MinorVer', false],
['CssVersion', false],
['AolVersion', false],
['Alpha', false],
['Beta', false],
['Win16', false],
['Win32', false],
['Win64', false],
['Frames', false],
['IFrames', false],
['Tables', false],
['Cookies', false],
['BackgroundSounds', false],
['JavaScript', false],
['VBScript', false],
['JavaApplets', false],
['ActiveXControls', false],
['isMobileDevice', true],
['isSyndicationReader', false],
['Crawler', false],
['lite', false],
['sortIndex', false],
['Parents', false],
['division', false],
['Browser_Type', false],
['Device_Type', true],
['Device_Pointing_Method', false],
['isTablet', true],
['Browser_Maker', false],
];
}
|
Data Provider for the test testIsOutputProperty
@return array<int, array<int, bool|string>>
@throws void
|
outputPropertiesDataProvider
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/LiteFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/LiteFilterTest.php
|
MIT
|
public function testIsOutputSectionOnlyWhenLite(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty')
->willReturn(true);
$object = new LiteFilter($propertyHolder);
static::assertFalse($object->isOutputSection([]));
static::assertFalse($object->isOutputSection(['lite' => false]));
static::assertTrue($object->isOutputSection(['lite' => true]));
}
|
tests if a section is always in the output, if the lite flag is true
@throws ExpectationFailedException
|
testIsOutputSectionOnlyWhenLite
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/LiteFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/LiteFilterTest.php
|
MIT
|
public function testGetType(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new StandardFilter($propertyHolder);
static::assertSame(FilterInterface::TYPE_STANDARD, $object->getType());
}
|
tests getter for the filter type
@throws ExpectationFailedException
|
testGetType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/StandardFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/StandardFilterTest.php
|
MIT
|
public function testIsOutputTrue(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new StandardFilter($propertyHolder);
$division = $this->getMockBuilder(Division::class)
->disableOriginalConstructor()
->onlyMethods(['isStandard'])
->getMock();
$division
->expects(static::once())
->method('isStandard')
->willReturn(true);
static::assertTrue($object->isOutput($division));
}
|
tests detecting if a divion should be in the output
@throws ExpectationFailedException
|
testIsOutputTrue
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/StandardFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/StandardFilterTest.php
|
MIT
|
public function testIsOutputFalse(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new StandardFilter($propertyHolder);
$division = $this->getMockBuilder(Division::class)
->disableOriginalConstructor()
->onlyMethods(['isStandard'])
->getMock();
$division
->expects(static::once())
->method('isStandard')
->willReturn(false);
static::assertFalse($object->isOutput($division));
}
|
tests detecting if a divion should be in the output
@throws ExpectationFailedException
|
testIsOutputFalse
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/StandardFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/StandardFilterTest.php
|
MIT
|
public static function outputPropertiesDataProvider(): array
{
return [
['Comment', true],
['Browser', true],
['Platform', true],
['Platform_Description', false],
['Device_Name', false],
['Device_Maker', false],
['RenderingEngine_Name', false],
['RenderingEngine_Description', false],
['Parent', true],
['Platform_Version', false],
['RenderingEngine_Version', false],
['Version', true],
['MajorVer', true],
['MinorVer', true],
['CssVersion', false],
['AolVersion', false],
['Alpha', false],
['Beta', false],
['Win16', false],
['Win32', false],
['Win64', false],
['Frames', false],
['IFrames', false],
['Tables', false],
['Cookies', false],
['BackgroundSounds', false],
['JavaScript', false],
['VBScript', false],
['JavaApplets', false],
['ActiveXControls', false],
['isMobileDevice', true],
['isSyndicationReader', false],
['Crawler', false],
['lite', false],
['sortIndex', false],
['Parents', false],
['division', false],
['Browser_Type', false],
['Device_Type', false],
['Device_Pointing_Method', false],
['isTablet', false],
['Browser_Maker', false],
];
}
|
Data Provider for the test testIsOutputProperty
@return array<int, array<int, bool|string>>
@throws void
|
outputPropertiesDataProvider
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/StandardFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/StandardFilterTest.php
|
MIT
|
public function testIsOutputSectionAlways(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$object = new StandardFilter($propertyHolder);
static::assertTrue($object->isOutputSection([]));
static::assertFalse($object->isOutputSection(['standard' => false]));
static::assertTrue($object->isOutputSection(['standard' => true]));
}
|
tests if a section is always in the output
@throws ExpectationFailedException
|
testIsOutputSectionAlways
|
php
|
browscap/browscap
|
tests/BrowscapTest/Filter/StandardFilterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Filter/StandardFilterTest.php
|
MIT
|
protected function setUp(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$this->object = new AspFormatter($propertyHolder);
}
|
@throws MethodNameAlreadyConfiguredException
@throws MethodCannotBeConfiguredException
@throws InvalidArgumentException
@throws CannotUseOnlyMethodsException
|
setUp
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/AspFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/AspFormatterTest.php
|
MIT
|
public function testGetType(): void
{
static::assertSame(FormatterInterface::TYPE_ASP, $this->object->getType());
}
|
tests getter for the formatter type
@throws ExpectationFailedException
|
testGetType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/AspFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/AspFormatterTest.php
|
MIT
|
public function testFormatPropertyName(): void
{
static::assertSame('text', $this->object->formatPropertyName('text'));
}
|
tests formatting a property name
@throws ExpectationFailedException
|
testFormatPropertyName
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/AspFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/AspFormatterTest.php
|
MIT
|
public static function propertyNameTypeDataProvider(): array
{
return [
['Comment', 'test', 'test'],
['Browser', 'test', 'test'],
['Platform', 'test', 'test'],
['Platform_Description', 'test', 'test'],
['Device_Name', 'test', 'test'],
['Device_Maker', 'test', 'test'],
['RenderingEngine_Name', 'test', 'test'],
['RenderingEngine_Description', 'test', 'test'],
['Parent', 'test', 'test'],
['Platform_Version', 'test', 'test'],
['RenderingEngine_Version', 'test', 'test'],
['Version', 'test', 'test'],
['MajorVer', 'test', 'test'],
['MinorVer', 'test', 'test'],
['CssVersion', 'test', 'test'],
['AolVersion', 'test', 'test'],
['Alpha', 'true', 'true'],
['Beta', 'false', 'false'],
['Win16', 'test', ''],
['Browser_Type', 'Browser', 'Browser'],
['Device_Type', 'Tablet', 'Tablet'],
['Device_Pointing_Method', 'mouse', 'mouse'],
];
}
|
Data Provider for the test testGetPropertyType
@return array<array<string>>
@throws void
|
propertyNameTypeDataProvider
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/AspFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/AspFormatterTest.php
|
MIT
|
public function testFormatPropertyValue(string $propertyName, string $inputValue, string $expectedValue): void
{
$actualValue = $this->object->formatPropertyValue($inputValue, $propertyName);
static::assertSame($expectedValue, $actualValue, sprintf('Property %s should be %s (was %s)', $propertyName, $expectedValue, $actualValue));
}
|
tests formatting a property value
@throws Exception
@dataProvider propertyNameTypeDataProvider
|
testFormatPropertyValue
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/AspFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/AspFormatterTest.php
|
MIT
|
public function testFormatPropertyValueWithException(): void
{
$actualValue = $this->object->formatPropertyValue('Browserx', 'Device_Pointing_Method');
static::assertSame('', $actualValue);
}
|
tests formatting a property value
@throws Exception
|
testFormatPropertyValueWithException
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/AspFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/AspFormatterTest.php
|
MIT
|
public function testFormatPropertyValueWithUnknownValue(): void
{
$actualValue = $this->object->formatPropertyValue('unknown', 'Browser_Type');
static::assertSame('unknown', $actualValue);
}
|
tests formatting a property value
@throws Exception
|
testFormatPropertyValueWithUnknownValue
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/AspFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/AspFormatterTest.php
|
MIT
|
protected function setUp(): void
{
$propertyHolder = $this->getMockBuilder(PropertyHolder::class)
->disableOriginalConstructor()
->onlyMethods(['isOutputProperty'])
->getMock();
$propertyHolder
->expects(static::never())
->method('isOutputProperty');
$this->object = new CsvFormatter($propertyHolder);
}
|
@throws MethodNameAlreadyConfiguredException
@throws MethodCannotBeConfiguredException
@throws InvalidArgumentException
@throws CannotUseOnlyMethodsException
|
setUp
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/CsvFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/CsvFormatterTest.php
|
MIT
|
public function testGetType(): void
{
static::assertSame(FormatterInterface::TYPE_CSV, $this->object->getType());
}
|
tests getter for the formatter type
@throws ExpectationFailedException
|
testGetType
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/CsvFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/CsvFormatterTest.php
|
MIT
|
public function testFormatPropertyName(): void
{
static::assertSame('"text"', $this->object->formatPropertyName('text'));
}
|
tests formatting a property name
@throws ExpectationFailedException
|
testFormatPropertyName
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/CsvFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/CsvFormatterTest.php
|
MIT
|
public static function propertyNameTypeDataProvider(): array
{
return [
['Comment', 'test', '"test"'],
['Browser', 'test', '"test"'],
['Platform', 'test', '"test"'],
['Platform_Description', 'test', '"test"'],
['Device_Name', 'test', '"test"'],
['Device_Maker', 'test', '"test"'],
['RenderingEngine_Name', 'test', '"test"'],
['RenderingEngine_Description', 'test', '"test"'],
['Parent', 'test', '"test"'],
['Platform_Version', 'test', '"test"'],
['RenderingEngine_Version', 'test', '"test"'],
['Version', 'test', '"test"'],
['MajorVer', 'test', '"test"'],
['MinorVer', 'test', '"test"'],
['CssVersion', 'test', '"test"'],
['AolVersion', 'test', '"test"'],
['Alpha', 'true', '"true"'],
['Beta', 'false', '"false"'],
['Win16', 'test', '""'],
['Browser_Type', 'Browser', '"Browser"'],
['Device_Type', 'Tablet', '"Tablet"'],
['Device_Pointing_Method', 'mouse', '"mouse"'],
];
}
|
Data Provider for the test testGetPropertyType
@return array<array<string>>
@throws void
|
propertyNameTypeDataProvider
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/CsvFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/CsvFormatterTest.php
|
MIT
|
public function testFormatPropertyValue(string $propertyName, string $inputValue, string $expectedValue): void
{
$actualValue = $this->object->formatPropertyValue($inputValue, $propertyName);
static::assertSame($expectedValue, $actualValue, sprintf('Property %s should be %s (was %s)', $propertyName, $expectedValue, $actualValue));
}
|
tests formatting a property value
@throws Exception
@dataProvider propertyNameTypeDataProvider
|
testFormatPropertyValue
|
php
|
browscap/browscap
|
tests/BrowscapTest/Formatter/CsvFormatterTest.php
|
https://github.com/browscap/browscap/blob/master/tests/BrowscapTest/Formatter/CsvFormatterTest.php
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.