There are 2 same errors https://www.drupal.org/pift-ci-job/2057145
1) Drupal\Tests\metatag\Functional\MetatagTokenTest::testMetatagCurrentPageTokens
Drupal\Core\Field\FieldException: Attempt to create a field field_metatags that does not exist on entity type user.
/var/www/html/core/modules/field/src/Entity/FieldConfig.php:315
/var/www/html/core/lib/Drupal/Core/Field/FieldConfigBase.php:346
/var/www/html/core/lib/Drupal/Core/Field/FieldConfigBase.php:517
/var/www/html/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php:226
/var/www/html/core/lib/Drupal/Core/TypedData/TypedDataManager.php:190
/var/www/html/core/lib/Drupal/Core/Field/FieldTypePluginManager.php:82
/var/www/html/core/lib/Drupal/Core/Field/FieldItemList.php:41
/var/www/html/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php:208
/var/www/html/core/lib/Drupal/Core/Field/FieldItemList.php:177
/var/www/html/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:177
/var/www/html/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:119
/var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php:216
/var/www/html/core/lib/Drupal/Core/Entity/EntityBase.php:508
/var/www/html/core/modules/user/tests/src/Traits/UserCreationTrait.php:191
/var/www/html/modules/contrib/metatag/tests/src/Functional/MetatagTokenTest.php:55
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:722
2) Drupal\Tests\metatag\Functional\MetatagTokenTest::testMetatagEntityTokens
Drupal\Core\Field\FieldException: Attempt to create a field field_metatags that does not exist on entity type user.
/var/www/html/core/modules/field/src/Entity/FieldConfig.php:315
/var/www/html/core/lib/Drupal/Core/Field/FieldConfigBase.php:346
/var/www/html/core/lib/Drupal/Core/Field/FieldConfigBase.php:517
/var/www/html/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php:226
/var/www/html/core/lib/Drupal/Core/TypedData/TypedDataManager.php:190
/var/www/html/core/lib/Drupal/Core/Field/FieldTypePluginManager.php:82
/var/www/html/core/lib/Drupal/Core/Field/FieldItemList.php:41
/var/www/html/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php:208
/var/www/html/core/lib/Drupal/Core/Field/FieldItemList.php:177
/var/www/html/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:177
/var/www/html/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php:119
/var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php:216
/var/www/html/core/lib/Drupal/Core/Entity/EntityBase.php:508
/var/www/html/core/modules/user/tests/src/Traits/UserCreationTrait.php:191
/var/www/html/modules/contrib/metatag/tests/src/Functional/MetatagTokenTest.php:87
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:722
The error occur on the string
$user = $this->createUser([]);
The errors came after Drupal 9.2.x commit https://git.drupalcode.org/project/drupal/-/commit/db3ad8f8b251eb5206fde...
Comments
Comment #2
eugene bocharov commentedI'm not sure, if this is actually issue with Metatag or Drupal core.
But if we clear field definitions cache after adding the field in the MetatagTokenTest::setUp(), it solves the problem with tests:
Comment #3
damienmckennaThanks for looking through this and working out a possible fix. I wonder if something changed in core in 9.2.0 that results in this bug happening?
Comment #4
eugene bocharov commentedI found that the problem arised after these changes in core/tests/Drupal/Tests/BrowserTestBase.php
If I get back
$this->rebuildAll();the errors disappearAnd in the last comment of 2189411 it says
Now I think source of the problem is outside the Metatag module. Because tests in
MetatagTokenTestcallsDrupal\Tests\field_ui\Traits\FieldUiTestTrait::fieldUIAddNewField()and nextDrupal\Tests\user\Traits\UserCreationTrait::createUser()cause a problem.Comment #5
damienmckennaGreat job researching that, thank you!
So yeah, I think adding the one line would be great, though it'd be worth adding a comment that references the issue.
Comment #6
damienmckennaThe changes in patch form..
Comment #7
eugene bocharov commentedI agree, the comment here is useful. Thank you @DamienMcKenna for your attention to the problem and quick response.
Comment #9
damienmckennaCommitted. Thanks for tracking that one down. We'll deal with the 9.3.x problem in a separate issue.