Skip to content

Commit b03b938

Browse files
Merge branch '8.5' into 9.3
2 parents b77f2da + 155e5b0 commit b03b938

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

src/Framework/TestSuite.php

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ public function __construct($theClass = '', string $name = '')
228228
continue;
229229
}
230230

231+
if (!TestUtil::isTestMethod($method)) {
232+
continue;
233+
}
234+
231235
$this->addTestMethod($theClass, $method);
232236
}
233237

@@ -866,26 +870,8 @@ protected function createResult(): TestResult
866870
*/
867871
protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method): void
868872
{
869-
if (!TestUtil::isTestMethod($method)) {
870-
return;
871-
}
872-
873873
$methodName = $method->getName();
874874

875-
if (!$method->isPublic()) {
876-
$this->addTest(
877-
new WarningTestCase(
878-
sprintf(
879-
'Test method "%s" in test class "%s" is not public.',
880-
$methodName,
881-
$class->getName()
882-
)
883-
)
884-
);
885-
886-
return;
887-
}
888-
889875
$test = (new TestBuilder)->build($class, $methodName);
890876

891877
if ($test instanceof TestCase || $test instanceof DataProviderTestSuite) {

src/Util/Test.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,10 @@ public static function getHookMethods(string $className): array
560560

561561
public static function isTestMethod(ReflectionMethod $method): bool
562562
{
563+
if (!$method->isPublic()) {
564+
return false;
565+
}
566+
563567
if (strpos($method->getName(), 'test') === 0) {
564568
return true;
565569
}

tests/unit/Framework/TestSuiteTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testNotPublicTestCase(): void
103103
{
104104
$suite = new TestSuite(NotPublicTestCase::class);
105105

106-
$this->assertCount(2, $suite);
106+
$this->assertCount(1, $suite);
107107
}
108108

109109
public function testNotVoidTestCase(): void

0 commit comments

Comments
 (0)