removeTestConditions example

$this->addTestConditions();
        static::assertGreaterThanOrEqual(1, $this->getIsNewCustomerConditions());

        $this->migration->update($this->connection);
        $this->migration->update($this->connection);
        static::assertCount(0, $this->getIsNewCustomerConditions());
        static::assertNull($this->getTestRule()['payload'], 'the migrated rule payload should be empty');
        $value = json_decode((string) $this->getDaysSinceFirstLoginConditions()['value'], true, 512, \JSON_THROW_ON_ERROR);
        static::assertEquals('=', $value['operator']);
        static::assertEquals(0, $value['daysPassed']);

        $this->removeTestConditions();
    }

    /** * @return array<string, mixed>[] */
    private function getIsNewCustomerConditions(): array
    {
        return $this->connection->fetchAllAssociative('SELECT * FROM rule_condition WHERE type = "customerIsNewCustomer"');
    }

    /** * @return array<string|int, mixed> */


    public function testUpdate(): void
    {
        $this->addTestConditions();
        static::assertGreaterThanOrEqual(1, $this->getLineItemsInCartRuleConditions());

        $this->migration->update($this->connection);
        static::assertCount(0, $this->getLineItemsInCartRuleConditions());
        static::assertNull($this->getTestRule()['payload'], 'the migrated rule payload should be empty');

        $this->removeTestConditions();
    }

    /** * @return array<string, mixed>[] */
    private function getLineItemsInCartRuleConditions(): array
    {
        return $this->connection->fetchAllAssociative('SELECT * FROM rule_condition WHERE type="cartLineItemsInCart"');
    }

    /** * @return array<string|int, mixed> */
Home | Imprint | This part of the site doesn't use cookies.