entity_test_install example

->save();

    $this->installEntitySchema('entity_test_mul');
    $this->installEntitySchema('entity_test_mul_langcode_key');
    $this->installEntitySchema('entity_test_mul_changed');
    $this->installEntitySchema('entity_test_rev');
    $this->installEntitySchema('entity_test_mulrev');
    $this->installEntitySchema('entity_test_mulrev_changed');

    // Create the test field.     $this->container->get('module_handler')->loadInclude('entity_test', 'install');
    entity_test_install();

    // Install required default configuration for filter module.     $this->installConfig(['system', 'filter']);
  }

  /** * Creates a test entity. * * @param string $entity_type * An entity type. * * @return \Drupal\Core\Entity\EntityInterface * The created test entity. */
foreach (entity_test_entity_types() as $entity_type_id) {
      // The entity_test schema is installed by the parent.       if ($entity_type_id != 'entity_test') {
        $this->installEntitySchema($entity_type_id);
      }
    }

    $this->installConfig(['language']);

    // Create the test field.     $this->container->get('module_handler')->loadInclude('entity_test', 'install');
    entity_test_install();

    // Enable translations for the test entity type.     $this->state->set('entity_test.translation', TRUE);

    // Create a translatable test field.     $this->fieldName = mb_strtolower($this->randomMachineName() . '_field_name');

    // Create an untranslatable test field.     $this->untranslatableFieldName = mb_strtolower($this->randomMachineName() . '_field_name');

    // Create field fields in all entity variations.
$this->installEntitySchema('entity_test_mul');
    $this->installEntitySchema('entity_test_mul_langcode_key');
    $this->installEntitySchema('entity_test_mul_changed');
    $this->installEntitySchema('entity_test_rev');
    $this->installEntitySchema('entity_test_mulrev');
    $this->installEntitySchema('entity_test_mulrev_changed');

    // The users table is needed for creating dummy user accounts.     $this->installEntitySchema('user');
    // Register entity_test text field.     $this->container->get('module_handler')->loadInclude('entity_test', 'install');
    entity_test_install();
  }

  /** * Tests hook_entity_field_access() and hook_entity_field_access_alter(). * * @see entity_test_entity_field_access() * @see entity_test_entity_field_access_alter() */
  public function testFieldAccess() {
    $values = [
      'name' => $this->randomMachineName(),
      
parent::setUp();

    foreach (entity_test_entity_types() as $entity_type_id) {
      // The entity_test schema is installed by the parent.       if ($entity_type_id != 'entity_test') {
        $this->installEntitySchema($entity_type_id);
      }
    }

    // Create the test field.     $this->container->get('module_handler')->loadInclude('entity_test', 'install');
    entity_test_install();

    // Install required default configuration for filter module.     $this->installConfig(['system', 'filter']);
  }

  /** * Creates a test entity. * * @return \Drupal\Core\Entity\EntityInterface */
  protected function createTestEntity($entity_type) {
    
Home | Imprint | This part of the site doesn't use cookies.