private $productSortingRepository;
protected function setUp(): void
{ parent::
setUp();
$this->productSortingRepository =
$this->
getContainer()->
get('product_sorting.repository'
);
} public function testProductSortingFieldPriority(): void
{ $productSortingEntity =
new ProductSortingEntity();
$productSortingEntity->
setFields( [ ['field' => 'product.name', 'order' => 'asc', 'priority' => 1, 'naturalSorting' => 1
],
['field' => 'product.cheapestPrice', 'order' => 'asc', 'priority' => 1000, 'naturalSorting' => 1
],
] );
/** @var FieldSorting[] $sortings */
$sortings =
$productSortingEntity->
createDalSorting();
static::
assertCount(2,
$sortings);
static::
assertEquals('product.cheapestPrice',
$sortings[0
]->
getField());