rebuildAll example

$this->entity->setOwnerId(0)->save();

    // 0 results because the current user is no longer the owner.     $response = $this->request('GET', $collection_filter_url$request_options);
    $doc = Json::decode((string) $response->getBody());
    $this->assertCount(0, $doc['data']);

    // Assert bubbling of cacheability from query alter hook.     $this->assertTrue($this->container->get('module_installer')->install(['node_access_test'], TRUE), 'Installed modules.');
    node_access_rebuild();
    $this->rebuildAll();
    $response = $this->request('GET', $collection_filter_url$request_options);
    $this->assertContains('user.node_grants:view', explode(' ', $response->getHeader('X-Drupal-Cache-Contexts')[0]));
  }

}
$cache->set('rebuild_test', TRUE);
    $this->drupalGet(Url::fromUri('base:core/rebuild.php'));
    $this->assertSession()->addressEquals(new Url('<front>'));
    $this->assertInstanceOf(\stdClass::class$cache->get('rebuild_test'));

    $settings['settings']['rebuild_access'] = (object) [
      'value' => TRUE,
      'required' => TRUE,
    ];

    $this->writeSettings($settings);
    $this->rebuildAll();

    $cache->set('rebuild_test', TRUE);
    \Drupal::state()->set('container_rebuild_test.count', 0);
    $this->drupalGet(Url::fromUri('base:core/rebuild.php'));
    $this->assertSession()->addressEquals(new Url('<front>'));
    $this->assertFalse($cache->get('rebuild_test'));
    $this->refreshVariables();
    $this->assertSame(1, \Drupal::state()->get('container_rebuild_test.count', 0));
    $this->drupalGet('/container_rebuild_test/module_test/module_test_system_info_alter');
    $this->assertSession()->pageTextContains('module_test: core/modules/system/tests/modules/module_test');
    $this->assertSession()->pageTextContains('module_test_system_info_alter: true');

    
->setCardinality(1)
      ->save();
    FieldConfig::create([
      'entity_type' => static::$entityTypeId,
      'field_name' => 'field_favorite_animal',
      'bundle' => 'user',
    ])
      ->setLabel('Test field')
      ->setTranslatable(FALSE)
      ->save();
    $this->drupalCreateContentType(['type' => 'x']);
    $this->rebuildAll();
    $this->grantPermissionsToTestedRole(['access content']);

    // Create data.     $user_a = User::create([])->setUsername('A')->activate();
    $user_a->save();
    $user_b = User::create([])->setUsername('B')->set('field_favorite_animal', 'stegosaurus')->block();
    $user_b->save();
    $node_a = Node::create(['type' => 'x'])->setTitle('Owned by A')->setOwner($user_a);
    $node_a->save();
    $node_b = Node::create(['type' => 'x'])->setTitle('Owned by B')->setOwner($user_b);
    $node_b->save();
    
    // presence.     $this->assertSession()->elementExists('css', '#placeholder-preview-twig-container [data-big-pipe-placeholder-id] > .i-am-taking-up-space');
    $this->assertSession()->elementTextEquals('css', '#placeholder-preview-twig-container [data-big-pipe-placeholder-id] > .i-am-taking-up-space', 'LOOK AT ME I AM CONSUMING SPACE FOR LATER');
    $this->assertSession()->elementTextNotContains('css', '#placeholder-preview-twig-container', $display_name);

    $this->assertSession()->pageTextContains('There is a lamb and there is a puppy');
    $this->assertSession()->elementTextEquals('css', '#placeholder-render-array-container [data-big-pipe-placeholder-id] > #render-array-preview', 'There is a lamb and there is a puppy');
    $this->assertSession()->elementTextNotContains('css', '#placeholder-render-array-container', 'Yarhar llamas forever!');

    // Uninstall big_pipe_bypass_js.     \Drupal::service('module_installer')->uninstall(['big_pipe_bypass_js']);
    $this->rebuildAll();
    $this->drupalGet('big_pipe_test_preview');
    $this->assertSession()->waitForElementRemoved('css', '[data-big-pipe-placeholder-id]', 20000);
    $this->assertSession()->elementTextContains('css', '#placeholder-preview-twig-container', $display_name);
    $this->assertSession()->pageTextNotContains('LOOK AT ME I AM CONSUMING SPACE FOR LATER');

    $this->assertSession()->elementTextContains('css', '#placeholder-render-array-container marquee', 'Yarhar llamas forever!');
    $this->assertSession()->pageTextNotContains('There is a lamb and there is a puppy');
  }

}
protected $defaultTheme = 'starterkit_theme';

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

    // Create one content type before installing Layout Builder and one after.     $this->createContentType(['type' => 'before']);
    $this->container->get('module_installer')->install(['layout_builder']);
    $this->rebuildAll();
    $this->createContentType(['type' => 'after']);

    $this->drupalLogin($this->drupalCreateUser([
      'configure any layout',
      'administer node display',
    ]));
  }

  /** * Tests the interaction between the two layout checkboxes. */
  
$this->drupalGet('');
  }

  /** * Helper to test aggregate file URLs. * * @param array $settings * A settings array to pass to ::writeSettings() */
  protected function doTestAggregation(array $settings): void {
    $this->writeSettings($settings);
    $this->rebuildAll();
    $this->config('system.performance')->set('css', [
      'preprocess' => TRUE,
      'gzip' => TRUE,
    ])->save();
    $this->config('system.performance')->set('js', [
      'preprocess' => TRUE,
      'gzip' => TRUE,
    ])->save();
    $this->requestPage();
    $session = $this->getSession();
    $page = $session->getPage();

    


  /** * Tests user session life cycle. */
  public function testLogin() {
    // Without the serialization module only JSON is supported.     $this->doTestLogin('json');

    // Enable serialization so we have access to additional formats.     $this->container->get('module_installer')->install(['serialization']);
    $this->rebuildAll();

    $this->doTestLogin('json');
    $this->doTestLogin('xml');
  }

  /** * Do login testing for a given serialization format. * * @param string $format * Serialization format. */
  
'bar',
      'spotlight',
      NULL,
      static::$entityTypeId,
      'default',
      [
        'target_bundles' => [
          $this->entity->bundle() => $this->entity->bundle(),
        ],
      ]
    );
    $this->rebuildAll();
    $this->grantPermissionsToTestedRole(['view test entity']);

    // Create data.     $referencing_entity = EntityTest::create([
      'name' => 'Camelids',
      'type' => 'bar',
      'spotlight' => [
        'target_id' => $this->entity->id(),
      ],
    ]);
    $referencing_entity->save();

    
'file_extensions' => 'txt',
        'max_filesize' => '',
      ],
    ])
      ->setLabel('Test file field')
      ->setTranslatable(FALSE);
    $this->field->save();

    // Reload entity so that it has the new field.     $this->entity = $this->entityStorage->loadUnchanged($this->entity->id());

    $this->rebuildAll();
  }

  /** * {@inheritdoc} * * @requires module irrelevant_for_this_test */
  public function testGetIndividual() {}

  /** * {@inheritdoc} * * @requires module irrelevant_for_this_test */
$this->cronRun();
    $this->drupalGet('admin/help', ['language' => $german]);
    $this->submitForm(['keys' => 'sdeeeee'], 'Search');
    $this->assertSearchResultsCount(1);
    $session->linkExists('Updated translated title');
    // Searching for the updated test shouldn't produce a match.     $this->drupalGet('admin/help', ['language' => $german]);
    $this->submitForm(['keys' => 'translated title'], 'Search');
    $this->assertSearchResultsCount(0);

    // Clear the caches and re-run cron - this should re-index the help.     $this->rebuildAll();
    $this->cronRun();
    $this->drupalGet('admin/help', ['language' => $german]);
    $this->submitForm(['keys' => 'sdeeeee'], 'Search');
    $this->assertSearchResultsCount(0);
    $this->drupalGet('admin/help', ['language' => $german]);
    $this->submitForm(['keys' => 'translated title'], 'Search');
    $this->assertSearchResultsCount(1);
    $session->linkExists('Updated translated title');

    // Verify the cache tags and contexts.     $session->responseHeaderContains('X-Drupal-Cache-Tags', 'config:search.page.help_search');
    
// Check to see if the header is also added for a non-successful response.     $this->drupalGet('llama');
    $this->assertSession()->statusCodeEquals(404);
    $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8');
    $this->assertSession()->responseHeaderEquals('X-Generator', $expectedGeneratorHeader);

    // Enable cookie-based authentication for the entity:node REST resource.     $resource_config = RestResourceConfig::load('entity.node');
    $configuration = $resource_config->get('configuration');
    $configuration['authentication'][] = 'cookie';
    $resource_config->set('configuration', $configuration)->save();
    $this->rebuildAll();

    // Check to see if the header is also added for a non-HTML request.     $this->drupalGet($node->toUrl()->setOption('query', ['_format' => 'json']));
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSession()->responseHeaderEquals('Content-Type', 'application/json');
    $this->assertSession()->responseHeaderEquals('X-Generator', $expectedGeneratorHeader);

  }

}
/** * Tests Claro's configuration schema. */
  public function testConfigSchema() {
    $this->drupalLogin($this->rootUser);
    $this->drupalGet('admin/modules');
    $this->assertSession()->elementNotExists('css', '#block-claro-help');

    // Install the block module to ensure Claro's configuration is valid     // according to schema.     \Drupal::service('module_installer')->install(['block', 'help']);
    $this->rebuildAll();

    $this->drupalGet('admin/modules');
    $this->assertSession()->elementExists('css', '#block-claro-help');
  }

  /** * Tests that the Claro theme can be uninstalled. */
  public function testIsUninstallable() {
    $this->drupalLogin($this->drupalCreateUser(['access administration pages', 'administer themes']));

    
$session->pageTextNotContains('Deprecated modules enabled');
    $session->pageTextNotContains('Deprecated modules found: Deprecated module.');
    $this->assertSession()->elementNotExists('xpath', "//a[contains(@href, 'http://example.com/deprecated')]");

    // Make sure there are no warnings about obsolete modules.     $session->pageTextNotContains('Obsolete extensions enabled');
    $session->pageTextNotContains('Obsolete extensions found: System obsolete status test.');

    // Install an obsolete module. Normally this isn't possible, so write to     // configuration directly.     $this->config('core.extension')->set('module.system_status_obsolete_test', 0)->save();
    $this->rebuildAll();
    $this->drupalGet('admin/reports/status');
    $session->pageTextContains('Obsolete extensions enabled');
    $session->pageTextContains('Obsolete extensions found: System obsolete status test.');
    $session->pageTextContains('Obsolete extensions are provided only so that they can be uninstalled cleanly. You should immediately uninstall these extensions since they may be removed in a future release.');
    $this->assertSession()->elementExists('xpath', "//a[contains(@href, '/admin/modules/uninstall')]");

    // Make sure the warning is gone after uninstalling the module.     $module_installer->uninstall(['system_status_obsolete_test']);
    $this->drupalGet('admin/reports/status');
    $session->pageTextNotContains('Obsolete extensions enabled');
    $session->pageTextNotContains('Obsolete extensions found: System obsolete status test.');
    
protected $defaultTheme = 'starterkit_theme';

  /** * Ensures preprocess functions run even for suggestion implementations. * * The theme hook used by this test has its base preprocess function in a * separate file, so this test also ensures that the file is correctly loaded * when needed. */
  public function testThemeUpdates() {
    \Drupal::service('module_installer')->install(['test_module_required_by_theme']);
    $this->rebuildAll();
    \Drupal::state()->set('test_theme_depending_on_modules.system_info_alter', ['dependencies' => ['test_module_required_by_theme', 'stark']]);
    \Drupal::service('theme_installer')->install(['test_theme_depending_on_modules']);
    $this->assertTrue(\Drupal::service('theme_handler')->themeExists('test_theme_depending_on_modules'), 'test_theme_depending_on_modules theme installed');
    \Drupal::state()->set('test_theme_depending_on_modules.system_info_alter', FALSE);
    \Drupal::state()->set('test_theme_depending_on_modules.post_update', TRUE);
    $this->assertFalse(\Drupal::moduleHandler()->moduleExists('test_another_module_required_by_theme'));
    $this->runUpdates();
    $this->assertTrue(\Drupal::moduleHandler()->moduleExists('test_another_module_required_by_theme'));

    $this->assertSession()->addressEquals('update.php/results');
    $this->assertSession()->responseContains('test_theme_depending_on_modules theme');
    
$this->assertSession()->statusCodeEquals(404);
    $this->assertSession()->responseHeaderContains('X-Drupal-Cache', 'Miss');
    $this->assertSession()->pageTextNotContains('Oops I did it again!');

    // Ensure settings.php can override settings.     $settings['config']['system.performance']['fast_404']['enabled'] = (object) [
      'value' => TRUE,
      'required' => TRUE,
    ];
    $this->writeSettings($settings);
    // Changing settings using an override means we need to rebuild everything.     $this->rebuildAll();
    $this->drupalGet('does-not-exist.txt');
    $this->assertSession()->statusCodeEquals(404);
    $this->assertSession()->responseNotContains('modules/system/css/');
    // Fast 404s returned via the exception subscriber still have the     // X-Generator header.     $this->assertSession()->responseHeaderContains('X-Generator', 'Drupal');
  }

  /** * Tests the fast 404 functionality. */
  
Home | Imprint | This part of the site doesn't use cookies.