Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jun 16, 2024
1 parent ac83781 commit c15c1a9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/_files/NoTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TestFixture;

final class NoTestCase
{
}
20 changes: 20 additions & 0 deletions tests/unit/Framework/TestSuiteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\TestFixture\AbstractTestCase;
use PHPUnit\TestFixture\DependencyFailureTest;
use PHPUnit\TestFixture\DependencyOnClassTest;
use PHPUnit\TestFixture\DependencySuccessTest;
use PHPUnit\TestFixture\MultiDependencyTest;
use PHPUnit\TestFixture\NoTestCase;
use PHPUnit\TestFixture\NotPublicTestCase;
use ReflectionClass;

Expand Down Expand Up @@ -111,4 +113,22 @@ public function testResolverOnlyUsesSuitesAndCases(): void
DependencyFailureTest::class . '::class',
], $suite->requires(), 'Required test names incorrect');
}

public function testRejectsAbstractTestClass(): void
{
$suite = TestSuite::empty('the-test-suite');

$this->expectException(Exception::class);

$suite->addTestSuite(new ReflectionClass(AbstractTestCase::class));
}

public function testRejectsClassThatDoesNotExtendTestClass(): void
{
$suite = TestSuite::empty('the-test-suite');

$this->expectException(Exception::class);

$suite->addTestSuite(new ReflectionClass(NoTestCase::class));
}
}

0 comments on commit c15c1a9

Please sign in to comment.