getLinked example

/** @var ProductCollection $products */
        $products = $result->getEntities();

        static::assertTrue($products->has('bf44b430d7cd47fcac93310edf4fe4e1'));
        $firstProduct = $products->get('bf44b430d7cd47fcac93310edf4fe4e1');
        static::assertInstanceOf(PriceCollection::class$firstProduct->getPrice());
        static::assertInstanceOf(Price::class$firstProduct->getPrice()->first());
        $firstListPrice = $firstProduct->getPrice()->first()->getListPrice();
        static::assertInstanceOf(Price::class$firstListPrice);
        static::assertSame(100.0, $firstListPrice->getNet());
        static::assertSame(5000.0, $firstListPrice->getGross());
        static::assertFalse($firstListPrice->getLinked());

        static::assertTrue($products->has('bf44b430d7cd47fcac93310edf4fe4e2'));
        $secondProduct = $products->get('bf44b430d7cd47fcac93310edf4fe4e2');
        static::assertInstanceOf(PriceCollection::class$secondProduct->getPrice());
        static::assertInstanceOf(Price::class$secondProduct->getPrice()->first());
        $secondListPrice = $secondProduct->getPrice()->first()->getListPrice();
        static::assertInstanceOf(Price::class$secondListPrice);
        static::assertSame(20.0, $secondListPrice->getNet());
        static::assertSame(50.0, $secondListPrice->getGross());
        static::assertTrue($secondListPrice->getLinked());
    }

    
$stubs = new ScriptPriceStubs($connection$this->createMock(QuantityPriceCalculator::class)$this->createMock(PercentagePriceCalculator::class));

        $actual = $stubs->build($prices);

        foreach ($expected as $expectedPrice) {
            $actualPrice = $actual->getCurrencyPrice($expectedPrice->getCurrencyId());

            static::assertInstanceOf(Price::class$actualPrice);
            static::assertEquals($expectedPrice->getNet()$actualPrice->getNet());
            static::assertEquals($expectedPrice->getGross()$actualPrice->getGross());
            static::assertEquals($expectedPrice->getLinked()$actualPrice->getLinked());
        }
    }

    public static function priceCases(): \Generator
    {
        yield 'manual price definition' => [
            [
                'default' => ['gross' => 100, 'net' => 90],
                'USD' => ['gross' => 90, 'net' => 80],
            ],
            new PriceCollection([
                
Home | Imprint | This part of the site doesn't use cookies.