Le 31/12/13 00:06, Jim Hu a écrit :
We have an extension that has modified the schema with
a view. Using MW 1.19 and mySQL 5.6, I'm trying to learn unit testing to do some code
archaeology and refactoring. When I run tests/phpunit/phpunit.php I get:
$ php phpunit.php
PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from /Library/WebServer/Documents/GO/wiki/tests/phpunit/suite.xml
A database error has occurred. Did you forget to run maintenance/update.php after
upgrading? See:
https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: CREATE TEMPORARY TABLE `unittest_cacao_open_challenges_view` (LIKE
`cacao_open_challenges_view`)
Function: DatabaseMysql::duplicateTableStructure
Error: 1347 'go_wikidb.cacao_open_challenges_view' is not BASE TABLE (localhost)
Since the schema change is there regardless of whether the extension is active or not,
the test crashes either way. The wiki works.
As I understand it, this is because mySQL doesn't allow temporary tables to be
created from views. So... I am guessing that I somehow need to tell phpunit to skip this
view when testing the database.
Hello,
Seems like it is the proper guess. Some people reported the issue
previously on bug
https://bugzilla.wikimedia.org/43571
Daniel Renfro, from VistaPrint, has been kind enough to babysit that
issue and got a patch merged:
https://gerrit.wikimedia.org/r/#/c/65301/
I have backported it in 1.22 so 1.22.0 should properly detects views and
skip them when running unit tests.
The patch might probably be applied on 1.19 as is.
cheers,
--
Antoine "hashar" Musso