getExpectedFilter example


    public function testCriteria(): void
    {
        $codes = ['code-123'];

        $template = new PermittedIndividualCodePromotions($codes$this->salesChannel->getId());

        static::assertEquals($this->getExpectedFilter($codes)->getQueries()$template->getQueries());
    }

    /** * @param list<string> $codes */
    private function getExpectedFilter(array $codes): MultiFilter
    {
        return new MultiFilter(
            MultiFilter::CONNECTION_AND,
            [
                new EqualsFilter('active', true),
                

    public function testCriteria(): void
    {
        $codes = ['code-123'];

        $template = new PermittedGlobalCodePromotions($codes$this->salesChannel->getId());

        static::assertEquals($this->getExpectedFilter($codes)->getQueries()$template->getQueries());
    }

    /** * @param list<string> $codes */
    private function getExpectedFilter(array $codes): MultiFilter
    {
        return new MultiFilter(
            MultiFilter::CONNECTION_AND,
            [new EqualsFilter('active', true),
                new EqualsFilter('promotion.salesChannels.salesChannelId', $this->salesChannel->getId()),
                
/** * This test verifies, that we get the * expected and defined criteria from the template. * * @group promotions */
    public function testCriteria(): void
    {
        $template = new PermittedAutomaticPromotions($this->salesChannel->getId());

        static::assertEquals($this->getExpectedFilter()->getQueries()$template->getQueries());
    }

    private function getExpectedFilter(): MultiFilter
    {
        return new MultiFilter(
            MultiFilter::CONNECTION_AND,
            [
                new EqualsFilter('active', true),
                new EqualsFilter('promotion.salesChannels.salesChannelId', $this->salesChannel->getId()),
                // yes, i know, this is not the best isolation, but its actually what we want                 new ActiveDateRange(),
                
Home | Imprint | This part of the site doesn't use cookies.