Skip to content

Commit e901757

Browse files
ACPT-1688: Fix Static Tests failures on Application-Server branch 2
1 parent 484c2a8 commit e901757

File tree

10 files changed

+41
-41
lines changed

10 files changed

+41
-41
lines changed

app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class MetricType
1414
{
1515
public const OTHER = "Other";
16-
public const SECONDSELAPSEDFLOAT = "SecondsElapsedFloat";
17-
public const UNIXTIMESTAMPFLOAT = "UnixTimestampFloat";
18-
public const MEMORYSIZEINT = "MemorySizeInt";
16+
public const SECONDS_ELAPSED_FLOAT = "SecondsElapsedFloat";
17+
public const UNIX_TIMESTAMP_FLOAT = "UnixTimestampFloat";
18+
public const MEMORY_SIZE_INT = "MemorySizeInt";
1919
}

app/code/Magento/ApplicationPerformanceMonitor/Profiler/MetricsComparator.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,103 +32,103 @@ public function compareMetrics(Metrics $beforeMetrics, Metrics $afterMetrics, ?M
3232
{
3333
$metrics = [];
3434
$metrics['memoryUsageBefore'] = $this->metricFactory->create([
35-
'type' => MetricType::MEMORYSIZEINT,
35+
'type' => MetricType::MEMORY_SIZE_INT,
3636
'name' => 'memoryUsageBefore',
3737
'value' => $beforeMetrics->getMemoryUsage(),
3838
'verbose' => true,
3939
]);
4040
$metrics['memoryUsageAfter'] = $this->metricFactory->create([
41-
'type' => MetricType::MEMORYSIZEINT,
41+
'type' => MetricType::MEMORY_SIZE_INT,
4242
'name' => 'memoryUsageAfter',
4343
'value' => $afterMetrics->getMemoryUsage(),
4444
'verbose' => false,
4545
]);
4646
if ($previousAfterMetrics) {
4747
$metrics['memoryUsageAfterComparedToPrevious'] = $this->metricFactory->create([
48-
'type' => MetricType::MEMORYSIZEINT,
48+
'type' => MetricType::MEMORY_SIZE_INT,
4949
'name' => 'memoryUsageAfterComparedToPrevious',
5050
'value' => $afterMetrics->getMemoryUsage() - $previousAfterMetrics->getMemoryUsage(),
5151
'verbose' => false,
5252
]);
5353
}
5454
$metrics['memoryUsageDelta'] = $this->metricFactory->create([
55-
'type' => MetricType::MEMORYSIZEINT,
55+
'type' => MetricType::MEMORY_SIZE_INT,
5656
'name' => 'memoryUsageDelta',
5757
'value' => $afterMetrics->getMemoryUsage() - $beforeMetrics->getMemoryUsage(),
5858
'verbose' => false,
5959
]);
6060
$metrics['peakMemoryUsageBefore'] = $this->metricFactory->create([
61-
'type' => MetricType::MEMORYSIZEINT,
61+
'type' => MetricType::MEMORY_SIZE_INT,
6262
'name' => 'peakMemoryUsageBefore',
6363
'value' => $beforeMetrics->getPeakMemoryUsage(),
6464
'verbose' => true,
6565
]);
6666
$metrics['peakMemoryUsageAfter'] = $this->metricFactory->create([
67-
'type' => MetricType::MEMORYSIZEINT,
67+
'type' => MetricType::MEMORY_SIZE_INT,
6868
'name' => 'peakMemoryUsageAfter',
6969
'value' => $afterMetrics->getPeakMemoryUsage(),
7070
'verbose' => false,
7171
]);
7272
$metrics['peakMemoryUsageDelta'] = $this->metricFactory->create([
73-
'type' => MetricType::MEMORYSIZEINT,
73+
'type' => MetricType::MEMORY_SIZE_INT,
7474
'name' => 'peakMemoryUsageDelta',
7575
'value' => $afterMetrics->getPeakMemoryUsage() - $beforeMetrics->getPeakMemoryUsage(),
7676
'verbose' => false,
7777
]);
7878
$metrics['wallTimeBefore'] = $this->metricFactory->create([
79-
'type' => MetricType::UNIXTIMESTAMPFLOAT,
79+
'type' => MetricType::UNIX_TIMESTAMP_FLOAT,
8080
'name' => 'wallTimeBefore',
8181
'value' => $beforeMetrics->getMicrotime(),
8282
'verbose' => true,
8383
]);
8484
$metrics['wallTimeAfter'] = $this->metricFactory->create([
85-
'type' => MetricType::UNIXTIMESTAMPFLOAT,
85+
'type' => MetricType::UNIX_TIMESTAMP_FLOAT,
8686
'name' => 'wallTimeAfter',
8787
'value' => $afterMetrics->getMicrotime(),
8888
'verbose' => true,
8989
]);
9090
$metrics['wallTimeElapsed'] = $this->metricFactory->create([
91-
'type' => MetricType::SECONDSELAPSEDFLOAT,
91+
'type' => MetricType::SECONDS_ELAPSED_FLOAT,
9292
'name' => 'wallTimeElapsed',
9393
'value' => $afterMetrics->getMicrotime() - $beforeMetrics->getMicrotime(),
9494
'verbose' => false,
9595
]);
9696
$metrics['userTimeBefore'] = $this->metricFactory->create([
97-
'type' => MetricType::SECONDSELAPSEDFLOAT,
97+
'type' => MetricType::SECONDS_ELAPSED_FLOAT,
9898
'name' => 'userTimeBefore',
9999
'value' => $beforeMetrics->getRusage()['ru_utime.tv_sec']
100100
+ 0.000001 * $beforeMetrics->getRusage()['ru_utime.tv_usec'],
101101
'verbose' => true,
102102
]);
103103
$metrics['userTimeAfter'] = $this->metricFactory->create([
104-
'type' => MetricType::SECONDSELAPSEDFLOAT,
104+
'type' => MetricType::SECONDS_ELAPSED_FLOAT,
105105
'name' => 'userTimeAfter',
106106
'value' => $afterMetrics->getRusage()['ru_utime.tv_sec']
107107
+ 0.000001 * $afterMetrics->getRusage()['ru_utime.tv_usec'],
108108
'verbose' => true,
109109
]);
110110
$metrics['userTimeElapsed'] = $this->metricFactory->create([
111-
'type' => MetricType::SECONDSELAPSEDFLOAT,
111+
'type' => MetricType::SECONDS_ELAPSED_FLOAT,
112112
'name' => 'userTimeElapsed',
113113
'value' => $metrics['userTimeAfter']->getValue() - $metrics['userTimeBefore']->getValue(),
114114
'verbose' => true,
115115
]);
116116
$metrics['systemTimeBefore'] = $this->metricFactory->create([
117-
'type' => MetricType::SECONDSELAPSEDFLOAT,
117+
'type' => MetricType::SECONDS_ELAPSED_FLOAT,
118118
'name' => 'systemTimeBefore',
119119
'value' => $beforeMetrics->getRusage()['ru_stime.tv_sec']
120120
+ 0.000001 * $beforeMetrics->getRusage()['ru_stime.tv_usec'],
121121
'verbose' => true,
122122
]);
123123
$metrics['systemTimeAfter'] = $this->metricFactory->create([
124-
'type' => MetricType::SECONDSELAPSEDFLOAT,
124+
'type' => MetricType::SECONDS_ELAPSED_FLOAT,
125125
'name' => 'systemTimeAfter',
126126
'value' => $afterMetrics->getRusage()['ru_stime.tv_sec']
127127
+ 0.000001 * $afterMetrics->getRusage()['ru_stime.tv_usec'],
128128
'verbose' => true,
129129
]);
130130
$metrics['systemTimeElapsed'] = $this->metricFactory->create([
131-
'type' => MetricType::SECONDSELAPSEDFLOAT,
131+
'type' => MetricType::SECONDS_ELAPSED_FLOAT,
132132
'name' => 'systemTimeElapsed',
133133
'value' => $metrics['systemTimeAfter']->getValue() - $metrics['systemTimeBefore']->getValue(),
134134
'verbose' => true,

app/code/Magento/ApplicationPerformanceMonitor/Profiler/Output/LoggerOutput.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ private function doOutputMetrics(array $metrics, bool $verbose)
8989
continue;
9090
}
9191
switch ($metric->getType()) {
92-
case MetricType::SECONDSELAPSEDFLOAT:
92+
case MetricType::SECONDS_ELAPSED_FLOAT:
9393
$prettyMetrics[$metric->getName()] = $this->prettyElapsedTime($metric->getValue());
9494
break;
95-
case MetricType::UNIXTIMESTAMPFLOAT:
95+
case MetricType::UNIX_TIMESTAMP_FLOAT:
9696
$prettyMetrics[$metric->getName()] = $this->prettyUnixTime($metric->getValue());
9797
break;
98-
case MetricType::MEMORYSIZEINT:
98+
case MetricType::MEMORY_SIZE_INT:
9999
$prettyMetrics[$metric->getName()] = $this->prettyMemorySize($metric->getValue());
100100
break;
101101
default:

dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ public function testResetAfterRequestClasses(string $className)
167167
}
168168
try {
169169
/** @var ResetAfterRequestInterface $object */
170-
$beforeProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPAREBETWEENREQUESTS);
170+
$beforeProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPARE_BETWEEN_REQUESTS);
171171
$object->_resetState();
172-
$afterProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPAREBETWEENREQUESTS);
172+
$afterProperties = $this->collector->getPropertiesFromObject($object, CompareType::COMPARE_BETWEEN_REQUESTS);
173173
$differences = [];
174174
foreach ($afterProperties as $propertyName => $propertyValue) {
175175
if ($propertyValue instanceof ObjectManagerInterface) {

lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Collector.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function __construct(
3333
SkipListAndFilterList $skipListAndFilterList
3434
) {
3535
$this->skipListFromConstructed =
36-
$skipListAndFilterList->getSkipList('', CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT);
37-
$this->skipListBetweenRequests = $skipListAndFilterList->getSkipList('', CompareType::COMPAREBETWEENREQUESTS);
36+
$skipListAndFilterList->getSkipList('', CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT);
37+
$this->skipListBetweenRequests = $skipListAndFilterList->getSkipList('', CompareType::COMPARE_BETWEEN_REQUESTS);
3838
}
3939

4040
/**
@@ -109,15 +109,15 @@ public function getSharedObjects(string $shouldResetState): array
109109
if (array_key_exists($serviceName, $sharedObjects)) {
110110
continue;
111111
}
112-
if (ShouldResetState::DORESETSTATE == $shouldResetState &&
112+
if (ShouldResetState::DO_RESET_STATE == $shouldResetState &&
113113
($object instanceof ResetAfterRequestInterface)) {
114114
$object->_resetState();
115115
}
116116
if ($object instanceof \Magento\Framework\ObjectManagerInterface) {
117117
continue;
118118
}
119119
$sharedObjects[$serviceName] =
120-
$this->getPropertiesFromObject($object, CompareType::COMPAREBETWEENREQUESTS);
120+
$this->getPropertiesFromObject($object, CompareType::COMPARE_BETWEEN_REQUESTS);
121121
}
122122
return $sharedObjects;
123123
}
@@ -145,7 +145,7 @@ public function getPropertiesConstructedAndCurrent(): array
145145
$objects[] = new CollectedObjectConstructedAndCurrent(
146146
$object,
147147
$propertiesBefore,
148-
$this->getPropertiesFromObject($object, CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT),
148+
$this->getPropertiesFromObject($object, CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT),
149149
);
150150
}
151151
return $objects;
@@ -167,7 +167,7 @@ public function getPropertiesFromObject(
167167
int $recursionLevel = 0,
168168
): CollectedObject {
169169
$className = get_class($object);
170-
$skipList = $compareType == CompareType::COMPAREBETWEENREQUESTS ?
170+
$skipList = $compareType == CompareType::COMPARE_BETWEEN_REQUESTS ?
171171
$this->skipListBetweenRequests : $this->skipListFromConstructed ;
172172
if (array_key_exists($className, $skipList)) {
173173
return CollectedObject::getSkippedObject();

lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/Comparator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
public function rememberObjectsStateBefore(bool $firstRequest): void
4242
{
4343
if ($firstRequest) {
44-
$this->objectsStateBefore = $this->collector->getSharedObjects(ShouldResetState::DONOTRESETSTATE);
44+
$this->objectsStateBefore = $this->collector->getSharedObjects(ShouldResetState::DO_NOT_RESET_STATE);
4545
}
4646
}
4747

@@ -53,7 +53,7 @@ public function rememberObjectsStateBefore(bool $firstRequest): void
5353
*/
5454
public function rememberObjectsStateAfter(bool $firstRequest): void
5555
{
56-
$this->objectsStateAfter = $this->collector->getSharedObjects(ShouldResetState::DORESETSTATE);
56+
$this->objectsStateAfter = $this->collector->getSharedObjects(ShouldResetState::DO_RESET_STATE);
5757
if ($firstRequest) {
5858
// on the end of first request add objects to init object state pool
5959
$this->objectsStateBefore = array_merge($this->objectsStateAfter, $this->objectsStateBefore);
@@ -71,7 +71,7 @@ public function rememberObjectsStateAfter(bool $firstRequest): void
7171
public function compareBetweenRequests(string $operationName): array
7272
{
7373
$compareResults = [];
74-
$skipList = $this->skipListAndFilterList->getSkipList($operationName, CompareType::COMPAREBETWEENREQUESTS);
74+
$skipList = $this->skipListAndFilterList->getSkipList($operationName, CompareType::COMPARE_BETWEEN_REQUESTS);
7575
foreach ($this->objectsStateAfter as $serviceName => $afterCollectedObject) {
7676
if (array_key_exists($serviceName, $skipList)) {
7777
continue;
@@ -101,7 +101,7 @@ public function compareConstructedAgainstCurrent(string $operationName): array
101101
{
102102
$compareResults = [];
103103
$skipList = $this->skipListAndFilterList
104-
->getSkipList($operationName, CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT);
104+
->getSkipList($operationName, CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT);
105105
foreach ($this->collector->getPropertiesConstructedAndCurrent() as $objectAndProperties) {
106106
$object = $objectAndProperties->getObject();
107107
$constructedObject = $objectAndProperties->getConstructedCollected();

lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/CompareType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
*/
1313
class CompareType
1414
{
15-
public const COMPAREBETWEENREQUESTS = "CompareBetweenRequests";
16-
public const COMPARECONSTRUCTEDAGAINSTCURRENT = "CompareConstructedAgainstCurrent";
15+
public const COMPARE_BETWEEN_REQUESTS = "CompareBetweenRequests";
16+
public const COMPARE_CONSTRUCTED_AGAINST_CURRENT = "CompareConstructedAgainstCurrent";
1717
}

lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/DynamicFactoryDecorator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(Developer $developer, ObjectManager $objectManager)
4343
$this->objectManager = $objectManager;
4444
$this->weakMap = new WeakMap();
4545
$skipListAndFilterList = new SkipListAndFilterList;
46-
$this->skipList = $skipListAndFilterList->getSkipList('', CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT);
46+
$this->skipList = $skipListAndFilterList->getSkipList('', CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT);
4747
$this->collector = new Collector($this->objectManager, $skipListAndFilterList);
4848
$this->objectManager->addSharedInstance($skipListAndFilterList, SkipListAndFilterList::class);
4949
$this->objectManager->addSharedInstance($this->collector, Collector::class);
@@ -57,7 +57,7 @@ public function create($type, array $arguments = [])
5757
$object = parent::create($type, $arguments);
5858
if (!array_key_exists(get_class($object), $this->skipList)) {
5959
$this->weakMap[$object] =
60-
$this->collector->getPropertiesFromObject($object, CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT);
60+
$this->collector->getPropertiesFromObject($object, CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT);
6161
}
6262
return $object;
6363
}

lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/ShouldResetState.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
class ShouldResetState
1111
{
12-
public const DORESETSTATE = "DoResetState";
13-
public const DONOTRESETSTATE = "DoNotResetState";
12+
public const DO_RESET_STATE = "DoResetState";
13+
public const DO_NOT_RESET_STATE = "DoNotResetState";
1414
}

lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/SkipListAndFilterList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getSkipList(string $operationName, string $compareType): array
6565
if (array_key_exists($operationName, $this->skipList)) {
6666
$skipLists[] = $this->skipList[$operationName];
6767
}
68-
if (CompareType::COMPARECONSTRUCTEDAGAINSTCURRENT == $compareType) {
68+
if (CompareType::COMPARE_CONSTRUCTED_AGAINST_CURRENT == $compareType) {
6969
if (array_key_exists($operationName . '-fromConstructed', $this->skipList)) {
7070
$skipLists[] = $this->skipList[$operationName . '-fromConstructed'];
7171
}

0 commit comments

Comments
 (0)