Is your feature request related to a problem?
Plugins and themes are symlinked and activated, however, when adding the WP PHPUnit Integration to a must-use plugin, it is not symlinked. Activation is probably not needed.
Ideally, this should be handled as well, even if it's not that common to create standalone must-use plugins.
|
$contextual = (match ($container->get(PackageTypeDetector::class)->determine()) { |
|
PackageType::Plugin => [ |
|
$container->get(SymlinkTestedPlugin::class), |
|
$container->get(ActivateTestedPlugin::class), |
|
], |
|
PackageType::Theme => [ |
|
$container->get(SymlinkTestedTheme::class), |
|
$container->get(ActivateTestedTheme::class), |
|
], |
|
default => [] |
|
}); |
Describe the desired solution
Create new steps tha handled linking the must-use plugin to the test WP enviroment, same asa with plugins and themes.
Describe the alternatives that you have considered
Keep it as is, and extend the bootstrap phases with custom steps where it's needed.
Something like this could be possible:
/**
* @return array{0: Closure(): void, 1: Closure(): void}
*/
function wpEnvBootstrapMuPluginStep(): array
{
$filesystem = new SymfonyFilesystem();
$packageRootPath = ServiceLocator::retrieve(PackageRootPath::class);
$wordPressPath = ServiceLocator::retrieve(WordPressPath::class);
return [
static function () use ($packageRootPath, $filesystem, $wordPressPath): void {
$filesystem->mkdir($wordPressPath->path() . '/wp-content/mu-plugins/');
$filesystem->symlink(
$packageRootPath->path() . '/index.php',
$wordPressPath->path() . '/wp-content/mu-plugins/wpstarter-mu-plugins.php',
);
},
static function () use ($filesystem, $wordPressPath): void {
$filesystem->remove($wordPressPath->path() . '/wp-content/mu-plugins/wpstarter-mu-plugins.php');
},
];
}
Bootstrap::init(
$packagePath,
new BootstrapLifecycle(
setup: static function (): void {
WpTestEnv::setup();
[$symlinkMuPlugin,] = wpEnvBootstrapMuPluginStep();
$symlinkMuPlugin();
},
cleanup: static function (): void {
WpTestEnv::cleanup();
[, $unlinkMuPlugin] = wpEnvBootstrapMuPluginStep();
$unlinkMuPlugin();
},
),
);
Additional context
No response
Code of Conduct
Is your feature request related to a problem?
Plugins and themes are symlinked and activated, however, when adding the WP PHPUnit Integration to a must-use plugin, it is not symlinked. Activation is probably not needed.
Ideally, this should be handled as well, even if it's not that common to create standalone must-use plugins.
wp-phpunit-integration/inc/container.php
Lines 130 to 140 in 1962217
Describe the desired solution
Create new steps tha handled linking the must-use plugin to the test WP enviroment, same asa with plugins and themes.
Describe the alternatives that you have considered
Keep it as is, and extend the bootstrap phases with custom steps where it's needed.
Something like this could be possible:
Additional context
No response
Code of Conduct