Skip to content
Snippets Groups Projects
Commit 42a48a2e authored by catch's avatar catch
Browse files

Issue #3253639 by tedbow, longwave:...

Issue #3253639 by tedbow, longwave: \Drupal\Tests\update\Functional\UpdateTestBase::setUp is not needed for most child classes and makes the test harder to understand
parent 5e93c9c6
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
*
* @group update
*/
class FileTransferAuthorizeFormTest extends UpdateTestBase {
class FileTransferAuthorizeFormTest extends UpdateUploaderTestBase {
/**
* Modules to enable.
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\update\Functional;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
......@@ -54,28 +53,6 @@ abstract class UpdateTestBase extends BrowserTestBase {
*/
protected $updateProject;
protected function setUp() {
parent::setUp();
// Change the root path which Update Manager uses to install and update
// projects to be inside the testing site directory. See
// \Drupal\update\UpdateRootFactory::get() for equivalent changes to the
// test child site.
$request = \Drupal::request();
$update_root = $this->container->get('update.root') . '/' . DrupalKernel::findSitePath($request);
$this->container->get('update.root')->set($update_root);
// Create the directories within the root path within which the Update
// Manager will install projects.
foreach (drupal_get_updaters() as $updater_info) {
$updater = $updater_info['class'];
$install_directory = $update_root . '/' . $updater::getRootDirectoryRelativePath();
if (!is_dir($install_directory)) {
mkdir($install_directory);
}
}
}
/**
* Refreshes the update status based on the desired available update scenario.
*
......
......@@ -12,7 +12,7 @@
*
* @group update
*/
class UpdateUploadTest extends UpdateTestBase {
class UpdateUploadTest extends UpdateUploaderTestBase {
use TestFileCreationTrait {
getTestFiles as drupalGetTestFiles;
......
<?php
namespace Drupal\Tests\update\Functional;
use Drupal\Core\DrupalKernel;
/**
* Base test class for tests that test project upload functionality.
*/
class UpdateUploaderTestBase extends UpdateTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
// Change the root path which Update Manager uses to install and update
// projects to be inside the testing site directory. See
// \Drupal\update\UpdateRootFactory::get() for equivalent changes to the
// test child site.
$request = \Drupal::request();
$update_root = $this->container->get('update.root') . '/' . DrupalKernel::findSitePath($request);
$this->container->get('update.root')->set($update_root);
// Create the directories within the root path within which the Update
// Manager will install projects.
foreach (drupal_get_updaters() as $updater_info) {
$updater = $updater_info['class'];
$install_directory = $update_root . '/' . $updater::getRootDirectoryRelativePath();
if (!is_dir($install_directory)) {
mkdir($install_directory);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment