Skip to content

Commit 4d6f13b

Browse files
authored
Merge pull request #544 from magento-performance/ACPT-1359
ACPT-1359: Fix testObserverHasNoExtraPublicMethods test on PR
2 parents 267bcac + b12ed72 commit 4d6f13b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

dev/tests/static/testsuite/Magento/Test/Integrity/ObserverImplementationTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,19 @@ public function testObserverHasNoExtraPublicMethods()
5757
$errors = [];
5858
foreach (self::$observerClasses as $observerClass) {
5959
$reflection = (new \ReflectionClass($observerClass));
60+
$publicMethodsCount = 0;
6061
$maxCountMethod = $reflection->getConstructor() ? 2 : 1;
62+
$publicMethods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
63+
foreach ($publicMethods as $publicMethod) {
64+
if (!str_starts_with($publicMethod->getName(), '_')) {
65+
$publicMethodsCount++;
66+
}
67+
}
6168

62-
if (count($reflection->getMethods(\ReflectionMethod::IS_PUBLIC)) > $maxCountMethod) {
69+
if ($publicMethodsCount > $maxCountMethod) {
6370
$errors[] = $observerClass;
6471
}
6572
}
66-
$errors = array_diff($errors, [GetPriceConfigurationObserver::class]);
6773

6874
if ($errors) {
6975
$errors = array_unique($errors);

0 commit comments

Comments
 (0)