Skip to content

Commit

Permalink
Updated PHPUnit test command to use the newly created phpunit.xml fil…
Browse files Browse the repository at this point in the history
…e and added the coverage scope with attributes in FastJsonPatchTest.php
  • Loading branch information
blancks committed Aug 26, 2024
1 parent 40fb6fa commit 890b904
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"phpstan/phpstan": "^1.11"
},
"scripts": {
"test": "phpunit --no-configuration --test-suffix FastJsonPatchTest.php tests/ --colors=always",
"test": "phpunit",
"static-analyse": "phpstan analyse --configuration phpstan.neon.dist"
}
}
23 changes: 23 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<source restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
11 changes: 11 additions & 0 deletions tests/FastJsonPatchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

#[\PHPUnit\Framework\Attributes\CoversClass(FastJsonPatch::class)]
#[\PHPUnit\Framework\Attributes\UsesClass(AppendToObjectException::class)]
#[\PHPUnit\Framework\Attributes\UsesClass(ArrayBoundaryException::class)]
#[\PHPUnit\Framework\Attributes\UsesClass(FailedTestException::class)]
#[\PHPUnit\Framework\Attributes\UsesClass(InvalidPatchFromException::class)]
#[\PHPUnit\Framework\Attributes\UsesClass(InvalidPatchOperationException::class)]
#[\PHPUnit\Framework\Attributes\UsesClass(InvalidPatchPathException::class)]
#[\PHPUnit\Framework\Attributes\UsesClass(InvalidPatchValueException::class)]
#[\PHPUnit\Framework\Attributes\UsesClass(MalformedPathException::class)]
#[\PHPUnit\Framework\Attributes\UsesClass(UnknownPatchOperationException::class)]
#[\PHPUnit\Framework\Attributes\UsesClass(UnknownPathException::class)]
final class FastJsonPatchTest extends TestCase
{
public function testPatchWithMissingOpParameterShouldFail(): void
Expand Down

0 comments on commit 890b904

Please sign in to comment.