Skip to content

Commit

Permalink
Merge pull request #282 from alleyinteractive/feature/psr-4-tests
Browse files Browse the repository at this point in the history
Migrating to PSR-4 for tests
  • Loading branch information
srtfisher authored Nov 21, 2023
2 parents 040442a + fbe814d commit 31480a6
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@
<rule ref="Squiz.Commenting.InlineComment">
<exclude-pattern>src/assets.php</exclude-pattern>
</rule>

<rule ref="WordPress.Files.FileName">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
</ruleset>
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
},
"sort-packages": true
},
"autoload-dev": {
"psr-4": {
"Create_WordPress_Plugin\\Tests\\": "tests"
}
},
"extra": {
"wordpress-autoloader": {
"autoload": {
Expand Down
4 changes: 2 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
>
<testsuites>
<testsuite name="Feature">
<directory suffix=".php">tests/feature</directory>
<directory suffix=".php">tests/Feature</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix=".php">tests/unit</directory>
<directory suffix=".php">tests/Unit</directory>
</testsuite>
</testsuites>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

namespace Create_WordPress_Plugin\Tests\Feature;

use Create_WordPress_Plugin\Tests\Test_Case;
use Create_WordPress_Plugin\Tests\TestCase;

/**
* A test suite for an example feature.
*
* @link https://mantle.alley.com/testing/test-framework.html
*/
class Example_Feature_Test extends Test_Case {
class ExampleFeatureTest extends TestCase {
/**
* An example test for the example feature. In practice, this should be updated to test an aspect of the feature.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/class-test-case.php → tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
/**
* Create WordPress Plugin Base Test Case
*/
abstract class Test_Case extends TestkitTest_Case {
abstract class TestCase extends TestkitTest_Case {

}
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 31480a6

Please sign in to comment.