@@ -6,7 +6,7 @@ import { tmpdir } from "node:os"
66import { mkdtempSync } from "node:fs"
77import { resolveSandboxTaskCode } from "../packages/cli/src/agent-code.js"
88import { phpRuntimeComponentLifecycleActionReplayFunction , phpRuntimeComponentLifecycleReplayFunction } from "../packages/runtime-core/src/index.js"
9- import { bootstrapPhpCode } from "../packages/runtime-playground/src/php-bootstrap.js"
9+ import { bootstrapPhpCode , phpCodeFromArgs } from "../packages/runtime-playground/src/php-bootstrap.js"
1010
1111const lifecycleReplaySnippet = phpRuntimeComponentLifecycleReplayFunction ( "contained_runtime_test" )
1212assert . match ( lifecycleReplaySnippet , / f u n c t i o n c o n t a i n e d _ r u n t i m e _ t e s t _ c o m p o n e n t _ l i f e c y c l e _ r e p l a y _ p r e p a r e \( \) : a r r a y / )
@@ -94,6 +94,15 @@ assert.match(bootstrappedRunPhp, /contained_runtime_run_php_component_lifecycle_
9494assert . match ( bootstrappedRunPhp , / C O N T A I N E D _ R U N T I M E _ C O M P O N E N T _ M A N I F E S T _ J S O N / )
9595assert . doesNotMatch ( bootstrappedRunPhp , / w p _ c o d e b o x _ r u n _ p h p | w p _ c o d e b o x _ c o m p o n e n t _ m a n i f e s t | W P _ C O D E B O X _ C O M P O N E N T _ M A N I F E S T _ J S O N / )
9696
97+ const strictTypesCodeFileRoot = mkdtempSync ( join ( tmpdir ( ) , "wp-codebox-run-php-strict-types-" ) )
98+ const strictTypesCodeFile = join ( strictTypesCodeFileRoot , "strict-types.php" )
99+ writeFileSync ( strictTypesCodeFile , "<?php declare(strict_types=1);\necho 'strict';" )
100+ const strictTypesCode = await phpCodeFromArgs ( [ `code-file=${ strictTypesCodeFile } ` ] )
101+ const bootstrappedStrictTypesCodeFile = bootstrapPhpCode ( { } as never , strictTypesCode , [ ] )
102+ assert . match ( bootstrappedStrictTypesCodeFile , / ^ < \? p h p \n d e c l a r e \( s t r i c t _ t y p e s = 1 \) ; \n r e g i s t e r _ s h u t d o w n _ f u n c t i o n / )
103+ assert . equal ( ( bootstrappedStrictTypesCodeFile . match ( / d e c l a r e \( s t r i c t _ t y p e s = 1 \) ; / g) ?? [ ] ) . length , 1 )
104+ assert . match ( bootstrappedStrictTypesCodeFile , / e c h o ' s t r i c t ' ; / )
105+
97106const sandboxAgentCode = await resolveSandboxTaskCode ( {
98107 task : "Say hello" ,
99108 agent : "wp-codebox-sandbox" ,
0 commit comments