@@ -11,6 +11,7 @@ import { buildWordPressPhpunitRecipe } from "../packages/runtime-core/src/recipe
1111const execFileAsync = promisify ( execFile )
1212const root = await mkdtemp ( join ( tmpdir ( ) , "wp-codebox-phpunit-readonly-" ) )
1313const plugin = join ( root , "plugin" )
14+ const dependency = join ( root , "dependency" )
1415const harness = join ( root , "harness" )
1516const recipePath = join ( root , "recipe.json" )
1617const artifactsPath = join ( root , "artifacts" )
2425
2526 const recipe = buildWordPressPhpunitRecipe ( {
2627 pluginSlug : "readonly-phpunit-fixture" ,
28+ extra_plugins : [ {
29+ source : dependency ,
30+ slug : "activation-dependency" ,
31+ pluginFile : "activation-dependency/activation-dependency.php" ,
32+ activate : false ,
33+ } ] ,
34+ dependencyMounts : [ "/wordpress/wp-content/plugins/activation-dependency" ] ,
2735 mounts : [
2836 { source : plugin , target : "/wordpress/wp-content/plugins/readonly-phpunit-fixture" , mode : "readonly" } ,
2937 { source : join ( harness , "vendor" ) , target : "/wp-codebox-vendor" , mode : "readonly" } ,
4957
5058async function writeFixture ( ) : Promise < void > {
5159 await mkdir ( join ( plugin , "tests" ) , { recursive : true } )
60+ await mkdir ( dependency , { recursive : true } )
5261 await writeFile ( join ( plugin , "readonly-phpunit-fixture.php" ) , "<?php\n/**\n * Plugin Name: Readonly PHPUnit Fixture\n */\n" )
5362 await writeFile ( join ( plugin , "source-sentinel.bin" ) , sentinel )
54- await writeFile ( join ( plugin , "tests" , "ReadonlyCacheTest.php" ) , "<?php\nclass ReadonlyCacheTest extends WP_UnitTestCase { public function test_sentinel_is_available(): void { $this->assertGreaterThan(0, filesize(dirname(__DIR__) . \'/source-sentinel.bin\')); } }\n" )
63+ await writeFile ( join ( plugin , "tests" , "ReadonlyCacheTest.php" ) , "<?php\nclass ReadonlyCacheTest extends WP_UnitTestCase { public function test_sentinel_is_available(): void { $this->assertGreaterThan(0, filesize(dirname(__DIR__) . \'/source-sentinel.bin\')); } public function test_dependency_activation_runs_after_install(): void { $this->assertGreaterThanOrEqual(1, get_option(\'wp_codebox_dependency_activation_users\')); } }\n" )
64+ await writeFile ( join ( dependency , "activation-dependency.php" ) , "<?php\n/**\n * Plugin Name: Activation Dependency\n */\nregister_activation_hook(__FILE__, static function (): void { update_option('wp_codebox_dependency_activation_users', count(get_users(array('number' => 1)))); });\n" )
5565}
5666
5767async function digestTree ( directory : string ) : Promise < string > {
0 commit comments