review example

static::assertSame('product', $response['elements'][0]['apiAlias']);
        static::assertArrayHasKey('id', $response['elements'][0]);
        static::assertArrayHasKey('apiAlias', $response['elements'][0]);
        static::assertArrayNotHasKey('name', $response['elements'][0]);
    }

    public function testListingProductsIncludesOnlyPublicReviews(): void
    {
        $product = (new ProductBuilder($this->ids, 'p1'))
            ->visibility($this->ids->get('sales-channel'))
            ->price(10)
            ->review('test public review', 'this is a public review', 3, $this->ids->get('sales-channel'))
            ->review('test hidden review', 'this is a hidden review', 0, $this->ids->get('sales-channel'), Defaults::LANGUAGE_SYSTEM, false)
            ->build();

        $this->getContainer()->get('product.repository')
            ->upsert([$product], Context::createDefaultContext());

        $this->browser->request(
            'POST',
            '/store-api/product',
            [
                'filter' => [[
                    

    public function testInvalidation(IdsCollection $ids, \Closure $before, \Closure $after, int $calls): void
    {
        $this->getContainer()->get('cache.object')
            ->invalidateTags([CachedProductReviewRoute::ALL_TAG]);

        $products = [
            (new ProductBuilder($ids, 'product'))
                ->price(100)
                ->visibility()
                ->review('Super', 'Amazing product!!!!', 3, TestDefaults::SALES_CHANNEL, DEFAULTS::LANGUAGE_SYSTEM, false)
                ->build(),

            (new ProductBuilder($ids, 'other-product'))
                ->price(100)
                ->visibility()
                ->review('other-product', 'Amazing other-product!!!!')
                ->build(),
        ];

        $this->getContainer()->get('product.repository')
            ->upsert($products, Context::createDefaultContext());

        
->price(15)
                ->manufacturer('m1')
                ->visibility($this->ids->get('sales-channel'))
                ->build(),

            // regression test for: NEXT-17603             (new ProductBuilder($this->ids, 'with-layout'))
                ->price(100)
                ->media('m1', 1)
                ->media('m2', 2)
                ->media('m3', 3)
                ->review('Test', 'test')
                ->manufacturer('m1')
                ->crossSelling('selling', 'stream-1')
                ->visibility($this->ids->get('sales-channel'))
                ->layout('l1')
                ->build(),
        ];

        $this->getContainer()->get('product.repository')
            ->create($products, Context::createDefaultContext());
    }

    
Home | Imprint | This part of the site doesn't use cookies.