Skip to content

Commit 31480a6

Browse files
authored
Merge pull request #282 from alleyinteractive/feature/psr-4-tests
Migrating to PSR-4 for tests
2 parents 040442a + fbe814d commit 31480a6

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

.phpcs.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@
5353
<rule ref="Squiz.Commenting.InlineComment">
5454
<exclude-pattern>src/assets.php</exclude-pattern>
5555
</rule>
56+
57+
<rule ref="WordPress.Files.FileName">
58+
<exclude-pattern>tests/*</exclude-pattern>
59+
</rule>
5660
</ruleset>

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
},
3232
"sort-packages": true
3333
},
34+
"autoload-dev": {
35+
"psr-4": {
36+
"Create_WordPress_Plugin\\Tests\\": "tests"
37+
}
38+
},
3439
"extra": {
3540
"wordpress-autoloader": {
3641
"autoload": {

phpunit.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
>
1010
<testsuites>
1111
<testsuite name="Feature">
12-
<directory suffix=".php">tests/feature</directory>
12+
<directory suffix=".php">tests/Feature</directory>
1313
</testsuite>
1414
<testsuite name="Unit">
15-
<directory suffix=".php">tests/unit</directory>
15+
<directory suffix=".php">tests/Unit</directory>
1616
</testsuite>
1717
</testsuites>
1818
</phpunit>

tests/feature/class-example-feature-test.php renamed to tests/Feature/ExampleFeatureTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
namespace Create_WordPress_Plugin\Tests\Feature;
99

10-
use Create_WordPress_Plugin\Tests\Test_Case;
10+
use Create_WordPress_Plugin\Tests\TestCase;
1111

1212
/**
1313
* A test suite for an example feature.
1414
*
1515
* @link https://mantle.alley.com/testing/test-framework.html
1616
*/
17-
class Example_Feature_Test extends Test_Case {
17+
class ExampleFeatureTest extends TestCase {
1818
/**
1919
* An example test for the example feature. In practice, this should be updated to test an aspect of the feature.
2020
*/

tests/class-test-case.php renamed to tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
/**
1313
* Create WordPress Plugin Base Test Case
1414
*/
15-
abstract class Test_Case extends TestkitTest_Case {
15+
abstract class TestCase extends TestkitTest_Case {
1616

1717
}

tests/unit/class-example-unit-test.php renamed to tests/Unit/ExampleUnitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @link https://mantle.alley.com/testing/test-framework.html
1616
*/
17-
class Example_Unit_Test extends TestCase {
17+
class ExampleUnitTest extends TestCase {
1818
/**
1919
* An example unit test. In practice, this should be updated to test a function in isolation.
2020
*/

0 commit comments

Comments
 (0)