trait InteractsWithContainer (View source)

Properties

protected Mix|null $originalMix

The original Laravel Mix handler.

Methods

object
swap(string $abstract, object $instance)

Register an instance of an object in the container.

object
instance(string $abstract, object $instance)

Register an instance of an object in the container.

MockInterface
mock(string $abstract, Closure $mock = null)

Mock an instance of an object in the container.

MockInterface
partialMock(string $abstract, Closure $mock = null)

Mock a partial instance of an object in the container.

MockInterface
spy(string $abstract, Closure $mock = null)

Spy an instance of an object in the container.

$this
forgetMock(string $abstract)

Instruct the container to forget a previously mocked / spied instance of an object.

$this
withoutMix()

Register an empty handler for Laravel Mix in the container.

$this
withMix()

Register an empty handler for Laravel Mix in the container.

Details

protected object swap(string $abstract, object $instance)

Register an instance of an object in the container.

Parameters

string $abstract
object $instance

Return Value

object

protected object instance(string $abstract, object $instance)

Register an instance of an object in the container.

Parameters

string $abstract
object $instance

Return Value

object

protected MockInterface mock(string $abstract, Closure $mock = null)

Mock an instance of an object in the container.

Parameters

string $abstract
Closure $mock

Return Value

MockInterface

protected MockInterface partialMock(string $abstract, Closure $mock = null)

Mock a partial instance of an object in the container.

Parameters

string $abstract
Closure $mock

Return Value

MockInterface

protected MockInterface spy(string $abstract, Closure $mock = null)

Spy an instance of an object in the container.

Parameters

string $abstract
Closure $mock

Return Value

MockInterface

protected $this forgetMock(string $abstract)

Instruct the container to forget a previously mocked / spied instance of an object.

Parameters

string $abstract

Return Value

$this

protected $this withoutMix()

Register an empty handler for Laravel Mix in the container.

Return Value

$this

protected $this withMix()

Register an empty handler for Laravel Mix in the container.

Return Value

$this