core/modules/simpletest/src/WebTestBase.php | 2 +- core/modules/user/src/Tests/UserRegistrationTest.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 29271ee..5a05016 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -2748,7 +2748,7 @@ protected function buildUrl($path, array $options = array()) { */ protected function assertCacheTag($expected_cache_tag) { $cache_tags = explode(' ', $this->drupalGetHeader('X-Drupal-Cache-Tags')); - $this->assertTrue(in_array($expected_cache_tag, $cache_tags)); + $this->assertTrue(in_array($expected_cache_tag, $cache_tags), sprintf("'%s' cache tag is present.", $expected_cache_tag)); } } diff --git a/core/modules/user/src/Tests/UserRegistrationTest.php b/core/modules/user/src/Tests/UserRegistrationTest.php index 2666665..24e6972 100644 --- a/core/modules/user/src/Tests/UserRegistrationTest.php +++ b/core/modules/user/src/Tests/UserRegistrationTest.php @@ -220,14 +220,23 @@ function testRegistrationWithUserFields() { // Check that the field does not appear on the registration form. $this->drupalGet('user/register'); $this->assertNoText($field->label(), 'The field does not appear on user registration form'); + $this->assertCacheTag('config:core.entity_form_display.user.user.register'); + $this->assertCacheTag('config:user.settings'); // Have the field appear on the registration form. entity_get_form_display('user', 'user', 'register') ->setComponent('test_user_field', array('type' => 'test_field_widget')) ->save(); + $check_cache_tags = function() { + $this->assertCacheTag('config:core.entity_form_display.user.user.register'); + $this->assertCacheTag('config:field.field.user.user.test_user_field'); + $this->assertCacheTag('config:field.storage.user.test_user_field'); + $this->assertCacheTag('config:user.settings'); + }; $this->drupalGet('user/register'); $this->assertText($field->label(), 'The field appears on user registration form'); + $check_cache_tags(); // Check that validation errors are correctly reported. $edit = array(); @@ -236,10 +245,12 @@ function testRegistrationWithUserFields() { // Missing input in required field. $edit['test_user_field[0][value]'] = ''; $this->drupalPostForm(NULL, $edit, t('Create new account')); + $check_cache_tags(); $this->assertRaw(t('@name field is required.', array('@name' => $field->label())), 'Field validation error was correctly reported.'); // Invalid input. $edit['test_user_field[0][value]'] = '-1'; $this->drupalPostForm(NULL, $edit, t('Create new account')); + $check_cache_tags(); $this->assertRaw(t('%name does not accept the value -1.', array('%name' => $field->label())), 'Field validation error was correctly reported.'); // Submit with valid data. @@ -256,6 +267,7 @@ function testRegistrationWithUserFields() { $field_storage->save(); foreach (array('js', 'nojs') as $js) { $this->drupalGet('user/register'); + $check_cache_tags(); // Add two inputs. $value = rand(1, 255); $edit = array();