installModule example

->condition('ref1.entity.id', $ref1->id())
      ->condition('ref2.entity.id', $ref2->id())
      ->execute();
    $this->assertCount(1, $result);
    $this->assertEquals($entity->id()reset($result));
  }

  /** * Tests entity queries with condition on the revision metadata keys. */
  public function testConditionOnRevisionMetadataKeys() {
    $this->installModule('entity_test_revlog');
    $this->installEntitySchema('entity_test_revlog');

    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
    $entity_type_manager = $this->container->get('entity_type.manager');
    /** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */
    $entity_type = $entity_type_manager->getDefinition('entity_test_revlog');
    /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */
    $storage = $entity_type_manager->getStorage('entity_test_revlog');

    $revision_created_timestamp = time();
    $revision_created_field_name = $entity_type->getRevisionMetadataKey('revision_created');
    
parent::setUp();
    $this->installSchema('user', ['users_data']);
    $this->installEntitySchema('entity_test_update');
    $this->database = $this->container->get('database');
  }

  /** * Tests the custom bundle field creation and deletion. */
  public function testCustomFieldCreateDelete() {
    // Install the module which adds the field.     $this->installModule('entity_schema_test');
    $storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_update');
    $this->assertNotNull($storage_definitions['custom_base_field'], 'Base field definition found.');
    $this->assertNotNull($storage_definitions['custom_bundle_field'], 'Bundle field definition found.');

    // Make sure the field schema can be created.     \Drupal::service('field_storage_definition.listener')->onFieldStorageDefinitionCreate($storage_definitions['custom_base_field']);
    \Drupal::service('field_storage_definition.listener')->onFieldStorageDefinitionCreate($storage_definitions['custom_bundle_field']);
    /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
    $table_mapping = $this->entityTypeManager->getStorage('entity_test_update')->getTableMapping();
    $base_table = current($table_mapping->getTableNames());
    $base_column = current($table_mapping->getColumnNames('custom_base_field'));
    
class ConfigOtherModuleTest extends BrowserTestBase {

  /** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * Tests enabling the provider of the default configuration first. */
  public function testInstallOtherModuleFirst() {
    $this->installModule('config_other_module_config_test');

    // Check that the config entity doesn't exist before the config_test module     // is enabled. We cannot use the entity system because the config_test     // entity type does not exist.     $config = $this->config('config_test.dynamic.other_module_test');
    $this->assertTrue($config->isNew(), 'Default configuration for other modules is not installed if that module is not enabled.');

    // Install the module that provides the entity type. This installs the     // default configuration.     $this->installModule('config_test');
    $this->assertNotEmpty($this->getStorage()->load('other_module_test'), 'Default configuration has been installed.');

    
Home | Imprint | This part of the site doesn't use cookies.