From 71bde409a97afffb6a1efe323af684960bffbcc3 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sat, 8 Jun 2024 08:07:59 +0200 Subject: [PATCH] Add test --- .../unit/Framework/MockObject/TestDoubleTestCase.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/unit/Framework/MockObject/TestDoubleTestCase.php b/tests/unit/Framework/MockObject/TestDoubleTestCase.php index f2cda235e0f..a8366f91027 100644 --- a/tests/unit/Framework/MockObject/TestDoubleTestCase.php +++ b/tests/unit/Framework/MockObject/TestDoubleTestCase.php @@ -254,6 +254,18 @@ final public function testOriginalCloneMethodCanOptionallyBeCalledWhenTestDouble clone $double; } + public function testMethodNameCanOnlyBeConfiguredOnce(): void + { + $double = $this->createTestDouble(InterfaceWithReturnTypeDeclaration::class); + + $this->expectException(MethodNameAlreadyConfiguredException::class); + + $double + ->method('doSomething') + ->method('doSomething') + ->willReturn(true); + } + /** * @psalm-template RealInstanceType of object *