Skip to content

Commit

Permalink
Add a Behat test for a single file plugin that is expected to output …
Browse files Browse the repository at this point in the history
…the success message.
  • Loading branch information
pbiron committed Oct 2, 2024
1 parent b04d5da commit 7dcd83c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/behat/features/plugin-check.feature
Original file line number Diff line number Diff line change
Expand Up @@ -601,3 +601,33 @@ Feature: Test that the WP-CLI command works.
# """
# ExampleRuntimeCheck.ForbiddenScript,WARNING
# """

Scenario: Check custom single file plugin that has no errors or warnings
Given a WP install with the Plugin Check plugin
And a wp-content/plugins/foo-single.php file:
"""
<?php
/**
* Plugin Name: Foo Single
* Plugin URI: https://foo-single.com
* Description: Custom plugin.
* Version: 0.1.0
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
add_action(
'init',
function () {
echo esc_html( 'this is a test.' );
}
);
"""

When I run the WP-CLI command `plugin check foo-single.php`
Then STDOUT should contain:
"""
Success: Checks complete. No errors found.
"""

0 comments on commit 7dcd83c

Please sign in to comment.