WordPress / plugin-check

A repository for the new Plugin Check plugin from the WordPress Performance and Plugins Team.
https://wordpress.org/plugins/plugin-check/
GNU General Public License v2.0
195 stars 39 forks source link

Fix failing Behat test #409

Closed ernilambar closed 5 months ago

ernilambar commented 5 months ago

Ref: https://github.com/WordPress/plugin-check/actions/runs/7728228566/job/21068526460

Behat test is failing because Akismet has done some update which we have used in the CLI test.

ernilambar commented 5 months ago

cc: @swissspidy @mukeshpanchal27

Note: We need to explore option for Behat tests without depending on external plugin.

swissspidy commented 5 months ago

That's exactly why I wasn't too happy with using external plugins for tests like this.

The most robust solution would be to use dedicated test plugins, like we do for unit tests already.

Something like this (untested):


  Scenario: Exclude directories
    Given a WP install with the Plugin Check plugin
    And an empty wp-content/plugins/foo-plugin directory
    And an empty wp-content/plugins/foo-plugin/subdir directory
    And a wp-content/plugins/foo-plugin/foo-plugin.php file:
      """
      <?php
      /**
       * Plugin Name: Foo Plugin
       * Plugin URI:  https://example.com
       * Description:
       * Version:     0.1.0
       * Author:
       * Author URI:
       * License:     GPL-2.0+
       * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
       * Text Domain: foo-plugin
       * Domain Path: /languages
       */

      """
    And a wp-content/plugins/foo-plugin/subdir/test.php file:
      """
      <?php
      echo 1234;
      """

    When I run the WP-CLI command `plugin check foo-plugin`
    Then STDOUT should contain:
      """
      FILE: subdir/test.php
      """

    When I run the WP-CLI command `plugin check foo-plugin --exclude-directories=subdir`
    Then STDOUT should not contain:
      """
      FILE: subdir/test.php
      """
mukeshpanchal27 commented 5 months ago

Thanks @ernilambar for the PR. The changes LGTM.

What about Hello Dolly plugin? At some point that will also updated?

ernilambar commented 5 months ago

@mukeshpanchal27 May be we should replace that also. We can tackle that in separate PR.

mukeshpanchal27 commented 5 months ago

@mukeshpanchal27 May be we should replace that also. We can tackle that in separate PR.

Make sense.