Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix code review notices.
  • Loading branch information
swnsma committed Nov 18, 2021
1 parent c360002 commit e6ae0ef
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
36 changes: 18 additions & 18 deletions Test/Unit/Aggregator/Category/CategoryCountAggregatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
final class CategoryCountAggregatorTest extends TestCase
{
private const METRIC_CODE = 'magento_catalog_category_count_total';
private const T_ATT = 'm2_eav_attribute';
private const T_CAT_ENT_INT = 'm2_catalog_category_entity_int';
private const T_CAT_ENT = 'm2_catalog_category_entity';
private const T_STORE_GROUP = 'm2_store_group';
private const T_STORE = 'm2_store';
private const TABLE_ATT = 'm2_eav_attribute';
private const TABLE_CAT_ENT_INT = 'm2_catalog_category_entity_int';
private const TABLE_CAT_ENT = 'm2_catalog_category_entity';
private const TABLE_STORE_GROUP = 'm2_store_group';
private const TABLE_STORE = 'm2_store';
private const LINK_FIELD = 'row_id';
private const ATTR_ID = 77;

Expand Down Expand Up @@ -90,7 +90,7 @@ private function getSelectMock(): MockObject
$select = $this->createMock(Select::class);

$select->expects($this->exactly(3))->method('from')
->withConsecutive([self::T_ATT], [self::T_ATT], [["sg" => self::T_STORE_GROUP]])->willReturn($select);
->withConsecutive([self::TABLE_ATT], [self::TABLE_ATT], [["sg" => self::TABLE_STORE_GROUP]])->willReturn($select);

$select->expects($this->exactly(4))->method('where')
->withConsecutive(
Expand All @@ -107,23 +107,23 @@ private function getSelectMock(): MockObject
$select->expects($this->exactly(3))->method('joinInner')
->withConsecutive(
[
['s' => self::T_STORE],
['s' => self::TABLE_STORE],
'sg.group_id = s.group_id'
],
[
['cce1' => self::T_CAT_ENT],
['cce1' => self::TABLE_CAT_ENT],
'sg.root_category_id = cce1.entity_id'
],
[
['cce2' => self::T_CAT_ENT],
['cce2' => self::TABLE_CAT_ENT],
"cce2.path like CONCAT(cce1.path, '%')"
]
)->willReturn($select);

$select->expects($this->exactly(4))->method('joinLeft')
->withConsecutive(
[
['ccei1' => self::T_CAT_ENT_INT],
['ccei1' => self::TABLE_CAT_ENT_INT],
sprintf(
"cce2.%s = ccei1.%s AND ccei1.attribute_id = %s AND ccei1.store_id = s.store_id",
self::LINK_FIELD,
Expand All @@ -132,7 +132,7 @@ private function getSelectMock(): MockObject
)
],
[
['ccei2' => self::T_CAT_ENT_INT],
['ccei2' => self::TABLE_CAT_ENT_INT],
sprintf(
"cce2.%s = ccei2.%s AND ccei2.attribute_id = %s AND ccei2.store_id = 0",
self::LINK_FIELD,
Expand All @@ -141,7 +141,7 @@ private function getSelectMock(): MockObject
)
],
[
['ccei3' => self::T_CAT_ENT_INT],
['ccei3' => self::TABLE_CAT_ENT_INT],
sprintf(
"cce2.%s = ccei3.%s AND ccei3.attribute_id = %s AND ccei3.store_id = s.store_id",
self::LINK_FIELD,
Expand All @@ -150,7 +150,7 @@ private function getSelectMock(): MockObject
)
],
[
['ccei4' => self::T_CAT_ENT_INT],
['ccei4' => self::TABLE_CAT_ENT_INT],
sprintf(
"cce2.%s = ccei4.%s AND ccei4.attribute_id = %s AND ccei4.store_id = 0",
self::LINK_FIELD,
Expand Down Expand Up @@ -206,11 +206,11 @@ private function getExpressionsMap(Expression $expressionMock): array
private function getTableNamesMap(): array
{
return [
['eav_attribute', self::T_ATT],
['catalog_category_entity_int', self::T_CAT_ENT_INT],
['catalog_category_entity', self::T_CAT_ENT],
['store', self::T_STORE],
['store_group', self::T_STORE_GROUP],
['eav_attribute', self::TABLE_ATT],
['catalog_category_entity_int', self::TABLE_CAT_ENT_INT],
['catalog_category_entity', self::TABLE_CAT_ENT],
['store', self::TABLE_STORE],
['store_group', self::TABLE_STORE_GROUP],
];
}

Expand Down
18 changes: 9 additions & 9 deletions Test/Unit/Aggregator/Shipment/ShipmentCountAggregatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
final class ShipmentCountAggregatorTest extends TestCase
{
private const METRIC_CODE = 'magento_shipments_count_total';
private const T_SHIP = 'm2_sales_shipment';
private const T_INV_SHIP = 'm2_inventory_shipment_source';
private const T_STORE = 'm2_store';
private const TABLE_SHIP = 'm2_sales_shipment';
private const TABLE_INV_SHIP = 'm2_inventory_shipment_source';
private const TABLE_STORE = 'm2_store';

private ShipmentCountAggregator $subject;

Expand Down Expand Up @@ -62,19 +62,19 @@ private function getSelectMock(): MockObject
$select = $this->createMock(Select::class);
$select->expects($this->once())
->method('from')
->with(['ss' => self::T_SHIP])
->with(['ss' => self::TABLE_SHIP])
->willReturn($select);

$select->expects($this->exactly(2))
->method('joinInner')
->withConsecutive(
[
['iss' => self::T_INV_SHIP],
['iss' => self::TABLE_INV_SHIP],
'ss.entity_id = iss.shipment_id',
['source_code']
],
[
['s' => self::T_STORE],
['s' => self::TABLE_STORE],
'ss.store_id = s.store_id',
['code']
]
Expand Down Expand Up @@ -110,9 +110,9 @@ public function testAggregate(): void
->method('getTableName')
->willReturnMap(
[
['sales_shipment', self::T_SHIP],
['inventory_shipment_source', self::T_INV_SHIP],
['store', self::T_STORE]
['sales_shipment', self::TABLE_SHIP],
['inventory_shipment_source', self::TABLE_INV_SHIP],
['store', self::TABLE_STORE]
]
);

Expand Down

0 comments on commit e6ae0ef

Please sign in to comment.