MocksClassLoader

Helper trait to test classes which use the ClassLoader (ie. extensions).

 trait Winter\Storm\Support\Testing\MocksClassLoader

This trait will mock the ClassLoader so that it does not require the entire app to be instantiated.

Properties

protected $classLoader : ClassLoader

Mocked ClassLoader instance

Methods

protected mockClassLoader (string $class) : mixed

Mocks the getClassLoader method of a class that uses the Extendable trait.

The mock will use the class loader from this trait.

Parameters
Property Description
$class
string
Returns
mixed

protected registerMockClassLoader (string $basePath = null, string $manifestPath = null) : void

Registers a mock class loader in the autoload stack.

Parameters
Property Description
$basePath
string
$manifestPath
string
Returns
void
Copyright © 2024 Winter CMS