$this->builder =
new CheapestPriceAccessorBuilder( 1,
new NullLogger() );
} public function testWithPriceAccessor(): void
{ $priceField =
new CheapestPriceField('cheapest_price_accessor', 'cheapest_price_accessor'
);
$context = Context::
createDefaultContext();
$sql =
$this->builder->
buildAccessor('product',
$priceField,
$context, 'cheapestPrice'
);
static::
assertSame('COALESCE((ROUND((ROUND(CAST((JSON_UNQUOTE(JSON_EXTRACT(`product`.`cheapest_price_accessor`, "$.ruledefault.currencyb7d2554b0ce847cd82f3ac9bd1c0dfca.gross")) * 1) as DECIMAL(30, 20)), 2)) * 100, 0) / 100))',
$sql);
} public function testWithListPriceAccessor(): void
{ $priceField =
new CheapestPriceField('cheapest_price_accessor', 'cheapest_price_accessor'
);
$context = Context::
createDefaultContext();
$sql =
$this->builder->
buildAccessor('product',
$priceField,
$context, 'cheapestPrice.listPrice'
);