insertData example

private EntityAggregatorInterface $aggregator;

    private TestDataCollection $ids;

    private ProductDefinition $definition;

    protected function setUp(): void
    {
        $this->aggregator = $this->getContainer()->get(EntityAggregatorInterface::class);
        $this->definition = $this->getContainer()->get(ProductDefinition::class);

        $this->insertData();
    }

    public function testSingleTermsAggregation(): void
    {
        $context = Context::createDefaultContext();

        $criteria = new Criteria(
            $this->ids->getList(['p-1', 'p-2', 'p-3', 'p-4', 'p-5'])
        );

        $criteria->addAggregation(
            
$this->searchPageLoader = $this->getContainer()->get(SearchPageLoader::class);
        $this->suggestPageLoader = $this->getContainer()->get(SuggestPageLoader::class);
        $this->productPageLoader = $this->getContainer()->get(ProductPageLoader::class);

        $this->productRepository = $this->getContainer()->get('product.repository');
        $this->contextFactory = $this->getContainer()->get(SalesChannelContextFactory::class);

        $this->searchKeywordUpdater = $this->getContainer()->get(SearchKeywordUpdater::class);
        $this->resetSearchKeywordUpdaterConfig();

        $this->ids = new IdsCollection();
        $this->insertData();
    }

    public function testVisibilityInListing(): void
    {
        $salesChannelContext = $this->contextFactory->create(Uuid::randomHex()$this->salesChannelId1);

        $request = new Request();
        $request->attributes->set('_route_params', ['navigationId' => $this->categoryId]);

        $data = $this->getContainer()
            ->get(ProductListingRoute::class)
            
    // state. This also covers the "no existing data" scenario for fieldable     // entity type updates.     if ($initial_rev || $initial_mul) {
      $entity_type = $this->getUpdatedEntityTypeDefinition($initial_rev$initial_mul);
      $field_storage_definitions = $this->getUpdatedFieldStorageDefinitions($initial_rev$initial_mul);

      $this->entityDefinitionUpdateManager->updateFieldableEntityType($entity_type$field_storage_definitions);
      $this->assertEntityTypeSchema($initial_rev$initial_mul);
    }

    // Add a few entities so we can test the data copying step.     $this->insertData($initial_rev$initial_mul);

    $updated_entity_type = $this->getUpdatedEntityTypeDefinition($new_rev$new_mul);
    $updated_field_storage_definitions = $this->getUpdatedFieldStorageDefinitions($new_rev$new_mul);

    if (!$data_migration_supported) {
      $this->expectException(EntityStorageException::class);
      $this->expectExceptionMessage('Converting an entity type from revisionable to non-revisionable or from translatable to non-translatable is not supported.');
    }

    // Check that existing data can be retrieved from the storage before the     // entity schema is updated.
Home | Imprint | This part of the site doesn't use cookies.