Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating to PSR-4 for tests #282

Merged
merged 3 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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