From 6d872de4eef14729ac5f23d388b5c4f33c6776d8 Mon Sep 17 00:00:00 2001 From: yaroslavgoncharuk Date: Mon, 27 Nov 2023 17:19:29 -0600 Subject: [PATCH 1/5] ACPT-1688: Fix Static Tests failures on Application-Server branch --- .../Profiler/MetricType.php | 8 ++--- .../Profiler/MetricsComparator.php | 32 +++++++++---------- .../Profiler/Output/LoggerOutput.php | 6 ++-- .../Product/RequestDataBuilder.php | 2 ++ .../ResolverCache/MediaGalleryTest.php | 1 + .../ObjectManager/ResetAfterRequestTest.php | 4 +-- .../ApplicationStateComparator/Collector.php | 12 +++---- .../ApplicationStateComparator/Comparator.php | 8 ++--- .../CompareType.php | 4 +-- .../DynamicFactoryDecorator.php | 4 +-- .../ShouldResetState.php | 4 +-- .../SkipListAndFilterList.php | 2 +- .../_files/state-skip-list.php | 4 +++ .../Di/Code/Reader/FileClassScanner.php | 1 + 14 files changed, 50 insertions(+), 42 deletions(-) diff --git a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricType.php b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricType.php index 4b6e1310fa358..df5f3bb1c9ebc 100644 --- a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricType.php +++ b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricType.php @@ -12,8 +12,8 @@ */ class MetricType { - public const Other = "Other"; - public const SecondsElapsedFloat = "SecondsElapsedFloat"; - public const UnixTimestampFloat = "UnixTimestampFloat"; - public const MemorySizeInt = "MemorySizeInt"; + public const OTHER = "Other"; + public const SECONDSELAPSEDFLOAT = "SecondsElapsedFloat"; + public const UNIXTIMESTAMPFLOAT = "UnixTimestampFloat"; + public const MEMORYSIZEINT = "MemorySizeInt"; } diff --git a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricsComparator.php b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricsComparator.php index 849be462ccaa3..bc41f37973ed6 100644 --- a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricsComparator.php +++ b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricsComparator.php @@ -32,103 +32,103 @@ public function compareMetrics(Metrics $beforeMetrics, Metrics $afterMetrics, ?M { $metrics = []; $metrics['memoryUsageBefore'] = $this->metricFactory->create([ - 'type' => MetricType::MemorySizeInt, + 'type' => MetricType::MEMORYSIZEINT, 'name' => 'memoryUsageBefore', 'value' => $beforeMetrics->getMemoryUsage(), 'verbose' => true, ]); $metrics['memoryUsageAfter'] = $this->metricFactory->create([ - 'type' => MetricType::MemorySizeInt, + 'type' => MetricType::MEMORYSIZEINT, 'name' => 'memoryUsageAfter', 'value' => $afterMetrics->getMemoryUsage(), 'verbose' => false, ]); if ($previousAfterMetrics) { $metrics['memoryUsageAfterComparedToPrevious'] = $this->metricFactory->create([ - 'type' => MetricType::MemorySizeInt, + 'type' => MetricType::MEMORYSIZEINT, 'name' => 'memoryUsageAfterComparedToPrevious', 'value' => $afterMetrics->getMemoryUsage() - $previousAfterMetrics->getMemoryUsage(), 'verbose' => false, ]); } $metrics['memoryUsageDelta'] = $this->metricFactory->create([ - 'type' => MetricType::MemorySizeInt, + 'type' => MetricType::MEMORYSIZEINT, 'name' => 'memoryUsageDelta', 'value' => $afterMetrics->getMemoryUsage() - $beforeMetrics->getMemoryUsage(), 'verbose' => false, ]); $metrics['peakMemoryUsageBefore'] = $this->metricFactory->create([ - 'type' => MetricType::MemorySizeInt, + 'type' => MetricType::MEMORYSIZEINT, 'name' => 'peakMemoryUsageBefore', 'value' => $beforeMetrics->getPeakMemoryUsage(), 'verbose' => true, ]); $metrics['peakMemoryUsageAfter'] = $this->metricFactory->create([ - 'type' => MetricType::MemorySizeInt, + 'type' => MetricType::MEMORYSIZEINT, 'name' => 'peakMemoryUsageAfter', 'value' => $afterMetrics->getPeakMemoryUsage(), 'verbose' => false, ]); $metrics['peakMemoryUsageDelta'] = $this->metricFactory->create([ - 'type' => MetricType::MemorySizeInt, + 'type' => MetricType::MEMORYSIZEINT, 'name' => 'peakMemoryUsageDelta', 'value' => $afterMetrics->getPeakMemoryUsage() - $beforeMetrics->getPeakMemoryUsage(), 'verbose' => false, ]); $metrics['wallTimeBefore'] = $this->metricFactory->create([ - 'type' => MetricType::UnixTimestampFloat, + 'type' => MetricType::UNIXTIMESTAMPFLOAT, 'name' => 'wallTimeBefore', 'value' => $beforeMetrics->getMicrotime(), 'verbose' => true, ]); $metrics['wallTimeAfter'] = $this->metricFactory->create([ - 'type' => MetricType::UnixTimestampFloat, + 'type' => MetricType::UNIXTIMESTAMPFLOAT, 'name' => 'wallTimeAfter', 'value' => $afterMetrics->getMicrotime(), 'verbose' => true, ]); $metrics['wallTimeElapsed'] = $this->metricFactory->create([ - 'type' => MetricType::SecondsElapsedFloat, + 'type' => MetricType::SECONDSELAPSEDFLOAT, 'name' => 'wallTimeElapsed', 'value' => $afterMetrics->getMicrotime() - $beforeMetrics->getMicrotime(), 'verbose' => false, ]); $metrics['userTimeBefore'] = $this->metricFactory->create([ - 'type' => MetricType::SecondsElapsedFloat, + 'type' => MetricType::SECONDSELAPSEDFLOAT, 'name' => 'userTimeBefore', 'value' => $beforeMetrics->getRusage()['ru_utime.tv_sec'] + 0.000001 * $beforeMetrics->getRusage()['ru_utime.tv_usec'], 'verbose' => true, ]); $metrics['userTimeAfter'] = $this->metricFactory->create([ - 'type' => MetricType::SecondsElapsedFloat, + 'type' => MetricType::SECONDSELAPSEDFLOAT, 'name' => 'userTimeAfter', 'value' => $afterMetrics->getRusage()['ru_utime.tv_sec'] + 0.000001 * $afterMetrics->getRusage()['ru_utime.tv_usec'], 'verbose' => true, ]); $metrics['userTimeElapsed'] = $this->metricFactory->create([ - 'type' => MetricType::SecondsElapsedFloat, + 'type' => MetricType::SECONDSELAPSEDFLOAT, 'name' => 'userTimeElapsed', 'value' => $metrics['userTimeAfter']->getValue() - $metrics['userTimeBefore']->getValue(), 'verbose' => true, ]); $metrics['systemTimeBefore'] = $this->metricFactory->create([ - 'type' => MetricType::SecondsElapsedFloat, + 'type' => MetricType::SECONDSELAPSEDFLOAT, 'name' => 'systemTimeBefore', 'value' => $beforeMetrics->getRusage()['ru_stime.tv_sec'] + 0.000001 * $beforeMetrics->getRusage()['ru_stime.tv_usec'], 'verbose' => true, ]); $metrics['systemTimeAfter'] = $this->metricFactory->create([ - 'type' => MetricType::SecondsElapsedFloat, + 'type' => MetricType::SECONDSELAPSEDFLOAT, 'name' => 'systemTimeAfter', 'value' => $afterMetrics->getRusage()['ru_stime.tv_sec'] + 0.000001 * $afterMetrics->getRusage()['ru_stime.tv_usec'], 'verbose' => true, ]); $metrics['systemTimeElapsed'] = $this->metricFactory->create([ - 'type' => MetricType::SecondsElapsedFloat, + 'type' => MetricType::SECONDSELAPSEDFLOAT, 'name' => 'systemTimeElapsed', 'value' => $metrics['systemTimeAfter']->getValue() - $metrics['systemTimeBefore']->getValue(), 'verbose' => true, diff --git a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/Output/LoggerOutput.php b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/Output/LoggerOutput.php index 423adc8f1f228..c1cb38b27ed50 100644 --- a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/Output/LoggerOutput.php +++ b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/Output/LoggerOutput.php @@ -89,13 +89,13 @@ private function doOutputMetrics(array $metrics, bool $verbose) continue; } switch ($metric->getType()) { - case MetricType::SecondsElapsedFloat: + case MetricType::SECONDSELAPSEDFLOAT: $prettyMetrics[$metric->getName()] = $this->prettyElapsedTime($metric->getValue()); break; - case MetricType::UnixTimestampFloat: + case MetricType::UNIXTIMESTAMPFLOAT: $prettyMetrics[$metric->getName()] = $this->prettyUnixTime($metric->getValue()); break; - case MetricType::MemorySizeInt: + case MetricType::MEMORYSIZEINT: $prettyMetrics[$metric->getName()] = $this->prettyMemorySize($metric->getValue()); break; default: diff --git a/app/code/Magento/CatalogGraphQl/DataProvider/Product/RequestDataBuilder.php b/app/code/Magento/CatalogGraphQl/DataProvider/Product/RequestDataBuilder.php index ac61a41cf60e8..baca41a365e96 100644 --- a/app/code/Magento/CatalogGraphQl/DataProvider/Product/RequestDataBuilder.php +++ b/app/code/Magento/CatalogGraphQl/DataProvider/Product/RequestDataBuilder.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\CatalogGraphQl\DataProvider\Product; use Magento\Framework\ObjectManager\ResetAfterRequestInterface; diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ResolverCache/MediaGalleryTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ResolverCache/MediaGalleryTest.php index 8d32463481c26..eaaee60d8699c 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ResolverCache/MediaGalleryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ResolverCache/MediaGalleryTest.php @@ -587,6 +587,7 @@ public function testCacheIsInvalidatedOnProductDeletion() * @param ProductInterface $product * @return void * @throws \Zend_Cache_Exception + * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ private function assertCacheIdIsNotOrphanedInTagsForProduct(ProductInterface $product) { diff --git a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php index 5631fd7e50372..5039d35eac6af 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php @@ -167,9 +167,9 @@ public function testResetAfterRequestClasses(string $className) } try { /** @var ResetAfterRequestInterface $object */ - $beforeProperties = $this->collector->getPropertiesFromObject($object, CompareType::CompareBetweenRequests); + $beforeProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPAREBETWEENREQUESTS); $object->_resetState(); - $afterProperties = $this->collector->getPropertiesFromObject($object, CompareType::CompareBetweenRequests); + $afterProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPAREBETWEENREQUESTS); $differences = []; foreach ($afterProperties as $propertyName => $propertyValue) { if ($propertyValue instanceof ObjectManagerInterface) { diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Collector.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Collector.php index 1c0bc718b4b09..e71bddf610d52 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Collector.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Collector.php @@ -33,8 +33,8 @@ public function __construct( SkipListAndFilterList $skipListAndFilterList ) { $this->skipListFromConstructed = - $skipListAndFilterList->getSkipList('', CompareType::CompareConstructedAgainstCurrent); - $this->skipListBetweenRequests = $skipListAndFilterList->getSkipList('', CompareType::CompareBetweenRequests); + $skipListAndFilterList->getSkipList('', CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT); + $this->skipListBetweenRequests = $skipListAndFilterList->getSkipList('', CompareType::COMPAREBETWEENREQUESTS); } /** @@ -109,7 +109,7 @@ public function getSharedObjects(string $shouldResetState): array if (array_key_exists($serviceName, $sharedObjects)) { continue; } - if (ShouldResetState::DoResetState == $shouldResetState && + if (ShouldResetState::DORESETSTATE == $shouldResetState && ($object instanceof ResetAfterRequestInterface)) { $object->_resetState(); } @@ -117,7 +117,7 @@ public function getSharedObjects(string $shouldResetState): array continue; } $sharedObjects[$serviceName] = - $this->getPropertiesFromObject($object, CompareType::CompareBetweenRequests); + $this->getPropertiesFromObject($object, CompareType::COMPAREBETWEENREQUESTS); } return $sharedObjects; } @@ -145,7 +145,7 @@ public function getPropertiesConstructedAndCurrent(): array $objects[] = new CollectedObjectConstructedAndCurrent( $object, $propertiesBefore, - $this->getPropertiesFromObject($object, CompareType::CompareConstructedAgainstCurrent), + $this->getPropertiesFromObject($object, CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT), ); } return $objects; @@ -167,7 +167,7 @@ public function getPropertiesFromObject( int $recursionLevel = 0, ): CollectedObject { $className = get_class($object); - $skipList = $compareType == CompareType::CompareBetweenRequests ? + $skipList = $compareType == CompareType::COMPAREBETWEENREQUESTS ? $this->skipListBetweenRequests : $this->skipListFromConstructed ; if (array_key_exists($className, $skipList)) { return CollectedObject::getSkippedObject(); diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Comparator.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Comparator.php index b1f42edfbf733..ce5dfe80c27bb 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Comparator.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Comparator.php @@ -41,7 +41,7 @@ public function __construct( public function rememberObjectsStateBefore(bool $firstRequest): void { if ($firstRequest) { - $this->objectsStateBefore = $this->collector->getSharedObjects(ShouldResetState::DoNotResetState); + $this->objectsStateBefore = $this->collector->getSharedObjects(ShouldResetState::DONOTRESETSTATE); } } @@ -53,7 +53,7 @@ public function rememberObjectsStateBefore(bool $firstRequest): void */ public function rememberObjectsStateAfter(bool $firstRequest): void { - $this->objectsStateAfter = $this->collector->getSharedObjects(ShouldResetState::DoResetState); + $this->objectsStateAfter = $this->collector->getSharedObjects(ShouldResetState::DORESETSTATE); if ($firstRequest) { // on the end of first request add objects to init object state pool $this->objectsStateBefore = array_merge($this->objectsStateAfter, $this->objectsStateBefore); @@ -71,7 +71,7 @@ public function rememberObjectsStateAfter(bool $firstRequest): void public function compareBetweenRequests(string $operationName): array { $compareResults = []; - $skipList = $this->skipListAndFilterList->getSkipList($operationName, CompareType::CompareBetweenRequests); + $skipList = $this->skipListAndFilterList->getSkipList($operationName, CompareType::COMPAREBETWEENREQUESTS); foreach ($this->objectsStateAfter as $serviceName => $afterCollectedObject) { if (array_key_exists($serviceName, $skipList)) { continue; @@ -101,7 +101,7 @@ public function compareConstructedAgainstCurrent(string $operationName): array { $compareResults = []; $skipList = $this->skipListAndFilterList - ->getSkipList($operationName, CompareType::CompareConstructedAgainstCurrent); + ->getSkipList($operationName, CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT); foreach ($this->collector->getPropertiesConstructedAndCurrent() as $objectAndProperties) { $object = $objectAndProperties->getObject(); $constructedObject = $objectAndProperties->getConstructedCollected(); diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/CompareType.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/CompareType.php index a8b2bc87b6a78..7ede59906a1ef 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/CompareType.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/CompareType.php @@ -12,6 +12,6 @@ */ class CompareType { - public const CompareBetweenRequests = "CompareBetweenRequests"; - public const CompareConstructedAgainstCurrent = "CompareConstructedAgainstCurrent"; + public const COMPAREBETWEENREQUESTS = "CompareBetweenRequests"; + public const COMPARECONSTRUCTEDAGAINSTCURRENT = "CompareConstructedAgainstCurrent"; } diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/DynamicFactoryDecorator.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/DynamicFactoryDecorator.php index 972b434846e54..7843be3221799 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/DynamicFactoryDecorator.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/DynamicFactoryDecorator.php @@ -43,7 +43,7 @@ public function __construct(Developer $developer, ObjectManager $objectManager) $this->objectManager = $objectManager; $this->weakMap = new WeakMap(); $skipListAndFilterList = new SkipListAndFilterList; - $this->skipList = $skipListAndFilterList->getSkipList('', CompareType::CompareConstructedAgainstCurrent); + $this->skipList = $skipListAndFilterList->getSkipList('', CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT); $this->collector = new Collector($this->objectManager, $skipListAndFilterList); $this->objectManager->addSharedInstance($skipListAndFilterList, SkipListAndFilterList::class); $this->objectManager->addSharedInstance($this->collector, Collector::class); @@ -57,7 +57,7 @@ public function create($type, array $arguments = []) $object = parent::create($type, $arguments); if (!array_key_exists(get_class($object), $this->skipList)) { $this->weakMap[$object] = - $this->collector->getPropertiesFromObject($object, CompareType::CompareConstructedAgainstCurrent); + $this->collector->getPropertiesFromObject($object, CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT); } return $object; } diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/ShouldResetState.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/ShouldResetState.php index 0b3a79a3979ad..039ab94a160dc 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/ShouldResetState.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/ShouldResetState.php @@ -9,6 +9,6 @@ class ShouldResetState { - public const DoResetState = "DoResetState"; - public const DoNotResetState = "DoNotResetState"; + public const DORESETSTATE = "DoResetState"; + public const DONOTRESETSTATE = "DoNotResetState"; } diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php index 195b4cda1cf2b..ac8c9df86c89d 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php @@ -62,7 +62,7 @@ public function getSkipList(string $operationName, string $compareType): array if (array_key_exists($operationName, $this->skipList)) { $skipLists[] = $this->skipList[$operationName]; } - if (CompareType::CompareConstructedAgainstCurrent == $compareType) { + if (CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT == $compareType) { if (array_key_exists($operationName . '-fromConstructed', $this->skipList)) { $skipLists[] = $this->skipList[$operationName . '-fromConstructed']; } diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/_files/state-skip-list.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/_files/state-skip-list.php index 7685886faa420..554e939c95d26 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/_files/state-skip-list.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/_files/state-skip-list.php @@ -8,6 +8,7 @@ /* These classes are skipped completely during comparison. */ return [ '*' => [ + // phpcs:disable Generic.Files.LineLength.TooLong // list of the latest failures started Magento\Sales\Api\Data\ShippingAssignmentInterfaceFactory::class => null, Magento\Sales\Model\Order\ShippingBuilderFactory::class => null, @@ -358,8 +359,10 @@ 'QuoteRelationsComposite' => null, Magento\GraphQlCache\Model\Plugin\Auth\TokenIssuer::class => null, Magento\StoreGraphQl\Plugin\LocalizeEmail::class => null, + // phpcs:enable Generic.Files.LineLength.TooLong ], '*-fromConstructed' => [ + // phpcs:disable Generic.Files.LineLength.TooLong Magento\Sales\Model\ResourceModel\Grid::class => null, Magento\Sales\Model\ResourceModel\GridPool::class => null, Magento\Sales\Api\Data\OrderExtension::class => null, @@ -714,6 +717,7 @@ Magento\Staging\Model\Update\Flag::class => null, Magento\Catalog\Model\Category\Attribute\Source\Sortby::class => null, Magento\Config\App\Config\Source\EnvironmentConfigSource::class => null, + // phpcs:enable Generic.Files.LineLength.TooLong ], '' => [ ], diff --git a/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php index 94e08a0be678e..648f36d1e7489 100644 --- a/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php +++ b/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php @@ -138,6 +138,7 @@ private function extract(): string } elseif ($triggerClass && !$tokenIsArray) { $triggerClass = false; // `class` token was used as a string; not to define class + // phpstan:ignore } elseif ($triggerClass && empty($class) && $token[0] === T_DOUBLE_ARROW) { $triggerClass = false; continue; From e9017572037e8b552dfc208152e68bc4b0bb85d7 Mon Sep 17 00:00:00 2001 From: yaroslavgoncharuk Date: Tue, 28 Nov 2023 09:53:31 -0600 Subject: [PATCH 2/5] ACPT-1688: Fix Static Tests failures on Application-Server branch 2 --- .../Profiler/MetricType.php | 6 ++-- .../Profiler/MetricsComparator.php | 32 +++++++++---------- .../Profiler/Output/LoggerOutput.php | 6 ++-- .../ObjectManager/ResetAfterRequestTest.php | 4 +-- .../ApplicationStateComparator/Collector.php | 12 +++---- .../ApplicationStateComparator/Comparator.php | 8 ++--- .../CompareType.php | 4 +-- .../DynamicFactoryDecorator.php | 4 +-- .../ShouldResetState.php | 4 +-- .../SkipListAndFilterList.php | 2 +- 10 files changed, 41 insertions(+), 41 deletions(-) diff --git a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricType.php b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricType.php index df5f3bb1c9ebc..bee3af7e23097 100644 --- a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricType.php +++ b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricType.php @@ -13,7 +13,7 @@ class MetricType { public const OTHER = "Other"; - public const SECONDSELAPSEDFLOAT = "SecondsElapsedFloat"; - public const UNIXTIMESTAMPFLOAT = "UnixTimestampFloat"; - public const MEMORYSIZEINT = "MemorySizeInt"; + public const SECONDS_ELAPSED_FLOAT = "SecondsElapsedFloat"; + public const UNIX_TIMESTAMP_FLOAT = "UnixTimestampFloat"; + public const MEMORY_SIZE_INT = "MemorySizeInt"; } diff --git a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricsComparator.php b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricsComparator.php index bc41f37973ed6..b1fe19381f88c 100644 --- a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricsComparator.php +++ b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricsComparator.php @@ -32,103 +32,103 @@ public function compareMetrics(Metrics $beforeMetrics, Metrics $afterMetrics, ?M { $metrics = []; $metrics['memoryUsageBefore'] = $this->metricFactory->create([ - 'type' => MetricType::MEMORYSIZEINT, + 'type' => MetricType::MEMORY_SIZE_INT, 'name' => 'memoryUsageBefore', 'value' => $beforeMetrics->getMemoryUsage(), 'verbose' => true, ]); $metrics['memoryUsageAfter'] = $this->metricFactory->create([ - 'type' => MetricType::MEMORYSIZEINT, + 'type' => MetricType::MEMORY_SIZE_INT, 'name' => 'memoryUsageAfter', 'value' => $afterMetrics->getMemoryUsage(), 'verbose' => false, ]); if ($previousAfterMetrics) { $metrics['memoryUsageAfterComparedToPrevious'] = $this->metricFactory->create([ - 'type' => MetricType::MEMORYSIZEINT, + 'type' => MetricType::MEMORY_SIZE_INT, 'name' => 'memoryUsageAfterComparedToPrevious', 'value' => $afterMetrics->getMemoryUsage() - $previousAfterMetrics->getMemoryUsage(), 'verbose' => false, ]); } $metrics['memoryUsageDelta'] = $this->metricFactory->create([ - 'type' => MetricType::MEMORYSIZEINT, + 'type' => MetricType::MEMORY_SIZE_INT, 'name' => 'memoryUsageDelta', 'value' => $afterMetrics->getMemoryUsage() - $beforeMetrics->getMemoryUsage(), 'verbose' => false, ]); $metrics['peakMemoryUsageBefore'] = $this->metricFactory->create([ - 'type' => MetricType::MEMORYSIZEINT, + 'type' => MetricType::MEMORY_SIZE_INT, 'name' => 'peakMemoryUsageBefore', 'value' => $beforeMetrics->getPeakMemoryUsage(), 'verbose' => true, ]); $metrics['peakMemoryUsageAfter'] = $this->metricFactory->create([ - 'type' => MetricType::MEMORYSIZEINT, + 'type' => MetricType::MEMORY_SIZE_INT, 'name' => 'peakMemoryUsageAfter', 'value' => $afterMetrics->getPeakMemoryUsage(), 'verbose' => false, ]); $metrics['peakMemoryUsageDelta'] = $this->metricFactory->create([ - 'type' => MetricType::MEMORYSIZEINT, + 'type' => MetricType::MEMORY_SIZE_INT, 'name' => 'peakMemoryUsageDelta', 'value' => $afterMetrics->getPeakMemoryUsage() - $beforeMetrics->getPeakMemoryUsage(), 'verbose' => false, ]); $metrics['wallTimeBefore'] = $this->metricFactory->create([ - 'type' => MetricType::UNIXTIMESTAMPFLOAT, + 'type' => MetricType::UNIX_TIMESTAMP_FLOAT, 'name' => 'wallTimeBefore', 'value' => $beforeMetrics->getMicrotime(), 'verbose' => true, ]); $metrics['wallTimeAfter'] = $this->metricFactory->create([ - 'type' => MetricType::UNIXTIMESTAMPFLOAT, + 'type' => MetricType::UNIX_TIMESTAMP_FLOAT, 'name' => 'wallTimeAfter', 'value' => $afterMetrics->getMicrotime(), 'verbose' => true, ]); $metrics['wallTimeElapsed'] = $this->metricFactory->create([ - 'type' => MetricType::SECONDSELAPSEDFLOAT, + 'type' => MetricType::SECONDS_ELAPSED_FLOAT, 'name' => 'wallTimeElapsed', 'value' => $afterMetrics->getMicrotime() - $beforeMetrics->getMicrotime(), 'verbose' => false, ]); $metrics['userTimeBefore'] = $this->metricFactory->create([ - 'type' => MetricType::SECONDSELAPSEDFLOAT, + 'type' => MetricType::SECONDS_ELAPSED_FLOAT, 'name' => 'userTimeBefore', 'value' => $beforeMetrics->getRusage()['ru_utime.tv_sec'] + 0.000001 * $beforeMetrics->getRusage()['ru_utime.tv_usec'], 'verbose' => true, ]); $metrics['userTimeAfter'] = $this->metricFactory->create([ - 'type' => MetricType::SECONDSELAPSEDFLOAT, + 'type' => MetricType::SECONDS_ELAPSED_FLOAT, 'name' => 'userTimeAfter', 'value' => $afterMetrics->getRusage()['ru_utime.tv_sec'] + 0.000001 * $afterMetrics->getRusage()['ru_utime.tv_usec'], 'verbose' => true, ]); $metrics['userTimeElapsed'] = $this->metricFactory->create([ - 'type' => MetricType::SECONDSELAPSEDFLOAT, + 'type' => MetricType::SECONDS_ELAPSED_FLOAT, 'name' => 'userTimeElapsed', 'value' => $metrics['userTimeAfter']->getValue() - $metrics['userTimeBefore']->getValue(), 'verbose' => true, ]); $metrics['systemTimeBefore'] = $this->metricFactory->create([ - 'type' => MetricType::SECONDSELAPSEDFLOAT, + 'type' => MetricType::SECONDS_ELAPSED_FLOAT, 'name' => 'systemTimeBefore', 'value' => $beforeMetrics->getRusage()['ru_stime.tv_sec'] + 0.000001 * $beforeMetrics->getRusage()['ru_stime.tv_usec'], 'verbose' => true, ]); $metrics['systemTimeAfter'] = $this->metricFactory->create([ - 'type' => MetricType::SECONDSELAPSEDFLOAT, + 'type' => MetricType::SECONDS_ELAPSED_FLOAT, 'name' => 'systemTimeAfter', 'value' => $afterMetrics->getRusage()['ru_stime.tv_sec'] + 0.000001 * $afterMetrics->getRusage()['ru_stime.tv_usec'], 'verbose' => true, ]); $metrics['systemTimeElapsed'] = $this->metricFactory->create([ - 'type' => MetricType::SECONDSELAPSEDFLOAT, + 'type' => MetricType::SECONDS_ELAPSED_FLOAT, 'name' => 'systemTimeElapsed', 'value' => $metrics['systemTimeAfter']->getValue() - $metrics['systemTimeBefore']->getValue(), 'verbose' => true, diff --git a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/Output/LoggerOutput.php b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/Output/LoggerOutput.php index c1cb38b27ed50..2910c07a50bf2 100644 --- a/app/code/Magento/ApplicationPerformanceMonitor/Profiler/Output/LoggerOutput.php +++ b/app/code/Magento/ApplicationPerformanceMonitor/Profiler/Output/LoggerOutput.php @@ -89,13 +89,13 @@ private function doOutputMetrics(array $metrics, bool $verbose) continue; } switch ($metric->getType()) { - case MetricType::SECONDSELAPSEDFLOAT: + case MetricType::SECONDS_ELAPSED_FLOAT: $prettyMetrics[$metric->getName()] = $this->prettyElapsedTime($metric->getValue()); break; - case MetricType::UNIXTIMESTAMPFLOAT: + case MetricType::UNIX_TIMESTAMP_FLOAT: $prettyMetrics[$metric->getName()] = $this->prettyUnixTime($metric->getValue()); break; - case MetricType::MEMORYSIZEINT: + case MetricType::MEMORY_SIZE_INT: $prettyMetrics[$metric->getName()] = $this->prettyMemorySize($metric->getValue()); break; default: diff --git a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php index 5039d35eac6af..c635bdb241f2c 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php @@ -167,9 +167,9 @@ public function testResetAfterRequestClasses(string $className) } try { /** @var ResetAfterRequestInterface $object */ - $beforeProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPAREBETWEENREQUESTS); + $beforeProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPARE_BETWEEN_REQUESTS); $object->_resetState(); - $afterProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPAREBETWEENREQUESTS); + $afterProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPARE_BETWEEN_REQUESTS); $differences = []; foreach ($afterProperties as $propertyName => $propertyValue) { if ($propertyValue instanceof ObjectManagerInterface) { diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Collector.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Collector.php index e71bddf610d52..5c192aa4a2437 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Collector.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Collector.php @@ -33,8 +33,8 @@ public function __construct( SkipListAndFilterList $skipListAndFilterList ) { $this->skipListFromConstructed = - $skipListAndFilterList->getSkipList('', CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT); - $this->skipListBetweenRequests = $skipListAndFilterList->getSkipList('', CompareType::COMPAREBETWEENREQUESTS); + $skipListAndFilterList->getSkipList('', CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT); + $this->skipListBetweenRequests = $skipListAndFilterList->getSkipList('', CompareType::COMPARE_BETWEEN_REQUESTS); } /** @@ -109,7 +109,7 @@ public function getSharedObjects(string $shouldResetState): array if (array_key_exists($serviceName, $sharedObjects)) { continue; } - if (ShouldResetState::DORESETSTATE == $shouldResetState && + if (ShouldResetState::DO_RESET_STATE == $shouldResetState && ($object instanceof ResetAfterRequestInterface)) { $object->_resetState(); } @@ -117,7 +117,7 @@ public function getSharedObjects(string $shouldResetState): array continue; } $sharedObjects[$serviceName] = - $this->getPropertiesFromObject($object, CompareType::COMPAREBETWEENREQUESTS); + $this->getPropertiesFromObject($object, CompareType::COMPARE_BETWEEN_REQUESTS); } return $sharedObjects; } @@ -145,7 +145,7 @@ public function getPropertiesConstructedAndCurrent(): array $objects[] = new CollectedObjectConstructedAndCurrent( $object, $propertiesBefore, - $this->getPropertiesFromObject($object, CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT), + $this->getPropertiesFromObject($object, CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT), ); } return $objects; @@ -167,7 +167,7 @@ public function getPropertiesFromObject( int $recursionLevel = 0, ): CollectedObject { $className = get_class($object); - $skipList = $compareType == CompareType::COMPAREBETWEENREQUESTS ? + $skipList = $compareType == CompareType::COMPARE_BETWEEN_REQUESTS ? $this->skipListBetweenRequests : $this->skipListFromConstructed ; if (array_key_exists($className, $skipList)) { return CollectedObject::getSkippedObject(); diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Comparator.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Comparator.php index ce5dfe80c27bb..5823af3b39a54 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Comparator.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Comparator.php @@ -41,7 +41,7 @@ public function __construct( public function rememberObjectsStateBefore(bool $firstRequest): void { if ($firstRequest) { - $this->objectsStateBefore = $this->collector->getSharedObjects(ShouldResetState::DONOTRESETSTATE); + $this->objectsStateBefore = $this->collector->getSharedObjects(ShouldResetState::DO_NOT_RESET_STATE); } } @@ -53,7 +53,7 @@ public function rememberObjectsStateBefore(bool $firstRequest): void */ public function rememberObjectsStateAfter(bool $firstRequest): void { - $this->objectsStateAfter = $this->collector->getSharedObjects(ShouldResetState::DORESETSTATE); + $this->objectsStateAfter = $this->collector->getSharedObjects(ShouldResetState::DO_RESET_STATE); if ($firstRequest) { // on the end of first request add objects to init object state pool $this->objectsStateBefore = array_merge($this->objectsStateAfter, $this->objectsStateBefore); @@ -71,7 +71,7 @@ public function rememberObjectsStateAfter(bool $firstRequest): void public function compareBetweenRequests(string $operationName): array { $compareResults = []; - $skipList = $this->skipListAndFilterList->getSkipList($operationName, CompareType::COMPAREBETWEENREQUESTS); + $skipList = $this->skipListAndFilterList->getSkipList($operationName, CompareType::COMPARE_BETWEEN_REQUESTS); foreach ($this->objectsStateAfter as $serviceName => $afterCollectedObject) { if (array_key_exists($serviceName, $skipList)) { continue; @@ -101,7 +101,7 @@ public function compareConstructedAgainstCurrent(string $operationName): array { $compareResults = []; $skipList = $this->skipListAndFilterList - ->getSkipList($operationName, CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT); + ->getSkipList($operationName, CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT); foreach ($this->collector->getPropertiesConstructedAndCurrent() as $objectAndProperties) { $object = $objectAndProperties->getObject(); $constructedObject = $objectAndProperties->getConstructedCollected(); diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/CompareType.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/CompareType.php index 7ede59906a1ef..f9509b892f2b8 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/CompareType.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/CompareType.php @@ -12,6 +12,6 @@ */ class CompareType { - public const COMPAREBETWEENREQUESTS = "CompareBetweenRequests"; - public const COMPARECONSTRUCTEDAGAINSTCURRENT = "CompareConstructedAgainstCurrent"; + public const COMPARE_BETWEEN_REQUESTS = "CompareBetweenRequests"; + public const COMPARE_CONSTRUCTED_AGAINST_CURRENT = "CompareConstructedAgainstCurrent"; } diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/DynamicFactoryDecorator.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/DynamicFactoryDecorator.php index 7843be3221799..76169e2050271 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/DynamicFactoryDecorator.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/DynamicFactoryDecorator.php @@ -43,7 +43,7 @@ public function __construct(Developer $developer, ObjectManager $objectManager) $this->objectManager = $objectManager; $this->weakMap = new WeakMap(); $skipListAndFilterList = new SkipListAndFilterList; - $this->skipList = $skipListAndFilterList->getSkipList('', CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT); + $this->skipList = $skipListAndFilterList->getSkipList('', CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT); $this->collector = new Collector($this->objectManager, $skipListAndFilterList); $this->objectManager->addSharedInstance($skipListAndFilterList, SkipListAndFilterList::class); $this->objectManager->addSharedInstance($this->collector, Collector::class); @@ -57,7 +57,7 @@ public function create($type, array $arguments = []) $object = parent::create($type, $arguments); if (!array_key_exists(get_class($object), $this->skipList)) { $this->weakMap[$object] = - $this->collector->getPropertiesFromObject($object, CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT); + $this->collector->getPropertiesFromObject($object, CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT); } return $object; } diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/ShouldResetState.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/ShouldResetState.php index 039ab94a160dc..a2d6c1764bfe6 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/ShouldResetState.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/ShouldResetState.php @@ -9,6 +9,6 @@ class ShouldResetState { - public const DORESETSTATE = "DoResetState"; - public const DONOTRESETSTATE = "DoNotResetState"; + public const DO_RESET_STATE = "DoResetState"; + public const DO_NOT_RESET_STATE = "DoNotResetState"; } diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php index dfeebd2cfbaa5..f668eb54cd5ca 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php @@ -65,7 +65,7 @@ public function getSkipList(string $operationName, string $compareType): array if (array_key_exists($operationName, $this->skipList)) { $skipLists[] = $this->skipList[$operationName]; } - if (CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT == $compareType) { + if (CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT == $compareType) { if (array_key_exists($operationName . '-fromConstructed', $this->skipList)) { $skipLists[] = $this->skipList[$operationName . '-fromConstructed']; } From ca5505250995d708f78be388050751bc53cbc637 Mon Sep 17 00:00:00 2001 From: yaroslavgoncharuk Date: Tue, 28 Nov 2023 11:15:53 -0600 Subject: [PATCH 3/5] ACPT-1688: Fix Static Tests failures on Application-Server branch 3 --- .../Framework/ObjectManager/ResetAfterRequestTest.php | 1 + .../ApplicationStateComparator/SkipListAndFilterList.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php index c635bdb241f2c..d3da96f0fa97a 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php @@ -123,6 +123,7 @@ public function resetAfterRequestClassDataProvider() * @magentoDbIsolation disabled * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) + * @SuppressWarnings(PHPCS.Magento2.Files.LineLength.MaxExceeded) */ public function testResetAfterRequestClasses(string $className) { diff --git a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php index f668eb54cd5ca..4cea79d14dac4 100644 --- a/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php +++ b/lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php @@ -27,8 +27,8 @@ class SkipListAndFilterList */ private ?array $filterList = null; - private readonly $fixturePath = - '/dev/tests/integration/framework/Magento/TestFramework/ApplicationStateComparator/_files'; + private const FIXTURE_PATH = + "/dev/tests/integration/framework/Magento/TestFramework/ApplicationStateComparator/_files"; /** * Filters properties by the list of property filters @@ -53,7 +53,7 @@ public function getSkipList(string $operationName, string $compareType): array { if ($this->skipList === null) { $skipListList = []; - foreach (glob(BP . $fixturePath . '/state-skip-list*.php') as $skipListFile) { + foreach (glob(BP . self::FIXTURE_PATH . '/state-skip-list*.php') as $skipListFile) { $skipListList[] = include($skipListFile); } $this->skipList = array_merge_recursive(...$skipListList); @@ -85,7 +85,7 @@ public function getFilterList(): array { if ($this->filterList === null) { $filterListList = []; - foreach (glob(BP . $fixturePath . '/state-filter-list*.php') as $filterListFile) { + foreach (glob(BP . self::FIXTURE_PATH . '/state-filter-list*.php') as $filterListFile) { $filterListList[] = include($filterListFile); } $this->filterList = array_merge_recursive(...$filterListList); From 921bca9cdb8c6e0762d9a631e50fa9856557a3e2 Mon Sep 17 00:00:00 2001 From: yaroslavgoncharuk Date: Tue, 28 Nov 2023 13:01:41 -0600 Subject: [PATCH 4/5] ACPT-1688: Fix Static Tests failures on Application-Server branch 4 --- .../ObjectManager/ResetAfterRequestTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php index d3da96f0fa97a..4a751c81c3a6a 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php @@ -123,7 +123,6 @@ public function resetAfterRequestClassDataProvider() * @magentoDbIsolation disabled * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) - * @SuppressWarnings(PHPCS.Magento2.Files.LineLength.MaxExceeded) */ public function testResetAfterRequestClasses(string $className) { @@ -168,9 +167,15 @@ public function testResetAfterRequestClasses(string $className) } try { /** @var ResetAfterRequestInterface $object */ - $beforeProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPARE_BETWEEN_REQUESTS); + $beforeProperties = $this->collector->getPropertiesFromObject( + $object, + CompareType::COMPARE_BETWEEN_REQUESTS + ); $object->_resetState(); - $afterProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPARE_BETWEEN_REQUESTS); + $afterProperties = $this->collector->getPropertiesFromObject( + $object, + CompareType::COMPARE_BETWEEN_REQUESTS + ); $differences = []; foreach ($afterProperties as $propertyName => $propertyValue) { if ($propertyValue instanceof ObjectManagerInterface) { @@ -194,7 +199,10 @@ public function testResetAfterRequestClasses(string $className) // TODO: Can we convert _regionModels to member variable, // or move to a dependency injected service class instead? } - $result = $this->comparator->checkValues($beforeProperties[$propertyName] ?? null, $propertyValue, 3); + $result = $this->comparator->checkValues( + $beforeProperties[$propertyName] ?? null, + $propertyValue, 3 + ); if ($result) { $differences[$propertyName] = $result; } From dca36211645c15f96ce37d574112794aea2dae90 Mon Sep 17 00:00:00 2001 From: yaroslavgoncharuk Date: Tue, 28 Nov 2023 13:44:05 -0600 Subject: [PATCH 5/5] ACPT-1688: Fix Static Tests failures on Application-Server branch 5 --- .../Magento/Framework/ObjectManager/ResetAfterRequestTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php index 4a751c81c3a6a..6ccefb888696c 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php @@ -201,7 +201,8 @@ public function testResetAfterRequestClasses(string $className) } $result = $this->comparator->checkValues( $beforeProperties[$propertyName] ?? null, - $propertyValue, 3 + $propertyValue, + 3 ); if ($result) { $differences[$propertyName] = $result;