hasFoundItems example


    /** * This test verifies that our functions does * correctly return false if we dont have any existing entries. * * @group lineitemgroup */
    public function testHasItemsOnEmptyList(): void
    {
        $result = new LineItemGroupBuilderResult();

        static::assertFalse($result->hasFoundItems());
    }

    /** * This test verifies that we really search for items * in our hasFoundItems function. * If we have found groups, but no items in there, it should * also return FALSE. * * @group lineitemgroup */
    public function testHasItemsOnGroupWithNoResults(): void
    {
if (!$builder instanceof LineItemGroupBuilder) {
            return false;
        }

        $results = $builder->findGroupPackages(
            [$groupDefinition],
            $scope->getCart(),
            $scope->getSalesChannelContext()
        );

        return $results->hasFoundItems();
    }

    public function getConstraints(): array
    {
        return [
            'groupId' => RuleConstraints::string(),
            'packagerKey' => RuleConstraints::string(),
            'value' => RuleConstraints::float(),
            'sorterKey' => RuleConstraints::string(),
            'rules' => [new NotBlank()new Type('container')],
        ];
    }
Home | Imprint | This part of the site doesn't use cookies.