Skip to content
Draft
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
38 changes: 38 additions & 0 deletions features/scaffold-plugin-tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,41 @@ Feature: Scaffold plugin unit tests
And the {PLUGIN_DIR}/hello-world/readme.txt file should exist
And the {PLUGIN_DIR}/hello-world/bitbucket-pipelines.yml file should exist
And the {PLUGIN_DIR}/hello-world/tests directory should exist

Scenario: Scaffold plugin tests without WordPress loaded
Given an empty directory
And WP files

When I run `mkdir -p my-plugin`
When I run `wp scaffold plugin-tests my-plugin --dir=my-plugin`
Then STDOUT should not be empty
And the my-plugin/tests directory should contain:
"""
bootstrap.php
test-sample.php
"""
And the my-plugin/tests/bootstrap.php file should contain:
"""
require dirname( __DIR__ ) . '/my-plugin.php';
"""
And the my-plugin/tests/bootstrap.php file should contain:
"""
* @package My_Plugin
"""
And the my-plugin/tests/test-sample.php file should contain:
"""
* @package My_Plugin
"""
And the my-plugin/bin directory should contain:
"""
install-wp-tests.sh
"""
And the my-plugin/phpunit.xml.dist file should contain:
"""
<exclude>./tests/test-sample.php</exclude>
"""
And the my-plugin/.phpcs.xml.dist file should exist
And the my-plugin/.circleci/config.yml file should contain:
"""
workflows:
"""
18 changes: 18 additions & 0 deletions features/scaffold.feature
Original file line number Diff line number Diff line change
Expand Up @@ -528,3 +528,21 @@ Feature: WordPress code scaffolding
Error: Invalid plugin slug specified.
"""
And the return code should be 1

Scenario: Scaffold plugin without WordPress loaded
Given an empty directory
And WP files

When I run `wp scaffold plugin my-plugin --dir=.`
Then STDOUT should not be empty
And the my-plugin/my-plugin.php file should exist
And the my-plugin/readme.txt file should exist
And the my-plugin/.editorconfig file should exist
And the my-plugin/my-plugin.php file should contain:
"""
* Plugin Name: My Plugin
"""
And the my-plugin/my-plugin.php file should contain:
"""
* Tested up to: 6.4
"""
1 change: 1 addition & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<!-- Exclude existing classes from the prefix rule as it would break BC to prefix them now. -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound">
<exclude-pattern>*/src/Scaffold_Command\.php$</exclude-pattern>
<exclude-pattern>*/src/Scaffold_Filesystem_Fallback\.php$</exclude-pattern>
</rule>

</ruleset>
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ parameters:
ignoreErrors:
- identifier: missingType.parameter
- identifier: missingType.return
# Pre-existing issues with array access in string interpolation
- '#Part \$data\[.+\] \(mixed\) of encapsed string cannot be cast to string\.#'
Loading
Loading