PHP Class Eloquent\Phony\Mock\MockFactory

Datei anzeigen Open project: eloquent/phony Class Usage Examples

Public Methods

Method Description
__construct ( Sequencer $labelSequencer, MockGenerator $generator, HandleFactory $handleFactory, FeatureDetector $featureDetector ) Cosntruct a new mock factory.
createFullMock ( ReflectionClass $class ) : Mock Create a new full mock instance for the supplied class.
createMockClass ( MockDefinition $definition, boolean $createNew = false ) : ReflectionClass Create the mock class for the supplied definition.
createPartialMock ( ReflectionClass $class, Arguments | array | null $arguments = [] ) : Mock Create a new partial mock instance for the supplied definition.
instance ( ) : MockFactory Get the static instance of this factory.

Method Details

__construct() public method

Cosntruct a new mock factory.
public __construct ( Sequencer $labelSequencer, MockGenerator $generator, HandleFactory $handleFactory, FeatureDetector $featureDetector )
$labelSequencer Eloquent\Phony\Sequencer\Sequencer The label sequencer to use.
$generator MockGenerator The generator to use.
$handleFactory Eloquent\Phony\Mock\Handle\HandleFactory The handle factory to use.
$featureDetector Eloquent\Phony\Reflection\FeatureDetector The feature detector to use.

createFullMock() public method

Create a new full mock instance for the supplied class.
public createFullMock ( ReflectionClass $class ) : Mock
$class ReflectionClass The class.
return Mock The newly created mock.

createMockClass() public method

Create the mock class for the supplied definition.
public createMockClass ( MockDefinition $definition, boolean $createNew = false ) : ReflectionClass
$definition Eloquent\Phony\Mock\Builder\MockDefinition The definition.
$createNew boolean True if a new class should be created even when a compatible one exists.
return ReflectionClass The class.

createPartialMock() public method

Create a new partial mock instance for the supplied definition.
public createPartialMock ( ReflectionClass $class, Arguments | array | null $arguments = [] ) : Mock
$class ReflectionClass The class.
$arguments Eloquent\Phony\Call\Arguments | array | null The constructor arguments, or null to bypass the constructor.
return Mock The newly created mock.

instance() public static method

Get the static instance of this factory.
public static instance ( ) : MockFactory
return MockFactory The static factory.