[wp-trac] [WordPress Trac] #53781: Tests_Embed_Template tests fail when run in isolation

WordPress Trac noreply at wordpress.org
Mon Jul 26 10:25:19 UTC 2021


#53781: Tests_Embed_Template tests fail when run in isolation
------------------------------+-----------------------------
 Reporter:  jrf               |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:
 Severity:  minor             |   Keywords:  needs-patch
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 When running the `Tests_Embed_Template` test in isolation, two of the
 tests fail.
 {{{
 phpunit --filter Tests_Embed_Template
 }}}


 {{{
 #) Tests_Embed_Template::test_oembed_output_post_with_thumbnail
 DOMDocument::loadHTML(): AttValue: " expected in Entity, line: 10

 path/to/wp/tests/phpunit/tests/oembed/template.php:66

 #) Tests_Embed_Template::test_oembed_output_attachment
 DOMDocument::loadHTML(): AttValue: " expected in Entity, line: 10

 path/to/wp/tests/phpunit/tests/oembed/template.php:110
 }}}


 Accidentally discovered when I added the `import` group to the `<groups>`
 `<excludes>` and ran the complete test suite and those two tests - which
 are unrelated to the `import` tests - started erroring out.

 A tentative conclusion from that can be that:
 1. The `Tests_Embed_Template` tests have an undeclared dependency on the
 tests in the `import` group.
 2. The `Tests_Embed_Template` tests only pass by accident due to the
 **''order''** in which the tests are run, which is not guaranteed and can
 be influenced in more recent PHPUnit versions, so cannot be relied upon.
 Also see: https://phpunit.readthedocs.io/en/stable/configuration.html#the-
 executionorder-attribute


 This needs further investigation.

 Solution direction: The test should be made independent of the `import`
 tests.


 Originally reported in
 https://core.trac.wordpress.org/ticket/53363#comment:39

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53781>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list