LineItemGroupPriceAscSorter example

static::assertCount(2, $generator);
    }

    /** * This test verifies that our sorters are * correctly registered in our registry. */
    public function testSortersAreRegistered(): void
    {
        $packagers = [];
        $sorters = [
            new LineItemGroupPriceAscSorter(),
        ];

        $registry = new LineItemGroupServiceRegistry($packagers$sorters);

        $generator = iterator_to_array($registry->getSorters());
        static::assertCount(1, $generator);
    }

    /** * This test verifies that we can retrieve * our packager by its key. * * @group lineitemgroup */
new ProductLineItemProvider()
        );

        $this->unitTestBuilder = new LineItemGroupBuilder(
            new LineItemGroupServiceRegistry(
                [
                    new LineItemGroupCountPackager(),
                    new LineItemGroupUnitPriceGrossPackager(),
                    new LineItemGroupUnitPriceNetPackager(),
                ],
                [
                    new LineItemGroupPriceAscSorter(),
                    new LineItemGroupPriceDescSorter(),
                ]
            ),
            new AnyRuleMatcher(new AnyRuleLineItemMatcher()),
            new LineItemQuantitySplitter($quantityPriceCalculator),
            new ProductLineItemProvider()
        );
    }

    /** * This test verifies that our extractor starts * with the sorting, then proceeds with rule matching and packagers. * This helps us to avoid any dependencies to rules inside sorters or packagers * * @group lineitemgroup */
#[Package('checkout')] class LineItemGroupPriceAscSorterTest extends TestCase
{
    use LineItemTestFixtureBehaviour;

    private LineItemGroupSorterInterface $sorter;

    protected function setUp(): void
    {
        parent::setUp();

        $this->sorter = new LineItemGroupPriceAscSorter();
    }

    /** * This test verifies that our key identifier is not touched without recognizing it. * Please keep in mind, if you change the identifier, there might still * be old keys in the SetGroup entities in the database of shops, that * try to execute a sorter that does not exist anymore with this key. * * @group lineitemgroup */
    public function testKey(): void
    {
Home | Imprint | This part of the site doesn't use cookies.