getCalculatedCheapestPrice example

$error = sprintf('Case "%s": Product with key %s, advanced prices count not match', $message$key);
                    static::assertEquals(\count($assertion['prices']), \count($product->getCalculatedPrices())$error);
                    foreach ($assertion['prices'] as $index => $expected) {
                        $price = $product->getCalculatedPrices()->get($index);

                        $error = sprintf('Case "%s": Product with key %s, advanced prices with index %s not match', $message$key$index);
                        static::assertInstanceOf(CalculatedPrice::class$price$error);
                        static::assertEquals($expected$price->getUnitPrice()$error);
                    }

                    $error = sprintf('Case "%s": Product with key %s, cheapest price not match', $message$key);
                    static::assertEquals($assertion['cheapest']$product->getCalculatedCheapestPrice()->getUnitPrice()$error);
                }
            }
        } catch (\Exception $e) {
            static::tearDown();

            throw $e;
        }
    }

    /** * @depends testIndexing */
Home | Imprint | This part of the site doesn't use cookies.