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
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 68
__construct(Container $container)

Create a new parallel testing instance.

Parameters

Container $container

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

Set a callback that should be used when resolving options.

Parameters

Closure|null $resolver

Return Value

void

at line 84
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 92
void setUpProcess(callable $callback)

Register a "setUp" process callback.

Parameters

callable $callback

Return Value

void

at line 100
void setUpTestCase(callable $callback)

Register a "setUp" test case callback.

Parameters

callable $callback

Return Value

void

at line 108
void setUpTestDatabaseBeforeMigrating(callable $callback)

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

Parameters

callable $callback

Return Value

void

at line 116
void setUpTestDatabase(callable $callback)

Register a "setUp" test database callback.

Parameters

callable $callback

Return Value

void

at line 124
void tearDownProcess(callable $callback)

Register a "tearDown" process callback.

Parameters

callable $callback

Return Value

void

at line 132
void tearDownTestCase(callable $callback)

Register a "tearDown" test case callback.

Parameters

callable $callback

Return Value

void

at line 140
void callSetUpProcessCallbacks()

Call all of the "setUp" process callbacks.

Return Value

void

at line 154
void callSetUpTestCaseCallbacks(mixed $testCase)

Call all of the "setUp" test case callbacks.

Parameters

mixed $testCase

Return Value

void

at line 169
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 184
void callSetUpTestDatabaseCallbacks(string $database)

Call all of the "setUp" test database callbacks.

Parameters

string $database

Return Value

void

at line 199
void callTearDownProcessCallbacks()

Call all of the "tearDown" process callbacks.

Return Value

void

at line 213
void callTearDownTestCaseCallbacks(mixed $testCase)

Call all of the "tearDown" test case callbacks.

Parameters

mixed $testCase

Return Value

void

at line 228
mixed option(string $option)

Get a parallel testing option.

Parameters

string $option

Return Value

mixed

at line 242
string|false token()

Get the unique test token.

Return Value

string|false

at line 252
bool inParallel()

Check if tests are running in parallel.

Return Value

bool

at line 263
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 276
protected void whenRunningInParallel(callable $callback)

Apply the callback if tests are running in parallel.

Parameters

callable $callback

Return Value

void