Skip to content

Commit 713cf8a

Browse files
Merge branch '11.2'
2 parents 992911f + c211886 commit 713cf8a

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

src/Framework/MockObject/Runtime/Api/MutableStubApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ public function __phpunit_state(): TestDoubleState
2626
/** @noinspection MagicMethodsValidityInspection */
2727
public function __phpunit_getInvocationHandler(): InvocationHandler
2828
{
29-
return $this->__phpunit_state->invocationHandler();
29+
return $this->__phpunit_state()->invocationHandler();
3030
}
3131

3232
/** @noinspection MagicMethodsValidityInspection */
3333
public function __phpunit_unsetInvocationMocker(): void
3434
{
35-
$this->__phpunit_state->unsetInvocationHandler();
35+
$this->__phpunit_state()->unsetInvocationHandler();
3636
}
3737
}

src/Framework/MockObject/Runtime/Api/StubApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public function __phpunit_state(): TestDoubleState
2424
/** @noinspection MagicMethodsValidityInspection */
2525
public function __phpunit_getInvocationHandler(): InvocationHandler
2626
{
27-
return $this->__phpunit_state->invocationHandler();
27+
return $this->__phpunit_state()->invocationHandler();
2828
}
2929

3030
/** @noinspection MagicMethodsValidityInspection */
3131
public function __phpunit_unsetInvocationMocker(): void
3232
{
33-
$this->__phpunit_state->unsetInvocationHandler();
33+
$this->__phpunit_state()->unsetInvocationHandler();
3434
}
3535
}

tests/_files/NoTestCase.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture;
11+
12+
final class NoTestCase
13+
{
14+
}

tests/unit/Framework/TestSuiteTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111

1212
use PHPUnit\Framework\Attributes\CoversClass;
1313
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\TestFixture\AbstractTestCase;
1415
use PHPUnit\TestFixture\DependencyFailureTest;
1516
use PHPUnit\TestFixture\DependencyOnClassTest;
1617
use PHPUnit\TestFixture\DependencySuccessTest;
1718
use PHPUnit\TestFixture\MultiDependencyTest;
19+
use PHPUnit\TestFixture\NoTestCase;
1820
use PHPUnit\TestFixture\NotPublicTestCase;
1921
use ReflectionClass;
2022

@@ -113,4 +115,22 @@ public function testResolverOnlyUsesSuitesAndCases(): void
113115
DependencyFailureTest::class . '::class',
114116
], $suite->requires(), 'Required test names incorrect');
115117
}
118+
119+
public function testRejectsAbstractTestClass(): void
120+
{
121+
$suite = TestSuite::empty('the-test-suite');
122+
123+
$this->expectException(Exception::class);
124+
125+
$suite->addTestSuite(new ReflectionClass(AbstractTestCase::class));
126+
}
127+
128+
public function testRejectsClassThatDoesNotExtendTestClass(): void
129+
{
130+
$suite = TestSuite::empty('the-test-suite');
131+
132+
$this->expectException(Exception::class);
133+
134+
$suite->addTestSuite(new ReflectionClass(NoTestCase::class));
135+
}
116136
}

0 commit comments

Comments
 (0)