-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
feature/test-doublesTest Stubs and Mock ObjectsTest Stubs and Mock Objectsversion/11Something affects PHPUnit 11Something affects PHPUnit 11version/12Something affects PHPUnit 12Something affects PHPUnit 12
Description
PhpUnit Version: 12.4.1
I got following class and want to mock it public get property hook
class Example
{
public function __construct(
private(set) string $property {
get => $this->property;
}
) {
}
}
$example = $this->createMock(Example::class);
$example
->expects($this->once())
->method(PropertyHook::get('property'))
->willReturn('test');
Why it's not possible and gives me an error. We just want to mock public get hook, not private.[PHPUnit\Framework\MockObject\MethodCannotBeConfiguredException] Trying to configure method "property" which cannot be configured because it does not exist, has not been specified, is final, or is static
It's a bit confusing...
Metadata
Metadata
Assignees
Labels
feature/test-doublesTest Stubs and Mock ObjectsTest Stubs and Mock Objectsversion/11Something affects PHPUnit 11Something affects PHPUnit 11version/12Something affects PHPUnit 12Something affects PHPUnit 12