Skip to content

Commit

Permalink
Improve TestDox output
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Apr 17, 2024
1 parent 11e6f46 commit 8c7e59b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/unit/Framework/MockObject/Creation/MockBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Medium;
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\TestCase;
use PHPUnit\TestFixture\MockObject\ExtendableClass;
use PHPUnit\TestFixture\MockObject\InterfaceWithReturnTypeDeclaration;
Expand All @@ -26,6 +27,7 @@
#[Medium]
final class MockBuilderTest extends TestCase
{
#[TestDox('setMockClassName() can be used to configure the name of the mock object class')]
public function testCanCreateMockObjectWithSpecifiedClassName(): void
{
$className = 'random_' . md5((string) mt_rand());
Expand All @@ -37,6 +39,7 @@ public function testCanCreateMockObjectWithSpecifiedClassName(): void
$this->assertSame($className, $double::class);
}

#[TestDox('addMethods() can be used to configure an additional method for the mock object class when the original class does not have a method of the same name')]
public function testCanCreateMockObjectForExtendableClassWhileAddingMethodsToIt(): void
{
$double = $this->getMockBuilder(ExtendableClass::class)
Expand All @@ -50,6 +53,7 @@ public function testCanCreateMockObjectForExtendableClassWhileAddingMethodsToIt(
$this->assertSame($value, $double->additionalMethod());
}

#[TestDox('addMethods() cannot be used to configure an additional method for the mock object class when the original class has a method of the same name')]
public function testCannotCreateMockObjectForExtendableClassAddingMethodsToItThatItAlreadyHas(): void
{
$this->expectException(CannotUseAddMethodsException::class);
Expand Down

0 comments on commit 8c7e59b

Please sign in to comment.