ensureUpdatesToRun example

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

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

  /** * Tests running update.php with some form of broken routing. */
  public function testWithBrokenRouting() {
    // Simulate a broken router, and make sure the front page is     // inaccessible.     \Drupal::state()->set('update_script_test_broken_inbound', TRUE);
    $this->resetAll();
    $this->drupalGet('<front>');
    
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

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

  /** * Tests JavaScript loading at update.php. * * @see ::doPreUpdateTests */
  public function testJavaScriptLoading() {
    $this->runUpdates();
  }

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

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

  /** * Ensures that a broken or out-of-date element info cache is not used. */
  public function testUpdate() {
    $connection = Database::getConnection();

    // Create broken element info caches entries.     $insert = $connection->upsert('cache_discovery');
    $insert->key('cid');
    
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

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

  /** * Tests that updates fail if the database does not meet the minimum version. */
  public function testUpdate() {
    if (Database::getConnection()->driver() !== 'mysql') {
      $this->markTestSkipped('This test only works with the mysql driver');
    }

    // Use a database driver that reports a fake database version that does
/** * {@inheritdoc} */
  protected static $modules = ['entity_test_update'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->ensureUpdatesToRun();
    $connection = Database::getConnection();

    // Simulate an entity type that had previously set an initial key schema for     // a field.     $schema = $connection->select('key_value')
      ->fields('key_value', ['value'])
      ->condition('collection', 'entity.storage_schema.sql')
      ->condition('name', 'entity_test_update.field_schema_data.name')
      ->execute()
      ->fetchField();

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