installConfig example

protected static $modules = [
    'system',
    'config_test',
    'config_exclude_test',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installConfig(['system', 'config_test', 'config_exclude_test']);
    $this->setSetting('config_exclude_modules', ['config_test']);
  }

  /** * Tests excluding modules from the config export. */
  public function testExcludedModules() {
    // Assert that config_test is in the active config.     $active = $this->container->get('config.storage');
    $this->assertNotEmpty($active->listAll('config_test.'));
    $this->assertNotEmpty($active->listAll('system.'));
    

  protected $term2;

  /** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE): void {
    parent::setUp($import_test_views);

    // Install node config to create body field.     $this->installEntitySchema('node');
    $this->installConfig(['node', 'filter', 'taxonomy']);
    $this->installEntitySchema('user');
    $this->installEntitySchema('taxonomy_term');
    $this->mockStandardInstall();

    if ($import_test_views) {
      ViewTestData::createTestViews(static::class['taxonomy_test_views']);
    }

    $this->term1 = $this->createTerm();
    $this->term2 = $this->createTerm();

    

  public static $testViews = ['test_user_uid_argument'];

  /** * Tests the generated title of a user: uid argument. */
  public function testArgumentTitle() {
    $this->installSchema('system', ['sequences']);
    $this->installEntitySchema('user');
    $this->installConfig(['user']);
    User::create(['uid' => 0, 'name' => ''])->save();
    ViewTestData::createTestViews(static::class['user_test_views']);

    $view = Views::getView('test_user_uid_argument');

    // Tests an invalid user uid.     $view->preview(NULL, [rand(1000, 10000)]);
    $this->assertEmpty($view->getTitle());
    $view->destroy();

    // Tests a valid user.
'filter_test',
    'editor',
  ];

  /** * Sets up the test. */
  protected function setUp(): void {
    parent::setUp();
    $this->installEntitySchema('user');
    $this->installSchema('system', ['sequences']);
    $this->installConfig(['filter', 'filter_test']);

    // Create user 1 so that the user created later in the test has a different     // user ID.     // @todo Remove in https://www.drupal.org/node/540008.     User::create(['uid' => 1, 'name' => 'user1'])->save();

    /** @var \Drupal\Core\Render\ElementInfoManager $manager */
    $manager = \Drupal::service('plugin.manager.element_info');
    $manager->clearCachedDefinitions();
    $manager->getDefinitions();
    /** @var \Drupal\filter\FilterFormatInterface $filter_test_format */
    
/** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->installEntitySchema('user');
    $this->installEntitySchema('file');
    $this->installSchema('file', 'file_usage');
    $this->installSchema('system', 'sequences');
    $this->installEntitySchema('media');
    $this->installConfig([
      'field',
      'system',
      'file',
      'image',
      'media',
      'media_library',
    ]);

    // Create some media types to validate against.     $this->createMediaType('file', ['id' => 'document']);
    $this->createMediaType('image', ['id' => 'image']);
    

  protected static $modules = ['config_test'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installConfig(static::$modules);
  }

  public function testNormalize() {
    $config_entity = \Drupal::entityTypeManager()->getStorage('config_test')->create(['id' => 'system', 'label' => 'foobar', 'weight' => 1]);
    $config_entity->save();

    // Modify stored config entity, this is comparable with a schema change.     $config = $this->config('config_test.dynamic.system');
    $data = [
      'label' => 'foobar',
      'additional_key' => TRUE,
    ]

  protected static $modules = ['search'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installSchema('search', ['search_index', 'search_dataset', 'search_total']);
    $this->installConfig(['search']);
  }

  /** * Tests search indexing. */
  public function testMatching() {
    $this->_setup();
    $this->_testQueries();
  }

  /** * Set up a small index of items to test against. */
'text',
    'user',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->installEntitySchema('comment');
    $this->installConfig(['comment']);
    $this->installSchema('user', ['users_data']);

    NodeType::create(['type' => 'article'])->save();

    // Create comment field on article so that it adds 'comment_body' field.     FieldStorageConfig::create([
      'type' => 'text_long',
      'entity_type' => 'comment',
      'field_name' => 'comment',
    ])->save();
    $this->addDefaultCommentField('node', 'article');
  }
protected static $modules = [
    'system',
    'user',
  ];

  /** * Tests time zone resolution. */
  public function testGetTimeZone() {
    $this->installEntitySchema('user');
    $this->installSchema('system', ['sequences']);
    $this->installConfig(['system']);

    // Check the default test timezone.     $this->assertEquals('Australia/Sydney', date_default_timezone_get());

    // Test the configured system timezone.     $configFactory = $this->container->get('config.factory');
    $timeZoneConfig = $configFactory->getEditable('system.date');
    $timeZoneConfig->set('timezone.default', 'Australia/Adelaide');
    $timeZoneConfig->save();

    $eventDispatcher = $this->container->get('event_dispatcher');
    
/** * {@inheritdoc} */
  protected static $modules = ['comment', 'node', 'user'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installConfig(['user']);
    $this->installEntitySchema('date_format');
    $this->installEntitySchema('comment');
    $this->installSchema('comment', ['comment_entity_statistics']);
  }

  /** * Test loading/deleting/rendering orphaned comments. * * @dataProvider providerTestOrphan */
  public function testOrphan($property) {

    
protected static $modules = [
    'comment',
    'language',
    'content_translation',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installConfig(['comment']);
    $this->executeMigrations([
      'language',
      'd6_comment_type',
      'd6_language_content_comment_settings',
    ]);
  }

  /** * Tests migration of comment content language settings. */
  public function testLanguageCommentSettings() {
    
/** * @var \Drupal\filter\Plugin\FilterInterface[] */
  protected $filters;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installConfig(['system']);

    $manager = $this->container->get('plugin.manager.filter');
    $bag = new FilterPluginCollection($manager[]);
    $this->filters = $bag->getAll();
  }

  /** * Tests the align filter. */
  public function testAlignFilter() {
    $filter = $this->filters['filter_align'];

    
'user',
    'system',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installEntitySchema('user');
    $this->installEntitySchema('taxonomy_term');
    $this->installConfig(['taxonomy']);
  }

  /** * Tests rolling back configuration entity translations. */
  public function testConfigEntityRollback() {
    // We use vocabularies to demonstrate importing and rolling back     // configuration entities with translations. First, import vocabularies.     $vocabulary_data_rows = [
      ['id' => '1', 'name' => 'categories', 'weight' => '2'],
      ['id' => '2', 'name' => 'tags', 'weight' => '1'],
    ];
/** * Arbitrary langcode for a custom language. */
  const LANGCODE = 'xx';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

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

    $this->setSetting('locale_custom_strings_' . self::LANGCODE, [
      '' => ['Sunday' => 'domingo'],
      'Long month name' => ['March' => 'marzo'],
    ]);

    $formats = $this->container->get('entity_type.manager')
      ->getStorage('date_format')
      ->loadMultiple(['long', 'medium', 'short']);
    $formats['long']->setPattern('l, j. F Y - G:i')->save();
    $formats['medium']->setPattern('j. F Y - G:i')->save();
    

  protected static $modules = ['field', 'entity_test', 'system', 'user'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->installConfig(['system', 'field']);
    $this->installEntitySchema('entity_test');
  }

  /** * Tests string formatter output. */
  public function testUuidStringFormatter() {
    $entity = EntityTest::create([]);
    $entity->save();

    $uuid_field = $entity->get('uuid');

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