diff --git a/tests/unit/Framework/TestBuilderTest.php b/tests/unit/Framework/TestBuilderTest.php index 09adbc27692..73edcb5f4f7 100644 --- a/tests/unit/Framework/TestBuilderTest.php +++ b/tests/unit/Framework/TestBuilderTest.php @@ -9,10 +9,8 @@ */ namespace PHPUnit\Framework; -use function assert; use EmptyDataProviderTest; use ModifiedConstructorTestCase; -use PHPUnit\Framework\MockObject\MockObject; use ReflectionClass; use TestWithAnnotations; @@ -21,56 +19,6 @@ */ final class TestBuilderTest extends TestCase { - public function testCreateTestForConstructorlessTestClass(): void - { - $reflector = $this->getMockBuilder(ReflectionClass::class) - ->setConstructorArgs([$this]) - ->getMock(); - - assert($reflector instanceof MockObject); - assert($reflector instanceof ReflectionClass); - - $reflector->expects($this->once()) - ->method('getConstructor') - ->willReturn(null); - - $reflector->expects($this->once()) - ->method('isInstantiable') - ->willReturn(true); - - $reflector->expects($this->once()) - ->method('getName') - ->willReturn(__CLASS__); - - $this->expectException(Exception::class); - $this->expectExceptionMessage('No valid test provided.'); - - (new TestBuilder)->build($reflector, 'TestForConstructorlessTestClass'); - } - - public function testCreateTestForNotInstantiableTestClass(): void - { - $reflector = $this->getMockBuilder(ReflectionClass::class) - ->setConstructorArgs([$this]) - ->getMock(); - - assert($reflector instanceof MockObject); - assert($reflector instanceof ReflectionClass); - - $reflector->expects($this->once()) - ->method('isInstantiable') - ->willReturn(false); - - $reflector->expects($this->once()) - ->method('getName') - ->willReturn('foo'); - - $test = (new TestBuilder)->build($reflector, 'TestForNonInstantiableTestClass'); - $this->assertInstanceOf(WarningTestCase::class, $test); - /* @var WarningTestCase $test */ - $this->assertSame('Cannot instantiate class "foo".', $test->getMessage()); - } - public function testCreateTestForTestClassWithModifiedConstructor(): void { $test = (new TestBuilder)->build(new ReflectionClass(ModifiedConstructorTestCase::class), 'testCase');