createProductKeywordDictionary example

$product = (new ProductBuilder($ids, 'test'))->price(100)->build();

        $this->getContainer()->get('product.repository')->create([$product]$context);

        $this->getContainer()->get(Connection::class)->executeStatement('DELETE FROM product_keyword_dictionary');

        $productId = Uuid::fromHexToBytes($product['id']);
        $this->createProductSearchKeyword('test 1', $productId$now$context);
        $this->createProductSearchKeyword('test 2', $productId$now$context);

        $this->createProductKeywordDictionary('test 1');
        $this->createProductKeywordDictionary('test 2');
        $this->createProductKeywordDictionary('test 3');
        $this->createProductKeywordDictionary('test 4');

        $this->handler->run();

        $keywordDictionaries = $this->getContainer()->get(Connection::class)
            ->fetchFirstColumn('SELECT keyword FROM product_keyword_dictionary');

        static::assertCount(2, $keywordDictionaries);
        static::assertContains('test 1', $keywordDictionaries);
        
Home | Imprint | This part of the site doesn't use cookies.