public function InPlaceUpdateTest::testCronCoreUpdate in Automatic Updates 8
Test in-place update via cron run.
@covers ::update
See also
File
- tests/
src/ Build/ InPlaceUpdateTest.php, line 149
Class
- InPlaceUpdateTest
- @coversDefaultClass \Drupal\automatic_updates\Services\InPlaceUpdate
Namespace
Drupal\Tests\automatic_updates\BuildCode
public function testCronCoreUpdate() {
$this
->installCore('8.8.0');
$filesystem = new SymfonyFilesystem();
$filesystem
->chmod($this
->getWorkspaceDirectory() . '/sites/default', 0750);
$settings_php = $this
->getWorkspaceDirectory() . '/sites/default/settings.php';
$filesystem
->chmod($settings_php, 0640);
$filesystem
->appendToFile($settings_php, PHP_EOL . '$config[\'automatic_updates.settings\'][\'enable_cron_updates\'] = TRUE;' . PHP_EOL);
$mink = $this
->visit('/admin/config/system/cron');
$mink
->getSession()
->getPage()
->findButton('Run cron')
->submit();
$mink
->assertSession()
->pageTextContains('Cron ran successfully.');
// Assert that the update worked.
$this
->assertDrupalVisit();
$finder = new Finder();
$finder
->files()
->in($this
->getWorkspaceDirectory())
->path('core/lib/Drupal.php');
$finder
->notContains("/const VERSION = '8.8.0'/");
$finder
->contains("/const VERSION = '8.8./");
$this
->assertTrue($finder
->hasResults(), "Expected version 8.8.{x} does not exist in {$this->getWorkspaceDirectory()}/core/lib/Drupal.php");
}