Skip to content

Commit

Permalink
Remove WP_Mock from the tests
Browse files Browse the repository at this point in the history
- composer remove --dev 10up/wp_mock
- composer require --dev php-mock/php-mock-mockery
- Manually replaced WP_Mock with PHPMockery

WP_Mock has dependencies on older versions of packages. This ends up
conflicting with the newer versions of more actively-developed packages.
Removing this dependency allows us greater flexibility in the packages
we install.
  • Loading branch information
mallorydxw committed Aug 21, 2020
1 parent 7a3e39a commit 8b34a50
Show file tree
Hide file tree
Showing 17 changed files with 370 additions and 1,682 deletions.
6 changes: 5 additions & 1 deletion wp-content/themes/theme/app/Theme/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public function __construct(array $required = [])
{
$this->required = $required;
$this->path_to_wordpress = ABSPATH;
// For the tests
$this->requireOnce = function ($a) {
require_once($a);
};
}

public function register()
Expand All @@ -27,7 +31,7 @@ public function checkDependencies()
return;
}
if (!function_exists('get_plugin_data')) {
require_once($this->path_to_wordpress . 'wp-admin/includes/plugin.php');
call_user_func($this->requireOnce, $this->path_to_wordpress . 'wp-admin/includes/plugin.php');
}
array_map([$this, 'addNotice'], $pluginsToActivate);
}
Expand Down
4 changes: 2 additions & 2 deletions wp-content/themes/theme/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
},
"require-dev": {
"dxw/phar-install": "^1.0",
"10up/wp_mock": "^0.3.0",
"mikey179/vfsstream": "^1.6",
"peridot-php/peridot": "^1.19",
"peridot-php/leo": "^1.6",
"peridot-php/peridot-dot-reporter": "^1.0",
"dxw/php-cs-fixer-config": "^1.0"
"dxw/php-cs-fixer-config": "^1.0",
"php-mock/php-mock-mockery": "^1.3"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 8b34a50

Please sign in to comment.