Skip to content

Commit

Permalink
Merge branch '10.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Feb 1, 2024
2 parents 83443c7 + 204079a commit c9f35fe
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/_files/mock-object/ExtendableClass.php
Expand Up @@ -11,6 +11,10 @@

class ExtendableClass
{
public function __destruct()
{
}

public function doSomething(): bool
{
return $this->doSomethingElse();
Expand All @@ -20,4 +24,12 @@ public function doSomethingElse(): bool
{
return false;
}

final public function finalMethod(): void
{
}

private function privateMethod(): void
{
}
}
8 changes: 8 additions & 0 deletions tests/unit/Framework/MockObject/Creation/CreateMockTest.php
Expand Up @@ -15,6 +15,7 @@
use PHPUnit\Framework\MockObject\Generator\ClassIsEnumerationException;
use PHPUnit\Framework\MockObject\Generator\ClassIsFinalException;
use PHPUnit\Framework\MockObject\Generator\ClassIsReadonlyException;
use PHPUnit\Framework\MockObject\Generator\UnknownTypeException;
use PHPUnit\Framework\TestCase;
use PHPUnit\TestFixture\MockObject\AnInterface;
use PHPUnit\TestFixture\MockObject\Enumeration;
Expand Down Expand Up @@ -65,4 +66,11 @@ public function testCannotCreateMockObjectForEnumeration(): void

$this->createMock(Enumeration::class);
}

public function testCannotCreateMockObjectForUnknownType(): void
{
$this->expectException(UnknownTypeException::class);

$this->createMock('this\does\not\exist');
}
}
8 changes: 8 additions & 0 deletions tests/unit/Framework/MockObject/Creation/CreateStubTest.php
Expand Up @@ -15,6 +15,7 @@
use PHPUnit\Framework\MockObject\Generator\ClassIsEnumerationException;
use PHPUnit\Framework\MockObject\Generator\ClassIsFinalException;
use PHPUnit\Framework\MockObject\Generator\ClassIsReadonlyException;
use PHPUnit\Framework\MockObject\Generator\UnknownTypeException;
use PHPUnit\Framework\TestCase;
use PHPUnit\TestFixture\MockObject\AnInterface;
use PHPUnit\TestFixture\MockObject\Enumeration;
Expand Down Expand Up @@ -65,4 +66,11 @@ public function testCannotCreateTestStubForEnumeration(): void

$this->createStub(Enumeration::class);
}

public function testCannotCreateTestStubForUnknownType(): void
{
$this->expectException(UnknownTypeException::class);

$this->createStub('this\does\not\exist');
}
}

0 comments on commit c9f35fe

Please sign in to comment.