class InvalidUpdateHookTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php \Drupal\Tests\system\Functional\UpdateSystem\InvalidUpdateHookTest
- 10 core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php \Drupal\Tests\system\Functional\UpdateSystem\InvalidUpdateHookTest
- 8.9.x core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php \Drupal\Tests\system\Functional\UpdateSystem\InvalidUpdateHookTest
Tests that hook_update_8000() is disallowed.
@group Update
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Functional\UpdateSystem\InvalidUpdateHookTest uses \Drupal\Tests\RequirementsPageTrait extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of InvalidUpdateHookTest
File
-
core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ InvalidUpdateHookTest.php, line 14
Namespace
Drupal\Tests\system\Functional\UpdateSystemView source
class InvalidUpdateHookTest extends BrowserTestBase {
use RequirementsPageTrait;
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'update_test_invalid_hook',
'update_script_test',
'dblog',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* URL for the upgrade script.
*
* @var string
*/
private $updateUrl;
/**
* A user account with upgrade permission.
*
* @var \Drupal\user\UserInterface
*/
private $updateUser;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
require_once $this->root . '/core/includes/update.inc';
$this->updateUrl = Url::fromRoute('system.db_update')->setAbsolute()
->toString();
$this->updateUser = $this->drupalCreateUser([
'administer software updates',
]);
}
public function testInvalidUpdateHook() {
// Confirm that a module with hook_update_8000() cannot be updated.
$this->drupalLogin($this->updateUser);
$this->drupalGet($this->updateUrl);
$this->updateRequirementsProblem();
$this->clickLink('Continue');
$this->assertSession()
->pageTextContains('Some of the pending updates cannot be applied because their dependencies were not met.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.