Skip to content

Commit 7ff3c2c

Browse files
committed
Merge remote-tracking branch 'origin/MC-33069-CE-4' into MC-33069
2 parents 46fb116 + fc0f0cb commit 7ff3c2c

File tree

6 files changed

+56
-14
lines changed

6 files changed

+56
-14
lines changed

app/code/Magento/SalesRule/Test/Unit/Model/ResourceModel/Report/CollectionTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ public function testApplyRulesFilterWithRulesList()
177177

178178
$this->selectMock->expects($this->at(3))
179179
->method('where')
180-
->with(implode([
181-
'test_1',
182-
'test_2',
183-
], ' OR '));
180+
->with(implode(' OR ', ['test_1', 'test_2']));
184181

185182
$ruleMock = $this->getRuleMock();
186183
$ruleMock->expects($this->once())

app/code/Magento/SalesRule/Test/Unit/Model/Rule/Action/Discount/CartFixedTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ protected function setUp(): void
118118
*/
119119
public function testCalculate()
120120
{
121+
$ruleItemTotals = [
122+
'items_price' => 100,
123+
'base_items_price' => 100,
124+
'items_count' => 1,
125+
];
126+
121127
$this->rule->setData(['id' => 1, 'discount_amount' => 10.0]);
122128

123129
$this->quote->expects($this->any())->method('getCartFixedRules')->willReturn([]);
@@ -126,6 +132,11 @@ public function testCalculate()
126132
$this->priceCurrency->expects($this->atLeastOnce())->method('round')->willReturnArgument(0);
127133
$this->quote->expects($this->any())->method('getStore')->willReturn($store);
128134

135+
$this->validator->expects($this->once())
136+
->method('getRuleItemTotalsInfo')
137+
->with($this->rule->getId())
138+
->willReturn($ruleItemTotals);
139+
129140
/** validators data */
130141
$this->validator->expects(
131142
$this->once()

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/MemoryLimitTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ public function testPrintStats()
1818
{
1919
$object = $this->_createObject(0, 0);
2020
$result = $object->printStats();
21-
$this->assertContains('Memory usage (OS):', $result);
22-
$this->assertContains('1.00M', $result);
23-
$this->assertContains('Estimated memory leak:', $result);
24-
$this->assertContains('reported by PHP', $result);
21+
$this->assertStringContainsString('Memory usage (OS):', $result);
22+
$this->assertStringContainsString('1.00M', $result);
23+
$this->assertStringContainsString('Estimated memory leak:', $result);
24+
$this->assertStringContainsString('reported by PHP', $result);
2525
$this->assertStringEndsWith(PHP_EOL, $result);
2626

2727
$object = $this->_createObject('2M', 0);
28-
$this->assertContains('50.00% of configured 2.00M limit', $object->printStats());
28+
$this->assertStringContainsString('50.00% of configured 2.00M limit', $object->printStats());
2929

3030
$object = $this->_createObject(0, '500K');
31-
$this->assertContains('% of configured 0.49M limit', $object->printStats());
31+
$this->assertStringContainsString('% of configured 0.49M limit', $object->printStats());
3232
}
3333

3434
public function testValidateUsage()

lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ protected function _getGetMethod()
246246
'parameters' => [
247247
[
248248
'name' => 'id',
249-
'type' => $parameterReflection->getType(),
249+
'type' => $this->getTypeHintText($parameterReflection->getType()),
250250
],
251251
],
252252
'body' => $body,
253-
'returnType' => $methodReflection->getReturnType(),
253+
'returnType' => $this->getTypeHintText($methodReflection->getReturnType()),
254254
'docblock' => [
255255
'shortDescription' => 'load entity',
256256
'tags' => [
@@ -722,9 +722,9 @@ private function getMethodParamAndReturnType($methodName)
722722
if (!empty($params[0])) {
723723
/** @var ParameterReflection $parameterReflection */
724724
$parameterReflection = $params[0];
725-
$result['paramType'] = $parameterReflection->getType();
725+
$result['paramType'] = $this->getTypeHintText($parameterReflection->getType());
726726
}
727-
$result['returnType'] = $methodReflection->getReturnType();
727+
$result['returnType'] = $this->getTypeHintText($methodReflection->getReturnType());
728728

729729
return $result;
730730
}
@@ -742,4 +742,15 @@ private function getClassMethods($name)
742742
}
743743
return $this->methodList;
744744
}
745+
746+
/**
747+
* Get the text of the type hint.
748+
*
749+
* @param \ReflectionType|null $type
750+
* @return string|null
751+
*/
752+
private function getTypeHintText($type)
753+
{
754+
return $type instanceof \ReflectionType ? $type->getName() : $type;
755+
}
745756
}

lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchIteratorTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@ public function testCurrent()
9797
$this->selectMock->expects($this->once())->method('where')->with($filed . ' > ?', 0);
9898
$this->selectMock->expects($this->once())->method('limit')->with($this->batchSize);
9999
$this->selectMock->expects($this->once())->method('order')->with($filed . ' ASC');
100+
$this->wrapperSelectMock->expects($this->once())
101+
->method('from')
102+
->with(
103+
$this->selectMock,
104+
[
105+
new \Zend_Db_Expr('MAX(' . $this->rangeFieldAlias . ') as max'),
106+
new \Zend_Db_Expr('COUNT(*) as cnt'),
107+
]
108+
);
109+
$this->connectionMock->expects($this->once())
110+
->method('fetchRow')
111+
->with($this->wrapperSelectMock)
112+
->willReturn(['max' => 10, 'cnt' => 10]);
100113
$this->assertEquals($this->selectMock, $this->model->current());
101114
$this->assertEquals($this->selectMock, $this->model->current());
102115
$this->assertEquals(0, $this->model->key());

lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchRangeIteratorTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ public function testCurrent()
9999
{
100100
$this->selectMock->expects($this->once())->method('limit')->with($this->batchSize, $this->currentBatch);
101101
$this->selectMock->expects($this->once())->method('order')->with('correlationName.rangeField' . ' ASC');
102+
$this->wrapperSelectMock->expects($this->once())
103+
->method('from')
104+
->with(
105+
$this->selectMock,
106+
[new \Zend_Db_Expr('COUNT(*) as cnt')]
107+
);
108+
$this->connectionMock->expects($this->once())
109+
->method('fetchRow')
110+
->with($this->wrapperSelectMock)
111+
->willReturn(['cnt' => 10]);
102112
$this->assertEquals($this->selectMock, $this->model->current());
103113
$this->assertEquals(0, $this->model->key());
104114
}

0 commit comments

Comments
 (0)