Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#46798 closed defect (bug) (duplicate)

PHPUnit warnings

Reported by: azaozz's profile azaozz Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: Cc:

Description

Running PHPUnit 7.5.8 (core doesn't yet support PHPUnit 8) there are a few warnings:

PHPUnit 7.5.8 by Sebastian Bergmann and contributors.

  Warning - The configuration file did not pass validation!
  The following problems have been detected:

  Line 8:
  - Element 'testsuite': The attribute 'name' is required but missing.

  Line 14:
  - Element 'file': This element is not expected. Expected is ( exclude ).

  Line 27:
  - Element 'log', attribute 'logIncompleteSkipped': The attribute 'logIncompleteSkipped' is not allowed.

  Test results may not be as expected.

Indeed the result are not as expected :)

Tests: 9646, Assertions: 71559, Errors: 269, Failures: 25, Skipped: 50.

Attachments (1)

46798.diff (1.0 KB) - added by azaozz 5 years ago.

Download all attachments as: .zip

Change History (5)

#1 @azaozz
5 years ago

The above failures are mostly from hard-coded line endings which fail on Windows:

Tests_Dependencies_Scripts::test_wp_set_script_translations_dependency
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
 '<script type='text/javascript' src='/wp-includes/js/dist/wp-i18n.js'></script>\n
 <script type='text/javascript'>\n
-( function( domain, translations ) {\n
-       var localeData = translations.locale_data[ domain ] || translations.locale_data.messages;\n
-       localeData[""].domain = domain;\n
-       wp.i18n.setLocaleData( localeData, domain );\n
+( function( domain, translations ) {\r\n
+       var localeData = translations.locale_data[ domain ] || translations.locale_data.messages;\r\n
+       localeData[""].domain = domain;\r\n
+       wp.i18n.setLocaleData( localeData, domain );\r\n

@azaozz
5 years ago

#2 @azaozz
5 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from Future Release to 5.3

Wondering how to best fix the above line endings problems. Can probably add a basic normalization as in 46798.diff, but seems a bit... fragile?

The other option is to do assertContains() as in all other HTML output testing. All errors are in phpunit/tests/dependencies/scripts.php and are caused by comparing with wp_scripts_print_translations_output. It tests translation scripts outputted with printf(). Seems we can test just one line there, not the whole script.

Last edited 5 years ago by azaozz (previous) (diff)

#3 in reply to: ↑ description @SergeyBiryukov
5 years ago

Replying to azaozz:

Running PHPUnit 7.5.8 (core doesn't yet support PHPUnit 8) there are a few warnings:

PHPUnit 7.5.8 by Sebastian Bergmann and contributors.

  Warning - The configuration file did not pass validation!
  The following problems have been detected:

  Line 8:
  - Element 'testsuite': The attribute 'name' is required but missing.

  Line 14:
  - Element 'file': This element is not expected. Expected is ( exclude ).

  Line 27:
  - Element 'log', attribute 'logIncompleteSkipped': The attribute 'logIncompleteSkipped' is not allowed.

  Test results may not be as expected.

Hmm, I'm pretty sure I've fixed at least two of these warnings in [44702], see comment:34:ticket:43218.

At least logIncompleteSkipped should no longer be there. Are you using a custom configuration file?

The above failures are mostly from hard-coded line endings which fail on Windows

Related: #31432

#4 @azaozz
5 years ago

  • Keywords 2nd-opinion removed
  • Milestone 5.3 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Yeah, don't see these warnings any more. Lets close this in favour of #31432 re: line endings.

Note: See TracTickets for help on using tickets.