public function InPlaceUpdateTest::assertCoreUpgradeFailed in Automatic Updates 8
Assert an upgraded failed and was handle appropriately.
Parameters
string $from_version: The version from which to upgrade.
string $to_version: The version to which to upgrade.
Throws
\Behat\Mink\Exception\ResponseTextException
1 call to InPlaceUpdateTest::assertCoreUpgradeFailed()
- InPlaceUpdateTest::testCoreRollbackUpdate in tests/
src/ Build/ InPlaceUpdateTest.php - @covers ::update
File
- tests/
src/ Build/ InPlaceUpdateTest.php, line 325
Class
- InPlaceUpdateTest
- @coversDefaultClass \Drupal\automatic_updates\Services\InPlaceUpdate
Namespace
Drupal\Tests\automatic_updates\BuildCode
public function assertCoreUpgradeFailed($from_version, $to_version) {
// Assert files slated for deletion still exist.
foreach ($this
->getDeletions('drupal', $from_version, $to_version) as $deletion) {
$this
->assertFileExists($this
->getWorkspaceDirectory() . DIRECTORY_SEPARATOR . $deletion);
}
// Update the site.
$assert = $this
->visit("/test_automatic_updates/in-place-update/drupal/core/{$from_version}/{$to_version}")
->assertSession();
$assert
->statusCodeEquals(200);
// Assert that the update failed.
$finder = new Finder();
$finder
->files()
->in($this
->getWorkspaceDirectory())
->path('core/lib/Drupal.php');
$finder
->contains("/const VERSION = '{$from_version}'/");
$this
->assertTrue($finder
->hasResults(), "Expected version {$from_version} does not exist in {$this->getWorkspaceDirectory()}/core/lib/Drupal.php");
$assert
->pageTextContains('Update Failed');
$this
->visit('/admin/reports/status');
$assert
->pageTextContains("Drupal Version {$from_version}");
// Assert files slated for deletion are restored.
foreach ($this
->getDeletions('drupal', $from_version, $to_version) as $deletion) {
$this
->assertFileExists($this
->getWorkspaceDirectory() . DIRECTORY_SEPARATOR . $deletion);
}
}