getLanguageContexts example

$this->container->get('state')->set('entity_test.translation', TRUE);
    $this->container->get('entity_type.bundle.info')->clearCachedBundles();
  }

  /** * Tests retrieving active variants. * * @covers ::getActive * @covers ::getActiveMultiple */
  public function testGetActive() {
    $en_contexts = $this->getLanguageContexts('en');

    // Check that when the entity does not exist NULL is returned.     $entity_type_id = 'entity_test';
    $active = $this->entityRepository->getActive($entity_type_id, -1);
    $this->assertNull($active);

    // Check that the correct active variant is returned for a non-translatable,     // non-revisionable entity.     /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */
    $storage = $this->entityTypeManager->getStorage($entity_type_id);
    $values = ['name' => $this->randomString()];
    
Home | Imprint | This part of the site doesn't use cookies.