public function InPlaceUpdateTest::assertCoreUpgradeSuccess in Automatic Updates 8
Assert an upgrade succeeded.
Parameters
string $from_version: The version from which to upgrade.
string $to_version: The version to which to upgrade.
Throws
\Behat\Mink\Exception\ExpectationException
\Behat\Mink\Exception\ResponseTextException
1 call to InPlaceUpdateTest::assertCoreUpgradeSuccess()
- InPlaceUpdateTest::testCoreUpdate in tests/
src/ Build/ InPlaceUpdateTest.php - @covers ::update @dataProvider coreVersionsSuccessProvider
File
- tests/
src/ Build/ InPlaceUpdateTest.php, line 284
Class
- InPlaceUpdateTest
- @coversDefaultClass \Drupal\automatic_updates\Services\InPlaceUpdate
Namespace
Drupal\Tests\automatic_updates\BuildCode
public function assertCoreUpgradeSuccess($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);
$this
->assertDrupalVisit();
// Assert that the update worked.
$finder = new Finder();
$finder
->files()
->in($this
->getWorkspaceDirectory())
->path('core/lib/Drupal.php');
$finder
->contains("/const VERSION = '{$to_version}'/");
$this
->assertTrue($finder
->hasResults(), "Expected version {$to_version} does not exist in {$this->getWorkspaceDirectory()}/core/lib/Drupal.php");
$assert
->pageTextContains('Update successful');
$this
->visit('/admin/reports/status');
$assert
->pageTextContains("Drupal Version {$to_version}");
// Assert files slated for deletion are now gone.
foreach ($this
->getDeletions('drupal', $from_version, $to_version) as $deletion) {
$this
->assertFileNotExists($this
->getWorkspaceDirectory() . DIRECTORY_SEPARATOR . $deletion);
}
// Validate that all DB updates are processed.
$this
->visit('/update.php/selection');
$assert
->pageTextContains('No pending updates.');
}