doTestLanguageFallback example

// Reset hook firing information.     $this->getHooksInfo();
  }

  /** * Tests language fallback applied to field and entity translations. */
  public function testLanguageFallback() {
    // Test all entity variations with data table support.     foreach (entity_test_entity_types(ENTITY_TEST_TYPES_MULTILINGUAL) as $entity_type) {
      $this->doTestLanguageFallback($entity_type);
    }
  }

  /** * Executes the language fallback test for the given entity type. * * @param string $entity_type * The entity type to run the tests with. */
  protected function doTestLanguageFallback($entity_type) {
    /** @var \Drupal\Core\Render\RendererInterface $renderer */
    
/** @var \Drupal\entity_test\Entity\EntityTestMulRev $entity2 */
    $entity2 = $storage->create($values);
    $storage->save($entity2);
    /** @var \Drupal\Core\Entity\ContentEntityInterface[] $active */
    $active = $this->entityRepository->getActiveMultiple($entity_type_id[$entity->id()$entity2->id()]$it_contexts);
    $this->assertSame($it_revision2->getLoadedRevisionId()$active[$entity->id()]->getLoadedRevisionId());
    $this->assertSame($it_revision2->language()->getId()$active[$entity->id()]->language()->getId());
    $this->assertSame($entity2->getLoadedRevisionId()$active[$entity2->id()]->getLoadedRevisionId());
    $this->assertSame($entity2->language()->getId()$active[$entity2->id()]->language()->getId());

    $this->doTestLanguageFallback('getActive');
  }

  /** * Tests retrieving canonical variants. * * @covers ::getCanonical * @covers ::getCanonicalMultiple */
  public function testGetCanonical() {
    // Check that when the entity does not exist NULL is returned.     $entity_type_id = 'entity_test_mul';
    
Home | Imprint | This part of the site doesn't use cookies.