DaysSinceFirstLoginRule example


class DaysSinceFirstLoginRuleTest extends TestCase
{
    protected DaysSinceFirstLoginRule $rule;

    protected function setUp(): void
    {
        $this->rule = new DaysSinceFirstLoginRule();
    }

    public function testGetName(): void
    {
        static::assertSame('customerDaysSinceFirstLogin', $this->rule->getName());
    }

    public function testInvalidCombinationOfValueAndOperator(): void
    {
        $this->expectException(UnsupportedValueException::class);
        $this->rule->assign([
            

        );

        $ids = $this->ruleRepository->searchIds($criteria$context->getContext());

        if (!empty($ids->getIds())) {
            return;
        }

        $pool = [
            [
                'rule' => (new DaysSinceFirstLoginRule())->assign(['daysPassed' => 0]),
                'name' => 'New customer',
            ],
            [
                'rule' => (new DateRangeRule())->assign(['fromDate' => new \DateTime(), 'toDate' => (new \DateTime())->modify('+2 day')]),
                'name' => 'Next two days',
            ],
            [
                'rule' => (new GoodsPriceRule())->assign(['amount' => 5000, 'operator' => GoodsPriceRule::OPERATOR_GTE]),
                'name' => 'Cart >= 5000',
            ],
            [
                
Home | Imprint | This part of the site doesn't use cookies.