[wp-trac] [WordPress Trac] #35249: Unit tests should pass

WordPress Trac noreply at wordpress.org
Wed Dec 30 04:45:07 UTC 2015


#35249: Unit tests should pass
------------------------------+------------------------------
 Reporter:  jrf               |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:
------------------------------+------------------------------

Comment (by dossy):

 It would be dirty, but we could force the column's character set in
 `tests/phpunit/tests/dbdelta.php` for the sake of the test:

 {{{
  28     // Forcing MyISAM, because InnoDB only started supporting FULLTEXT
 indexes in MySQL 5.7.
  29     // Forcing latin1, in case character_set_database is multi-byte.
  30     $wpdb->query(
  31       "
  32       CREATE TABLE {$wpdb->prefix}dbdelta_test (
  33         id bigint(20) NOT NULL AUTO_INCREMENT,
  34         column_1 varchar(255) CHARACTER SET latin1 NOT NULL,
  35         PRIMARY KEY  (id),
  36         KEY key_1 (column_1),
  37         KEY compoud_key (id,column_1),
  38         FULLTEXT KEY fulltext_key (column_1)
  39       ) ENGINE=MyISAM
  40       "
  41     );
 }}}

 But, that might lead to some subtle false positives (test that pass, but
 should fail).

 Maybe just adding a check to the `setUpBeforeClass()` that checks the
 `character_set_database` (using `SHOW CHARACTER SET LIKE 'name'`'s
 `Maxlen` value, if it's greater than 1) and raises an exception that the
 tests WILL fail because of the database default character set?  This way,
 if and when others get these same test failures, they aren't left
 scratching their heads as to why the tests fail for them but not everyone
 else ...

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


More information about the wp-trac mailing list