Skip to content

Commit a8d13e5

Browse files
Changed according PHPUnit version.
1 parent e4e150a commit a8d13e5

File tree

2 files changed

+46
-16
lines changed

2 files changed

+46
-16
lines changed

app/code/Magento/Catalog/Test/Unit/Cron/DeleteAbandonedStoreFlatTablesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* @covers \Magento\Catalog\Cron\DeleteAbandonedStoreFlatTables
1515
*/
16-
class AvailabilityCheckerTest extends \PHPUnit\Framework\TestCase
16+
class AvailabilityCheckerTest extends \PHPUnit_Framework_TestCase
1717
{
1818
/**
1919
* Testable Object

app/code/Magento/Catalog/Test/Unit/Cron/DeleteOutdatedPriceValuesTest.php

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/**
2121
* @covers \Magento\Catalog\Cron\DeleteOutdatedPriceValues
2222
*/
23-
class DeleteOutdatedPriceValuesTest extends \PHPUnit\Framework\TestCase
23+
class DeleteOutdatedPriceValuesTest extends \PHPUnit_Framework_TestCase
2424
{
2525
/**
2626
* Testable Object
@@ -90,20 +90,43 @@ public function testExecute()
9090
$attributeId = 15;
9191
$conditions = ['first', 'second'];
9292

93-
$this->scopeConfigMock->expects($this->once())->method('getValue')->with(Store::XML_PATH_PRICE_SCOPE)
93+
$this->scopeConfigMock
94+
->expects($this->once())
95+
->method('getValue')
96+
->with(Store::XML_PATH_PRICE_SCOPE)
9497
->willReturn(Store::XML_PATH_PRICE_SCOPE);
95-
$this->attributeRepositoryMock->expects($this->once())->method('get')
98+
$this->attributeRepositoryMock
99+
->expects($this->once())
100+
->method('get')
96101
->with(ProductAttributeInterface::ENTITY_TYPE_CODE, ProductAttributeInterface::CODE_PRICE)
97102
->willReturn($this->attributeMock);
98-
$this->attributeMock->expects($this->once())->method('getId')->willReturn($attributeId);
99-
$this->attributeMock->expects($this->once())->method('getBackend')->willReturn($this->attributeBackendMock);
100-
$this->attributeBackendMock->expects($this->once())->method('getTable')->willReturn($table);
101-
$this->resourceConnectionMock->expects($this->once())->method('getConnection')->willReturn($this->dbAdapterMock);
102-
$this->dbAdapterMock->expects($this->exactly(2))->method('quoteInto')->willReturnMap([
103-
['attribute_id = ?', $attributeId, null, null, $conditions[0]],
104-
['store_id != ?', Store::DEFAULT_STORE_ID, null, null, $conditions[1]],
105-
]);
106-
$this->dbAdapterMock->expects($this->once())->method('delete')->with($table, $conditions);
103+
$this->attributeMock
104+
->expects($this->once())
105+
->method('getId')
106+
->willReturn($attributeId);
107+
$this->attributeMock
108+
->expects($this->once())
109+
->method('getBackend')
110+
->willReturn($this->attributeBackendMock);
111+
$this->attributeBackendMock
112+
->expects($this->once())
113+
->method('getTable')
114+
->willReturn($table);
115+
$this->resourceConnectionMock
116+
->expects($this->once())
117+
->method('getConnection')
118+
->willReturn($this->dbAdapterMock);
119+
$this->dbAdapterMock
120+
->expects($this->exactly(2))
121+
->method('quoteInto')
122+
->willReturnMap([
123+
['attribute_id = ?', $attributeId, null, null, $conditions[0]],
124+
['store_id != ?', Store::DEFAULT_STORE_ID, null, null, $conditions[1]],
125+
]);
126+
$this->dbAdapterMock
127+
->expects($this->once())
128+
->method('delete')
129+
->with($table, $conditions);
107130
$this->deleteOutdatedPriceValues->execute();
108131
}
109132

@@ -115,10 +138,17 @@ public function testExecute()
115138
*/
116139
public function testExecutePriceConfigIsNotSetToGlobal()
117140
{
118-
$this->scopeConfigMock->expects($this->once())->method('getValue')->with(Store::XML_PATH_PRICE_SCOPE)
141+
$this->scopeConfigMock
142+
->expects($this->once())
143+
->method('getValue')
144+
->with(Store::XML_PATH_PRICE_SCOPE)
119145
->willReturn(null);
120-
$this->attributeRepositoryMock->expects($this->never())->method('get');
121-
$this->dbAdapterMock->expects($this->never())->method('delete');
146+
$this->attributeRepositoryMock
147+
->expects($this->never())
148+
->method('get');
149+
$this->dbAdapterMock
150+
->expects($this->never())
151+
->method('delete');
122152

123153
$this->deleteOutdatedPriceValues->execute();
124154
}

0 commit comments

Comments
 (0)