Problem/Motivation
Drupal\Tests\field\Functional\EntityReference\EntityReferenceAdminTest has failed twice in 8.6.x HEAD in the past two weeks:
https://www.drupal.org/pift-ci-job/1179392
https://www.drupal.org/pift-ci-job/1184261
The fail is kind of odd:
Drupal\Tests\field\Functional\EntityReference\EntityReferenceAdminTest
fail: [Other] Line 0 of sites/default/files/simpletest/phpunit-264.xml:
PHPunit Test failed to complete; Error: PHPUnit 6.5.13 by Sebastian Bergmann and contributors.
Testing Drupal\Tests\field\Functional\EntityReference\EntityReferenceAdminTest
... 3 / 3 (100%)
Time: 54.47 seconds, Memory: 4.00MB
OK (3 tests, 135 assertions)
HTML output was generated
http://php-apache-jenkins-php7-mysql5-5-6660/subdirectory/sites/simpletest/browser_output/Drupal_Tests_field_Functional_EntityReference_EntityReferenceAdminTest-1-90970228.html
(...etc...)
Remaining deprecation notices (2)
2x: Passing an escaped locator to the named selector is deprecated as of 1.7 and will be removed in 2.0. Pass the raw value instead.
2x in EntityReferenceAdminTest::testAvailableFormatters from Drupal\Tests\field\Functional\EntityReference
1.7 and 2.0 of what, you ask? Passing an escaped locator to what, and on what line? I grepped the codebase and found:
vendor/behat/mink/src/Selector/NamedSelector.php: 'Passing an escaped locator to the named selector is deprecated as of 1.7 and will be removed in 2.0.'
Which has:
private function escapeLocator($locator)
{
// If the locator looks like an escaped one, don't escape it again for BC reasons.
if (
preg_match('/^\'[^\']*+\'$/', $locator)
|| (false !== strpos($locator, '\'') && preg_match('/^"[^"]*+"$/', $locator))
|| ((8 < $length = strlen($locator)) && 'concat(' === substr($locator, 0, 7) && ')' === $locator[$length - 1])
) {
@trigger_error(
'Passing an escaped locator to the named selector is deprecated as of 1.7 and will be removed in 2.0.'
.' Pass the raw value instead.',
E_USER_DEPRECATED
);
return $locator;
}
So it looks like somewhere in that test, a random string is somehow being passed to the above method, and if it matches the regex, BOOM, random fail. I read the test method though and the only variables in it are machine names, so that's as far as I got.
Proposed resolution
?
Remaining tasks
TBD
User interface changes
N/A
API changes
TBD
Data model changes
N/A
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3030902-5.patch | 870 bytes | krzysztof domański |
| #5 | 3030902-test-only.patch | 687 bytes | krzysztof domański |
| #2 | 3030902-2.patch | 1.08 KB | krzysztof domański |
| #2 | 3030902-test-only.patch | 922 bytes | krzysztof domański |
Comments
Comment #2
krzysztof domańskiIn
fieldUIAddNewField()the label is randomly generated, so'ZQ!!>&'is possible.Comment #4
amateescu commentedI think it would be better to have this fix in
\Drupal\Tests\field_ui\Traits\FieldUiTestTrait::fieldUIAddNewField()itself, otherwise every code that calls it needs to be aware of this problem.Comment #5
krzysztof domańskiComment #6
amateescu commentedLooks great now!
Comment #8
catchCommitted 8d89da6 and pushed to 8.8.x. Thanks! (and backported to 8.7.x)
Comment #11
krzysztof domańskiThere are more identical random test failures caused by the vendor error.
#3041318: [random test failure] Various fails when a random string is used in an xpath selector