Problem/Motivation

assertNoFieldById() with NULL as $value does not work the same way as on WebTestBase. We need to improve that for easier conversion of tests.

Proposed resolution

Explicitly test assertNoFieldById() with NULL and empty string values and improve our implementation on AssertLegacyTrait.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jo Fitzgerald created an issue. See original summary.

jofitz’s picture

Assigned: jofitz » Unassigned
Issue summary: View changes
Status: Active » Needs review
FileSize
2.62 KB
3.31 KB

Added tests to prove that assertNoFieldById() does not work as described, specifically:

You may pass in NULL to skip checking the value, while still checking that the field doesn't exist.

Corrected the method.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
@@ -148,9 +149,9 @@ public function testLegacyTextAsserts() {
    */
-  public function testLegacyXPathAsserts() {
+  public function testLegacyFieldAsserts() {

+1 for renaming this method. It describes all its uses better

The last submitted patch, 2: 2859308-2-test_only.patch, failed testing.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 7e3c858 to 8.4.x and 4ebae49 to 8.3.x. Thanks!

  • alexpott committed 7e3c858 on 8.4.x
    Issue #2859308 by Jo Fitzgerald: Improve assertNoFieldById()...

  • alexpott committed 4ebae49 on 8.3.x
    Issue #2859308 by Jo Fitzgerald: Improve assertNoFieldById()...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.