wppunk / WPPlugin

Boilerplate for WordPress plugin using autoload, coding standard, webpack, PHP/JS tests, etc.
MIT License
146 stars 25 forks source link

Do not hardcode admin URLs in acceptance tests #13

Closed ihorvorotnov closed 3 years ago

ihorvorotnov commented 3 years ago

Prerequisites (mark completed items with an [x]):

Describe the bug

$I->amOnPage( '/wp-admin/admin.php?page=plugin-name' ); will fail if WordPress is installed in its own directory.

See https://github.com/wppunk/WPPlugin/blob/master/.tests/php/acceptance/SettingsCest.php#L32

Use $I->amOnAdminPage( '/admin.php?page=plugin-name' ); instead. See docs.

Expected behavior

Tests should work fine on any official / valid WordPress install types.

Actual behavior

If WordPress is installed in its own directory, acceptance tests will fail to execute.

Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.) Steps to reproduce the bug:

  1. Install WordPress into its own directory
  2. Run acceptance tests
  3. See error

WordPress Environment

Any WordPress version installed in its own directory.