diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php index 395e497463..9358023d9f 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php @@ -12,11 +12,9 @@ class AjaxFormPageCacheTest extends JavascriptTestBase { /** - * Modules to enable. - * - * @var array + * {@inheritdoc} */ - public static $modules = ['node', 'ajax_test', 'ajax_forms_test']; + public static $modules = ['ajax_test', 'ajax_forms_test']; /** * {@inheritdoc} @@ -34,8 +32,8 @@ protected function setUp() { */ protected function getFormBuildId() { $build_id_fields = $this->xpath('//input[@name="form_build_id"]'); - $this->assertEqual(count($build_id_fields), 1, 'One form build id field on the page'); - return (string) $build_id_fields[0]->getValue(); + $this->assertEquals(count($build_id_fields), 1, 'One form build id field on the page'); + return $build_id_fields[0]->getValue(); } /** @@ -43,7 +41,7 @@ protected function getFormBuildId() { */ public function testSimpleAJAXFormValue() { $this->drupalGet('ajax_forms_test_get_form'); - $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.'); + $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.'); $build_id_initial = $this->getFormBuildId(); $session = $this->getSession(); @@ -52,32 +50,33 @@ public function testSimpleAJAXFormValue() { $this->assertSession()->assertWaitOnAjaxRequest(); $build_id_first_ajax = $this->getFormBuildId(); - $this->assertNotEqual($build_id_initial, $build_id_first_ajax, 'Build id is changed in the form_build_id element on first AJAX submission'); + $this->assertNotEquals($build_id_initial, $build_id_first_ajax, 'Build id is changed in the form_build_id element on first AJAX submission'); // Changing the value of a select input element, triggers a AJAX request/response. $session->getPage()->selectFieldOption('select', 'red'); $this->assertSession()->assertWaitOnAjaxRequest(); $build_id_second_ajax = $this->getFormBuildId(); - $this->assertNotEqual($build_id_first_ajax, $build_id_second_ajax, 'Build id changes on subsequent AJAX submissions'); + $this->assertNotEquals($build_id_first_ajax, $build_id_second_ajax, 'Build id changes on subsequent AJAX submissions'); - // Repeat the test sequence but this time with a page loaded from the cache. + // Emulate a push of the reload button and then repeat the test sequence + // this time with a page loaded from the cache. $session->reload(); - $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.'); + $this->assertEquals($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.'); $build_id_from_cache_initial = $this->getFormBuildId(); - $this->assertEqual($build_id_initial, $build_id_from_cache_initial, 'Build id is the same as on the first request'); + $this->assertEquals($build_id_initial, $build_id_from_cache_initial, 'Build id is the same as on the first request'); // Changing the value of a select input element, triggers a AJAX request/response. $session->getPage()->selectFieldOption('select', 'green'); $this->assertSession()->assertWaitOnAjaxRequest(); $build_id_from_cache_first_ajax = $this->getFormBuildId(); - $this->assertNotEqual($build_id_from_cache_initial, $build_id_from_cache_first_ajax, 'Build id is changed in the simpletest-DOM on first AJAX submission'); - $this->assertNotEqual($build_id_first_ajax, $build_id_from_cache_first_ajax, 'Build id from first user is not reused'); + $this->assertNotEquals($build_id_from_cache_initial, $build_id_from_cache_first_ajax, 'Build id is changed in the simpletest-DOM on first AJAX submission'); + $this->assertNotEquals($build_id_first_ajax, $build_id_from_cache_first_ajax, 'Build id from first user is not reused'); // Changing the value of a select input element, triggers a AJAX request/response. $session->getPage()->selectFieldOption('select', 'red'); $this->assertSession()->assertWaitOnAjaxRequest(); $build_id_from_cache_second_ajax = $this->getFormBuildId(); - $this->assertNotEqual($build_id_from_cache_first_ajax, $build_id_from_cache_second_ajax, 'Build id changes on subsequent AJAX submissions'); + $this->assertNotEquals($build_id_from_cache_first_ajax, $build_id_from_cache_second_ajax, 'Build id changes on subsequent AJAX submissions'); } @@ -88,8 +87,14 @@ public function testSimpleAJAXFormValue() { */ public function testAjaxElementValidation() { $this->drupalGet('ajax_validation_test'); - $this->getSession()->getPage()->fillField('drivertext', 'some dumb test'); - $this->assertSession()->assertWaitOnAjaxRequest(); + // Changing the value of the textfield will trigger an AJAX request/response. + $this->getSession()->getPage()->fillField('drivertext', 'some dumb text'); + + // When the AJAX command updates the DOM a