[wp-trac] [WordPress Trac] #41781: do not forcefully phpunit delete fixtures data

WordPress Trac noreply at wordpress.org
Sat Sep 2 02:06:24 UTC 2017


#41781: do not forcefully phpunit delete fixtures data
------------------------------+-----------------------------
 Reporter:  drzraf            |      Owner:
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:  4.8.1
 Severity:  normal            |   Keywords:
  Focuses:  performance       |
------------------------------+-----------------------------
 When phpunit runs, there are at least three places where test-data are
 removed (see below).

 Fixture deletion is good in its principle. But it's also sometimes
 painful, especially when one is in the process of developing tests and
 need to run the testsuite many times.

 WP (re)installation + shared XML fixture loading could easily be
 '''very''' slow (especially given XML importer slowness).
 If your plugin's testsuite does not even contains destructive operations
 (or controlled destructions) then all that time spent in testsuite
 (re)installation is very frustrating. (In my case it's 1 minutes 50 versus
 2 seconds)


 It would be good if developers could control whether or not fixtures are
 deleted & database cleaned, when phpunit starts/finishes.


 Places that need change:
 * [https://github.com/WordPress/wordpress-
 develop/blob/ce8a915/tests/phpunit/includes/bootstrap.php#L68 system(
 WP_PHP_BINARY ... install.php)]
 * [https://github.com/WordPress/wordpress-
 develop/blob/ce8a915/tests/phpunit/includes/bootstrap.php#L101
 _delete_all_posts()]

 There is also: [https://github.com/WordPress/wordpress-
 develop/blob/ce8a91/tests/phpunit/includes/testcase.php#L83
 _delete_all_data() inside tearDownAfterClass()] but this one can be easily
 overriden.


 Could a couple of filter/action/define/whatever could be made so that data
 cleanup, being the default, could be disabled if developer wants to?
 thx

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


More information about the wp-trac mailing list