latestActivationDate example

$rule3 = new TaxRuleEntity();
        $rule3->setId('rule3');

        $collection = new TaxRuleCollection([
            $rule1,
            $rule2,
            $rule3,
        ]);

        static::assertEquals(
            $rule2,
            $collection->latestActivationDate()
        );
    }

    public function testHighestTypePosition(): void
    {
        $rule1 = new TaxRuleEntity();
        $rule1->setId('rule1');
        $rule1->setType((new TaxRuleTypeEntity())->assign(['position' => 2]));

        $rule2 = new TaxRuleEntity();
        $rule2->setId('rule2');
        
$matchingRules = new TaxRuleCollection();
            $taxRule = $taxRules->highestTypePosition();

            if (!$taxRule) {
                $tax->setRules($matchingRules);

                continue;
            }

            $taxRules = $taxRules->filterByTypePosition($taxRule->getType()->getPosition());
            $taxRule = $taxRules->latestActivationDate();

            if ($taxRule) {
                $matchingRules->add($taxRule);
            }
            $tax->setRules($matchingRules);
        }

        return new TaxCollection($taxes);
    }

    /** * @group not-deterministic * NEXT-21735 - This is covered randomly * * @codeCoverageIgnore * * @param array<string, mixed> $options */
Home | Imprint | This part of the site doesn't use cookies.