Skip to content

Commit

Permalink
Merge pull request #57 from mazedlx/55-bug-directivexr_spatial_tracki…
Browse files Browse the repository at this point in the history
…ng-injects-vr-header-value-instead-of-xr-spatial-tracking

Add test. Update method to return the correct name.
  • Loading branch information
mazedlx committed Mar 6, 2024
2 parents 44cb007 + ecb4e44 commit e25f1d0
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 28 deletions.
48 changes: 21 additions & 27 deletions phpunit.xml
@@ -1,29 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
</report>
</coverage>
<testsuites>
<testsuite name="mazedlx.net Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
</report>
</coverage>
<testsuites>
<testsuite name="mazedlx.net Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
29 changes: 29 additions & 0 deletions phpunit.xml.bak
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
</report>
</coverage>
<testsuites>
<testsuite name="mazedlx.net Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
</phpunit>
2 changes: 1 addition & 1 deletion src/FeatureGroups/DefaultFeatureGroup.php
Expand Up @@ -1152,7 +1152,7 @@ public function browserSupportUrl(): string
Directive::XR_SPATIAL_TRACKING, Directive::XR, Directive::VR => new class extends Directive {
public function name(): string
{
return 'vr';
return Directive::XR_SPATIAL_TRACKING;
}

public function specificationName(): string
Expand Down
7 changes: 7 additions & 0 deletions tests/DirectiveTest.php
Expand Up @@ -36,4 +36,11 @@ public function it_can_add_an_rule(): void
$this->assertCount(1, $directive->rules());
$this->assertSame(Value::SELF, $directive->rules()[0]);
}

#[Test]
public function xr_spatial_tracking_adds_the_correct_header_directive_instead_of_the_deprecated_one(): void
{
$directive = Directive::make(Directive::XR_SPATIAL_TRACKING);
$this->assertSame(Directive::XR_SPATIAL_TRACKING, $directive->name());
}
}

0 comments on commit e25f1d0

Please sign in to comment.