Skip to content
Snippets Groups Projects
Commit 561489b7 authored by Ted Bowman's avatar Ted Bowman Committed by Adam G-H
Browse files

Issue #3271226 by tedbow, phenaproxima: Build\CoreUpdateTest::testApi doesn't...

Issue #3271226 by tedbow, phenaproxima: Build\CoreUpdateTest::testApi doesn't assert status code so may not be passing
parent 23a6b327
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace Drupal\automatic_updates_test; namespace Drupal\automatic_updates_test;
use Drupal\automatic_updates\Exception\UpdateException; use Drupal\automatic_updates\Exception\UpdateException;
use Drupal\automatic_updates\UpdateRecommender;
use Drupal\Component\Utility\Environment; use Drupal\Component\Utility\Environment;
use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Render\HtmlResponse; use Drupal\Core\Render\HtmlResponse;
...@@ -36,8 +35,17 @@ class TestController extends ControllerBase { ...@@ -36,8 +35,17 @@ class TestController extends ControllerBase {
$updater->apply(); $updater->apply();
$updater->destroy(); $updater->destroy();
$project = (new UpdateRecommender())->getProjectInfo(); // The code base has been updated, but as far as the PHP runtime is
$content = $project['existing_version']; // concerned, \Drupal::VERSION refers to the old version, until the next
// request. So check if the updated version is in Drupal.php and return
// a clear indication of whether it's there or not.
$drupal_php = file_get_contents(\Drupal::root() . '/core/lib/Drupal.php');
if (str_contains($drupal_php, "const VERSION = '$to_version';")) {
$content = "$to_version found in Drupal.php";
}
else {
$content = "$to_version not found in Drupal.php";
}
$status = 200; $status = 200;
} }
catch (UpdateException $e) { catch (UpdateException $e) {
......
...@@ -71,8 +71,12 @@ class CoreUpdateTest extends UpdateTestBase { ...@@ -71,8 +71,12 @@ class CoreUpdateTest extends UpdateTestBase {
// directories are not writable. // directories are not writable.
$this->assertReadOnlyFileSystemError('/automatic-update-test/update/9.8.1'); $this->assertReadOnlyFileSystemError('/automatic-update-test/update/9.8.1');
$mink->getSession()->reload(); $session = $mink->getSession();
$assert_session->pageTextContains('9.8.1'); $session->reload();
$this->assertSame('9.8.1 found in Drupal.php', trim($session->getPage()->getContent()));
// Even though the response is what we expect, assert the status code as
// well, to be extra-certain that there was no kind of server-side error.
$assert_session->statusCodeEquals(200);
$this->assertUpdateSuccessful('9.8.1'); $this->assertUpdateSuccessful('9.8.1');
} }
......
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