assertTrue() and assertFalse() now only accept boolean values, which is fair enough. We need to either alter the assertions to test a boolean value, or better use assertNotEmpty() and assertEmpty() or some other assertions.
21x: Support for asserting against non-boolean values in ::assertTrue is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use a different assert method, for example, ::assertNotEmpty(). See https://www.drupal.org/node/3082086
which appear in the following files:
9x in SchedulerFieldsDisplayTest::testVerticalTabOrFieldset from Drupal\Tests\scheduler\Functional
4x in SchedulerApiTest::testHideField from Drupal\Tests\scheduler\Functional
4x in SchedulerApiTest::testHookPublishUnpublishAction from Drupal\Tests\scheduler\Functional
2x in SchedulerBasicTest::testPublishingAndUnpublishing from Drupal\Tests\scheduler\Functional
2x in SchedulerFieldsDisplayTest::testDisabledFields from Drupal\Tests\scheduler\Functional
and
9x: Support for asserting against non-boolean values in ::assertFalse is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use a different assert method, for example, ::assertEmpty(). See https://www.drupal.org/node/3082086
which appear in the following files:
4x in SchedulerApiTest::testHideField from Drupal\Tests\scheduler\Functional
2x in SchedulerApiTest::testHookPublishUnpublishAction from Drupal\Tests\scheduler\Functional
1x in SchedulerFieldsDisplayTest::testVerticalTabOrFieldset from Drupal\Tests\scheduler\Functional
1x in SchedulerFieldsDisplayTest::testDisabledFields from Drupal\Tests\scheduler\Functional
1x in SchedulerMetaInformationTest::testMetaInformation from Drupal\Tests\scheduler\Functional
Change Record https://www.drupal.org/node/3082086
Comments
Comment #2
gnanagowthaman sankar commentedHi @jonathan1055,
Here is the patch. Please let me know for any changes.
Thanks & Regards,
Gnanagowthaman sankar
Comment #3
gnanagowthaman sankar commentedPatch
Thanks & Regards,
Gnanagowthaman sankar
Comment #4
jonathan1055 commentedThank you for the working on this and for the patch. Good in general but you have actually changed more than is required. You have changed 37 lines overall but there should only be 30 changed lines - 21 for assertNotEmpty() and 9 for assertEmpty(). You have changed the lines which were testing a boolen value
$node->isPublished()which is OK. There are 8 of these in yout patch, which should be removed please.[edit]
That might mean that you have missed one other, because 37 - 8 = 29 and there are 30 warnings. The best way to find these is toI think that you have not missed any, one warning in BasicTest is produced twice for the same code line. So only 29 lines need to be fixed.To prove that the deprecation warnings have been fixed, add a temporary change to drupalci.yml with
suppress-deprecations: falseand add this to your patch (it wont get committed, it is just for the testing) - See my patch in #3093399-3: Deprecation: add $defaultTheme to BrowserTestBase for an example.Comment #5
gnanagowthaman sankar commentedHi @jonathan1055,
You are welcome. I made changes in this patch. Please let me know for any changes.
Thanks & Regards,
Gnanagowthaman sankar
Comment #6
jonathan1055 commentedPatch looks great. Results show no text "Support for asserting against non-boolean" so this looks good.
It is unfortunate that there is no way (yet) to suppress just one deprecation message in .drupalci.yml, it is either all or none (as far as I am aware). Those other deprecations are from #3093399: Deprecation: add $defaultTheme to BrowserTestBase
I am about to commit that other fix. The you can re-run your patch and it should pass all green.
Comment #7
gnanagowthaman sankar commentedOk sure @jonathan1055
Thanks & Regards,
Gnanagowthaman sankar
Comment #8
jonathan1055 commentedThanks for re-testing. Nice to see a green block.
I realised that instead of the multipe nested
$this->assertNotEmpty($this->xpath( ... )it is better to use the single function$assert->ElementExists('xpath', ... ). This is more direct and also clearer to understand.Comment #9
gnanagowthaman sankar commentedok sure @jonathan1055 let me make changes and let you know.
Thanks & Regards,
Gnanagowthaman sankar
Comment #10
jonathan1055 commentedI have already made those changes in the patch in #8 so there is nothing more you need to do. Thank you for your work on this.
Comment #11
gnanagowthaman sankar commentedok @jonathan1055, you are welcome.
Comment #12
jonathan1055 commentedHere's a patch to try out testing with core 8.6.
Comment #13
gnanagowthaman sankar commentedok @jonathan1055, let me check.
Comment #15
jonathan1055 commentedThank you. Committed and fixed.
Comment #17
jonathan1055 commentedThe RulesActions test contains
assertTrue()andassertFalse()using date values. These were missed when fixing the others (no deprecation warning messages were producded at core 8.8 and 8.9). But now that we can run the Rules tests at core 9.0 we get test failures:Node is not scheduled for publishing. Failed asserting that null is false.https://www.drupal.org/pift-ci-job/1794635
Comment #19
jonathan1055 commented