Skip to content

Commit bbb938f

Browse files
Merge branch '13.0'
* 13.0: Add missing TestDox attribute Document the behaviour discovered in #6504
2 parents 118f599 + 193749f commit bbb938f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/unit/Framework/MockObject/MockObjectTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,27 @@ public function testMethodParametersCanOnlyBeConfiguredOnce(): void
812812
$this->fail();
813813
}
814814

815+
#[DoesNotPerformAssertions]
816+
#[TestDox('with() can be used without expects() and is not verified when the method is not called')]
817+
public function testWithCanBeUsedWithoutExpectsAndIsNotVerifiedWhenTheMethodIsNotCalled(): void
818+
{
819+
$double = $this->createTestDouble(InterfaceWithReturnTypeDeclaration::class);
820+
821+
$double->method('doSomethingElse')->with(1)->willReturn(2);
822+
}
823+
824+
#[TestDox('with() can be used without expects() and is verified when the method is called')]
825+
public function testWithCanBeUsedWithoutExpectsAndIsVerifiedWhenTheMethodIsCalled(): void
826+
{
827+
$double = $this->createTestDouble(InterfaceWithReturnTypeDeclaration::class);
828+
829+
$double->method('doSomethingElse')->with(1)->willReturn(2);
830+
831+
$this->expectException(ExpectationFailedException::class);
832+
833+
$double->doSomethingElse(0);
834+
}
835+
815836
/**
816837
* @param class-string $type
817838
*/

0 commit comments

Comments
 (0)