[wp-trac] [WordPress Trac] #39327: Database connection errors in unit tests on 4.7
WordPress Trac
noreply at wordpress.org
Wed Dec 21 03:25:33 UTC 2016
#39327: Database connection errors in unit tests on 4.7
----------------------------------+-----------------------
Reporter: rmccue | Owner: pento
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 4.7.1
Component: Build/Test Tools | Version: 4.7
Severity: normal | Resolution:
Keywords: blame-gary has-patch | Focuses:
----------------------------------+-----------------------
Changes (by pento):
* keywords: needs-patch blame-gary => blame-gary has-patch
* owner: => pento
* status: new => assigned
* milestone: Future Release => 4.7.1
Comment:
In Core tests, `phpunit.xml.dist` has `backupGlobals="false"` defined,
hence why we never see this in Core.
For plugin tests that don't have this option set to `false`, `$wpdb` was
always being serialised/unserialised between tests, but
`WP_UnitTestCase::setUp()` took care of reconnecting. The changes to
`WP_UnitTestCase::setUpBeforeClass()` in [38398] introduced DB
interactions before the database was reconnected, however, causing this
warning to appear during plugin tests, but not Core tests.
For an immediate plugin fix, the best option is to add
`backupGlobals="false"` to your `phpunit.xms.dist`.
@rmccue: Could you also confirm that [attachment:39327.diff] fixes the
warning for you? If so, you'll need to remove the `blame-gary` tag on this
one. ;-)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39327#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list