class MockClass
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
@internal This class is not covered by the backward compatibility promise for PHPUnit
Hierarchy
- class \PHPUnit\Framework\MockObject\Generator\MockClass implements \PHPUnit\Framework\MockObject\Generator\MockType
Expanded class hierarchy of MockClass
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ MockClass.php, line 21
Namespace
PHPUnit\Framework\MockObject\GeneratorView source
final class MockClass implements MockType {
private readonly string $classCode;
/**
* @psalm-var class-string
*/
private readonly string $mockName;
/**
* @psalm-var list<ConfigurableMethod>
*/
private readonly array $configurableMethods;
/**
* @psalm-param class-string $mockName
* @psalm-param list<ConfigurableMethod> $configurableMethods
*/
public function __construct(string $classCode, string $mockName, array $configurableMethods) {
$this->classCode = $classCode;
$this->mockName = $mockName;
$this->configurableMethods = $configurableMethods;
}
/**
* @psalm-return class-string
*/
public function generate() : string {
if (!class_exists($this->mockName, false)) {
eval($this->classCode);
call_user_func([
$this->mockName,
'__phpunit_initConfigurableMethods',
], ...$this->configurableMethods);
}
return $this->mockName;
}
public function classCode() : string {
return $this->classCode;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
MockClass::$classCode | private | property | ||
MockClass::$configurableMethods | private | property | @psalm-var list<ConfigurableMethod> | |
MockClass::$mockName | private | property | @psalm-var class-string | |
MockClass::classCode | public | function | ||
MockClass::generate | public | function | @psalm-return class-string | Overrides MockType::generate |
MockClass::__construct | public | function | @psalm-param class-string $mockName @psalm-param list<ConfigurableMethod> $configurableMethods |