Closed bobbingwide closed 6 years ago
An additional problem arose with tables that had been created with a storage engine that's not capable of supporting transactions. i.e.. MyISAM tables. Even though the PHPUnit tests are constructed to disable auto commit and ROLLBACK changes at the end of the transaction, MyISAM tables will reflect all the changes that had been made.
Detect MyISAM tables in the database and not run the tests if any are present. Optionally offer to convert the tables to InnoDB.
See stack overflow for explanations and conversion routines. E.g.
http://stackoverflow.com/questions/20148/myisam-versus-innodb
Both WordPress and wordpress-develop-tests have now been updated to v4.8. The test that has been implemented supports WordPress being at a higher level than the wordpress-develop-tests.
The covert_engine method() in oik-innodb.php was never completed. When I ran it for real, against qw/oikcom) I found that the routine needed updating.
Running ALTER TABLE 'oikplug_wp993.wp_commentmeta' engine='InnoDB'
produced a WordPress database error [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use.
Rather than using
$query = $wpdb->prepare( "ALTER TABLE %s engine=%s", DB_NAME . "." . $result->table_name, $to_engine );
we'll just use
$query = sprintf( "ALTER TABLE %s engine=%s", $result->table_name, $to_engine );
When I first started running my in situ PHPUnit tests under WordPress 4.7 I was still using the wordpress-develop-tests plugin built against WordPress 4.6, and oik-batch v0.8.7.
It proved to be incompatible - see the table below. Explanation: In order to test the changes to WordPress core, the PHP Unit testing code needed to reflect the changes.
Solution: Update the wordpress-develop-tests to v4.7 AND update oik-batch ( v0.9.0 ). v0.9.0 of oik-batch contains its own version of
WP_UnitTestCase
and a different version offunctions.php
. The alternative versions are loaded by oik-batch'stests\bootstrap.php
file.See #16 and https://github.com/bobbingwide/wordpress-develop-tests/issues/2
The table below summarises what happens with different levels of WordPress, wordpress-develop-tests and oik-batch.
As you can see, the changes make in v0.9.0 makes it incompatible with PHP Unit testing using WordPress 4.6.
Proposed solution
oik-batch's bootstrap code should detect the versions in use and either report it nicely or, if possible, deal with it.
Current workaround
Using the table below, checkout the Git repositories to the appropriate levels before running the tests.