Bootstrapper
class Bootstrapper
Constants
| protected RUNTIME_PROCESS_MARKER |
|
Properties
| static protected Config|null | $configuration | ||
| static protected Filesystem|null | $filesystem | ||
| static protected string|null | $runtimePath | The path to the disposable runtime copy of the workbench. |
Methods
Bootstrap the testbench environment.
Get the configuration attributes as an array.
Get the cached configuration instance.
Get the filesystem instance.
No description
Resolve the directory that owns the active testbench.yaml file.
Determine if the given path contains a testbench configuration file.
Create a disposable runtime copy of the skeleton directory.
Purge stale runtime copies left by interrupted test processes.
Copy the package or workbench environment file into the runtime copy.
Determine the active Testbench environment file name.
Resolve the runtime base path for the current process.
Delete the disposable runtime copy.
Delete a runtime copy on a best-effort basis.
Determine if the given PID is an orphaned serve process.
Determine whether a process identity matches a Testbench serve runtime.
Read the OS identity of the process incarnation.
Kill a process and all its descendants.
Collect all descendant PIDs of the given PID in depth-first order.
Build a map of PID → direct child PIDs by scanning /proc once.
Flush all static state.
Details
at line 36
static void
bootstrap()
Bootstrap the testbench environment.
at line 67
static array
getConfig()
Get the configuration attributes as an array.
at line 77
static Config|null
getConfiguration()
Get the cached configuration instance.
at line 85
static protected Filesystem
getFilesystem()
Get the filesystem instance.
at line 94
static protected void
loadConfigFromYaml(string $workingPath, string|null $filename = 'testbench.yaml', array $defaults = [])
No description
at line 102
static string
resolveConfigurationPath(string $workingPath)
Resolve the directory that owns the active testbench.yaml file.
at line 116
static protected bool
hasConfigurationFile(string $workingPath, string $filename = 'testbench.yaml')
Determine if the given path contains a testbench configuration file.
at line 135
static protected string
createRuntimeCopy(string $sourcePath, string $workingPath)
Create a disposable runtime copy of the skeleton directory.
Tests write generated files (make:provider, make:model, etc.) and mutate bootstrap/providers.php into the app's basePath. By copying the skeleton to a temp directory and using that as BASE_PATH, the committed skeleton stays clean. The copy is deleted on shutdown.
at line 212
static protected void
purgeStaleRuntimeCopies(string $tempDirectory, int $pid)
Purge stale runtime copies left by interrupted test processes.
at line 264
static protected void
copyPackageEnvironmentFile(Filesystem $filesystem, string $runtimePath, string $workingPath)
Copy the package or workbench environment file into the runtime copy.
at line 281
static protected string
testbenchEnvironmentFile()
Determine the active Testbench environment file name.
at line 293
static protected string
resolveRuntimeBasePath(string $sourcePath, string $workingPath)
Resolve the runtime base path for the current process.
at line 308
static protected void
deleteRuntimeCopy()
Delete the disposable runtime copy.
at line 324
static protected void
deleteRuntimeDirectory(string $directory)
Delete a runtime copy on a best-effort basis.
Callers that require the path to be absent must verify that postcondition.
at line 341
static protected bool
isOrphanedServeProcess(int $pid, string $runtimeDir)
Determine if the given PID is an orphaned serve process.
A process is considered an orphaned serve process only when its parent is init and its PID file and process incarnation match the runtime.
at line 376
static protected bool
matchesServeProcessIdentity(int $pid, string $runtimeDir)
Determine whether a process identity matches a Testbench serve runtime.
at line 422
static protected string|null
processStartIdentity(int $pid)
Read the OS identity of the process incarnation.
Linux exposes the start clock tick exactly. macOS lstart has one-second
resolution, the most precise portable process-start identity available there.
at line 457
static protected void
killProcessTree(int $pid)
Kill a process and all its descendants.
Collects the full descendant tree first (single /proc scan), then kills leaves before parents to avoid re-parenting races where killing a parent causes its children to be adopted by init before we can find them.
at line 482
static protected array
collectDescendants(int $rootPid)
Collect all descendant PIDs of the given PID in depth-first order.
Scans /proc once to build a PID→children map, then walks the subtree. Returns PIDs in parent-before-children order.
at line 506
static protected array
buildChildrenMap()
Build a map of PID → direct child PIDs by scanning /proc once.
at line 551
static void
flushState()
Flush all static state.