Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 13, 2024
1 parent cac7631 commit 0c843b0
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Medium;
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\MockObject\Generator\DuplicateMethodException;
use PHPUnit\Framework\TestCase;
use PHPUnit\TestFixture\MockObject\ExtendableClass;
use ReflectionProperty;
Expand All @@ -32,6 +33,14 @@ public function testCreatesPartialMockObjectForExtendableClass(): void
$this->assertTrue($mock->doSomething());
}

public function testCannotCreatePartialMockObjectForExtendableClassWithDuplicateMethods(): void
{
$this->expectException(DuplicateMethodException::class);
$this->expectExceptionMessage('Cannot double using a method list that contains duplicates: "doSomethingElse, doSomethingElse" (duplicate: "doSomethingElse")');

$this->createPartialMock(ExtendableClass::class, ['doSomethingElse', 'doSomethingElse']);
}

public function testMethodOfPartialMockThatIsNotConfigurableCannotBeConfigured(): void
{
$mock = $this->createPartialMock(ExtendableClass::class, ['doSomethingElse']);
Expand Down

0 comments on commit 0c843b0

Please sign in to comment.