getUpdaterFromDirectory example


  public static function factory($source$root) {
    if (is_dir($source)) {
      $updater = self::getUpdaterFromDirectory($source);
    }
    else {
      throw new UpdaterException('Unable to determine the type of the source directory.');
    }
    return new $updater($source$root);
  }

  /** * Determines which Updater class can operate on the given directory. * * @param string $directory * Extracted Drupal project. * * @return string * The class name which can work with this project type. * * @throws \Drupal\Core\Updater\UpdaterException */
$this->drupalGet('admin/reports/updates/update');
    $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.');

    $this->drupalGet('admin/update/ready');
    $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.');
  }

  /** * Tests only an *.info.yml file are detected without supporting files. */
  public function testUpdateDirectory() {
    $type = Updater::getUpdaterFromDirectory($this->root . '/core/modules/update/tests/modules/aaa_update_test');
    $this->assertEquals('Drupal\\Core\\Updater\\Module', $type, 'Detected a Module');

    $type = Updater::getUpdaterFromDirectory($this->root . '/core/modules/update/tests/themes/update_test_basetheme');
    $this->assertEquals('Drupal\\Core\\Updater\\Theme', $type, 'Detected a Theme.');
  }

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