class ParallelTesting

Properties

protected Closure|null $optionsResolver

The options resolver callback.

protected Closure|null $tokenResolver

The token resolver callback.

protected list<callable> $setUpProcessCallbacks

All of the registered "setUp" process callbacks.

protected list<callable> $setUpTestCaseCallbacks

All of the registered "setUp" test case callbacks.

protected list<callable> $setUpTestDatabaseBeforeMigratingCallbacks

All of the registered "setUp" test database callbacks prior to migrations.

protected list<callable> $setUpTestDatabaseCallbacks

All of the registered "setUp" test database callbacks.

protected list<callable> $tearDownProcessCallbacks

All of the registered "tearDown" process callbacks.

protected list<callable> $tearDownTestCaseCallbacks

All of the registered "tearDown" test case callbacks.

Methods

__construct(Container $container)

Create a new parallel testing instance.

void
resolveOptionsUsing(Closure|null $resolver)

Set a callback that should be used when resolving options.

void
resolveTokenUsing(Closure|null $resolver)

Set a callback that should be used when resolving the unique process token.

void
setUpProcess(callable $callback)

Register a "setUp" process callback.

void
setUpTestCase(callable $callback)

Register a "setUp" test case callback.

void
setUpTestDatabaseBeforeMigrating(callable $callback)

Register a "setUp" test database callback that runs prior to migrations.

void
setUpTestDatabase(callable $callback)

Register a "setUp" test database callback.

void
tearDownProcess(callable $callback)

Register a "tearDown" process callback.

void
tearDownTestCase(callable $callback)

Register a "tearDown" test case callback.

void
callSetUpProcessCallbacks()

Call all of the "setUp" process callbacks.

void
callSetUpTestCaseCallbacks(mixed $testCase)

Call all of the "setUp" test case callbacks.

void
callSetUpTestDatabaseBeforeMigratingCallbacks(string $database)

Call all of the "setUp" test database callbacks that run prior to migrations.

void
callSetUpTestDatabaseCallbacks(string $database)

Call all of the "setUp" test database callbacks.

void
callTearDownProcessCallbacks()

Call all of the "tearDown" process callbacks.

void
callTearDownTestCaseCallbacks(mixed $testCase)

Call all of the "tearDown" test case callbacks.

mixed
option(string $option)

Get a parallel testing option.

string|false
token()

Get the unique test token.

bool
inParallel()

Check if tests are running in parallel.

static string|null
processToken()

Get the filesystem-safe test process token.

static string
tempDir(string $suffix = '')

Get a unique temporary directory path for the current test process.

void
whenRunningInParallel(callable $callback)

Apply the callback if tests are running in parallel.

Details

at line 69
__construct(Container $container)

Create a new parallel testing instance.

Parameters

Container $container

at line 77
void resolveOptionsUsing(Closure|null $resolver)

Set a callback that should be used when resolving options.

Parameters

Closure|null $resolver

Return Value

void

at line 85
void resolveTokenUsing(Closure|null $resolver)

Set a callback that should be used when resolving the unique process token.

Parameters

Closure|null $resolver

Return Value

void

at line 93
void setUpProcess(callable $callback)

Register a "setUp" process callback.

Parameters

callable $callback

Return Value

void

at line 101
void setUpTestCase(callable $callback)

Register a "setUp" test case callback.

Parameters

callable $callback

Return Value

void

at line 109
void setUpTestDatabaseBeforeMigrating(callable $callback)

Register a "setUp" test database callback that runs prior to migrations.

Parameters

callable $callback

Return Value

void

at line 117
void setUpTestDatabase(callable $callback)

Register a "setUp" test database callback.

Parameters

callable $callback

Return Value

void

at line 125
void tearDownProcess(callable $callback)

Register a "tearDown" process callback.

Parameters

callable $callback

Return Value

void

at line 133
void tearDownTestCase(callable $callback)

Register a "tearDown" test case callback.

Parameters

callable $callback

Return Value

void

at line 141
void callSetUpProcessCallbacks()

Call all of the "setUp" process callbacks.

Return Value

void

at line 155
void callSetUpTestCaseCallbacks(mixed $testCase)

Call all of the "setUp" test case callbacks.

Parameters

mixed $testCase

Return Value

void

at line 170
void callSetUpTestDatabaseBeforeMigratingCallbacks(string $database)

Call all of the "setUp" test database callbacks that run prior to migrations.

Parameters

string $database

Return Value

void

at line 185
void callSetUpTestDatabaseCallbacks(string $database)

Call all of the "setUp" test database callbacks.

Parameters

string $database

Return Value

void

at line 200
void callTearDownProcessCallbacks()

Call all of the "tearDown" process callbacks.

Return Value

void

at line 212
void callTearDownTestCaseCallbacks(mixed $testCase)

Call all of the "tearDown" test case callbacks.

Parameters

mixed $testCase

Return Value

void

at line 248
mixed option(string $option)

Get a parallel testing option.

Parameters

string $option

Return Value

mixed

at line 262
string|false token()

Get the unique test token.

Return Value

string|false

at line 276
bool inParallel()

Check if tests are running in parallel.

Return Value

bool

at line 286
static string|null processToken()

internal  
 

Get the filesystem-safe test process token.

Return Value

string|null

at line 307
static string tempDir(string $suffix = '')

Get a unique temporary directory path for the current test process.

Incorporates TEST_TOKEN (parallel worker ID) and PID to prevent cross-worker filesystem collisions under ParaTest.

Parameters

string $suffix

Return Value

string

at line 320
protected void whenRunningInParallel(callable $callback)

Apply the callback if tests are running in parallel.

Parameters

callable $callback

Return Value

void