Skip to content

Commit

Permalink
Delete useless tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 4, 2021
1 parent 40e4190 commit 1f67d32
Showing 1 changed file with 0 additions and 52 deletions.
52 changes: 0 additions & 52 deletions tests/unit/Framework/TestBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
*/
namespace PHPUnit\Framework;

use function assert;
use EmptyDataProviderTest;
use ModifiedConstructorTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionClass;
use TestWithAnnotations;

Expand All @@ -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');
Expand Down

0 comments on commit 1f67d32

Please sign in to comment.