[wp-trac] [WordPress Trac] #49635: Build tools: Remove generated and package sourced files from committed code.

WordPress Trac noreply at wordpress.org
Mon May 10 07:52:23 UTC 2021


#49635: Build tools: Remove generated and package sourced files from committed
code.
------------------------------+-----------------------
 Reporter:  peterwilsoncc     |       Owner:  gziolo
     Type:  enhancement       |      Status:  assigned
 Priority:  normal            |   Milestone:  5.8
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:
------------------------------+-----------------------

Comment (by gziolo):

 Removing everything from `src/wp-includes/blocks` folder fails 10 unit
 tests and causes 4 errors:

 {{{
 There were 4 errors:

 1) WP_Test_Render_Reusable_Blocks::test_render
 Error: Call to a member function render() on null

 /var/www/tests/phpunit/tests/blocks/render-reusable.php:87

 2) WP_Test_Render_Reusable_Blocks::test_render_subsequent
 Error: Call to a member function render() on null

 /var/www/tests/phpunit/tests/blocks/render-reusable.php:98

 3) WP_Test_Render_Reusable_Blocks::test_ref_empty
 Error: Call to a member function render() on null

 /var/www/tests/phpunit/tests/blocks/render-reusable.php:125

 4) WP_Test_Render_Reusable_Blocks::test_ref_wrong_post_type
 Error: Call to a member function render() on null

 /var/www/tests/phpunit/tests/blocks/render-reusable.php:131

 --

 There were 10 failures:

 1) WP_Test_Render_Reusable_Blocks::test_recursive_render_warning
 Failed asserting that exception of type "Error" matches expected exception
 "PHPUnit_Framework_Error_Warning". Message was: "Call to a member function
 render() on null" at
 /var/www/tests/phpunit/tests/blocks/render-reusable.php:120
 .

 2) WP_Test_Block_Render::test_do_blocks_removes_comments
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@

  <p>Third Auto Paragraph</p>

 -<p>[someshortcode]</p>
 -<p>And some content?!</p>
 -<p>[/someshortcode]</p>
 +
 +[someshortcode]
 +
 +And some content?!
 +
 +[/someshortcode]

  '

 /var/www/tests/phpunit/includes/abstract-testcase.php:668
 /var/www/tests/phpunit/tests/blocks/render.php:63

 3) WP_Test_Block_Render::test_the_content
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
  '<p>Foo</p>
 -</p>
 -<p>Bar</p>
 -<p>
 +Bar
  <p>Baz</p>'

 /var/www/tests/phpunit/tests/blocks/render.php:83

 4) WP_Test_Block_Render::test_do_block_output with data set #1
 ('core__archives.html', 'core__archives.server.html')
 File
 '/var/www/tests/phpunit/includes/../data/blocks/fixtures/core__archives.html'
 does not match expected value
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -'<div class=" wp-block-archives-list wp-block-archives">No archives to
 show.</div>'
 +''

 /var/www/tests/phpunit/tests/blocks/render.php:228

 5) WP_Test_Block_Render::test_do_block_output with data set #2
 ('core__archives__showPostCounts.html',
 'core__archives__showPostCount...r.html')
 File
 '/var/www/tests/phpunit/includes/../data/blocks/fixtures/core__archives__showPostCounts.html'
 does not match expected value
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -'<div class=" wp-block-archives-list wp-block-archives">No archives to
 show.</div>'
 +''

 /var/www/tests/phpunit/tests/blocks/render.php:228

 6) WP_Test_Block_Render::test_do_block_output with data set #6
 ('core__categories.html', 'core__categories.server.html')
 File
 '/var/www/tests/phpunit/includes/../data/blocks/fixtures/core__categories.html'
 does not match expected value
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -'<ul class="wp-block-categories-list wp-block-categories"><li class="cat-
 item-none">No categories</li></ul>
 +'
  '

 /var/www/tests/phpunit/tests/blocks/render.php:228

 7) WP_Test_Block_Render::test_do_block_output with data set #33
 ('core__latest-comments.html', 'core__latest-comments.server.html')
 File '/var/www/tests/phpunit/includes/../data/blocks/fixtures
 /core__latest-comments.html' does not match expected value
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -'<div class="has-avatars has-dates has-excerpts no-comments wp-block-
 latest-comments">No comments to show.</div>
 +'
  '

 /var/www/tests/phpunit/tests/blocks/render.php:228

 8) WP_Test_Block_Render::test_do_block_output with data set #34
 ('core__latest-posts.html', 'core__latest-posts.server.html')
 File '/var/www/tests/phpunit/includes/../data/blocks/fixtures
 /core__latest-posts.html' does not match expected value
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -'<ul class="wp-block-latest-posts__list wp-block-latest-posts"></ul>
 +'
  '

 /var/www/tests/phpunit/tests/blocks/render.php:228

 9) WP_Test_Block_Render::test_do_block_output with data set #35
 ('core__latest-posts__displayPo...e.html', 'core__latest-
 posts__displayPo...r.html')
 File '/var/www/tests/phpunit/includes/../data/blocks/fixtures
 /core__latest-posts__displayPostDate.html' does not match expected value
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -'<ul class="wp-block-latest-posts__list has-dates wp-block-latest-
 posts"></ul>
 +'
  '

 /var/www/tests/phpunit/tests/blocks/render.php:228

 10) WP_Test_Block_Render::test_do_block_output with data set #54
 ('core__shortcode.html', 'core__shortcode.server.html')
 File
 '/var/www/tests/phpunit/includes/../data/blocks/fixtures/core__shortcode.html'
 does not match expected value
 Failed asserting that two strings are identical.
 --- Expected
 +++ Actual
 @@ @@
 -'<p>[gallery ids="238,338"]</p>
 +'
 +[gallery ids="238,338"]

  '

 /var/www/tests/phpunit/tests/blocks/render.php:228

 ERRORS!
 Tests: 12222, Assertions: 56287, Errors: 4, Failures: 10, Skipped: 15.
 }}}

 Adding PHP files back doesn't change anything because those tests depend
 on registered core blocks that use `block.json` files that we would like
 to keep out of svn tracking. As far as I can tell, we don't run `npm run
 build:dev` when executing GitHub workflows so this would be an issue there
 as well.

 I expect the same set of challenges when we remove `wp-includes/assets
 /script-loader-packages.php` from svn.

 Should we introduce some sort of integration testing that would run after
 `npm run build:dev` to perform some basic checks on whether the block
 editor gets updated correctly?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49635#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list