Skip to content

Commit

Permalink
Upgrading to Mantle testkit 1.1 and phpunit 11
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Jul 18, 2024
1 parent 44da604 commit d6a92f0
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/all-pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ jobs:
- name: Run PHP Tests
# See https://github.com/alleyinteractive/action-test-php for more options
uses: alleyinteractive/action-test-php@develop
with:
skip-services: 'true'
11 changes: 11 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,15 @@
<rule ref="Squiz.Commenting.InlineComment">
<exclude-pattern>src/assets.php</exclude-pattern>
</rule>

<!-- Fixes from alley-coding-standards that will be included in the 2.1 release. -->
<!-- Allow PSR-4 file format for test files -->
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>tests/*Test.php</exclude-pattern>
</rule>

<!-- Allow PSR-4 file format for test files -->
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>tests/*Test.php</exclude-pattern>
</rule>
</ruleset>
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
},
"require-dev": {
"alleyinteractive/alley-coding-standards": "^2.0",
"mantle-framework/testkit": "^0.12",
"nunomaduro/collision": "^6.0",
"mantle-framework/testkit": "^1.0",
"szepeviktor/phpstan-wordpress": "^1.1"
},
"config": {
Expand All @@ -40,6 +39,11 @@
},
"sort-packages": true
},
"autoload-dev": {
"psr-4": {
"Alley\\WP\\WP_Curate\\Tests\\": "tests"
}
},
"extra": {
"wordpress-autoloader": {
"autoload": {
Expand All @@ -54,7 +58,7 @@
"prefer-stable": true,
"scripts": {
"phpcbf": "phpcbf .",
"phpcs": "phpcs .",
"phpcs": "phpcs . -sn",
"phpunit": "phpunit",
"phpstan": "phpstan --memory-limit=512M",
"test": [
Expand Down
30 changes: 15 additions & 15 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0"?>
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
printerClass="NunoMaduro\Collision\Adapters\Phpunit\Printer"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>
<testsuites>
<testsuite name="Feature">
<directory suffix=".php">tests/feature</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix=".php">tests/unit</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">tests/feature</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix="Test.php">tests/unit</directory>
</testsuite>
</testsuites>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @link https://mantle.alley.com/testing/test-framework.html
*/
class Unique_Pinned_Post_Test extends Test_Case {
class UniquePinnedPostTest extends Test_Case {
/**
* Run before each test.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @link https://mantle.alley.com/testing/test-framework.html
*/
class Example_Unit_Test extends TestCase {
class ExampleUnitTest extends TestCase {
/**
* An example unit test. In practice, this should be updated to test a function in isolation.
*/
Expand Down

0 comments on commit d6a92f0

Please sign in to comment.