Skip to content

phpcs and phpunit are not running from the project 'root' #114

Open
@benpbolton

Description

@benpbolton

Description of the bug

While working on #111 , we learned that the default composer test will fail after initial configure due to the current structure of navigating to cd plugins/[folder] before running phpcs or phpunit and the resulting folder not having proper .phpcs.xml (prefixes, names, etc) nor a proper phpunit.xml.

Steps To Reproduce

  1. Clone this repo
  2. run yes '' | php ./configure.php --project_name=cwp --author_name=cwp --author_email=cwp@alley.com (accepting all defaults)
  3. run composer install
  4. run composer test
  5. Observe failures

Additional Information

  • Ensure plugin is cloned, scaffolded, search-replaced, config files generated so that when composer test is run it's working correctly.
  • Ensure theme and plugin namespaces are just the name of the theme or plugin, without the Alley\WP\ prefix, e.g., Example_Plugin not Alley\WP\Example_Plugin. Ensure this is universally applied, including in template files for the scaffolder in the plugin.
  • Remove ./plugin-templates/ in .phpcs.xml as part of scaffolding as it isn't necessary after the configure script has been run.
  • Add a new block to .phpcs.xml disabling the same check that was disabled in ./plugin-templates/ but for the plugin's blocks folder instead.
  • Ensure phpunit configuration is present in the plugin folder after running the configure script.
  • Ensure that the xsi:noNamespaceSchemaLocation property points to ../../mu-plugins/vendor/phpunit/phpunit/phpunit.xsd for both the plugin and the theme, and that this is client-mu-plugins instead of mu-plugins for a VIP install.
  • Ensure autoloader is properly being loaded in the plugin and theme so that tests pass.
  • Ensure that Composer autoloader configuration is correct - for tests it should be PSR-4 format, not WordPress autoloader format.
  • Ensure theme files and tests are added to the autoloader configuration now that create-wordpress-theme includes PHP components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ci/cdPR checks, deploys, automationphpRequires understanding PHP

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions