Commit graph

21 commits

Author SHA1 Message Date
daniel
9205808960 Fix handling of strings containing \0 in SQLite.
This change provides a workaround and test case for a problem
in the sqlite library:

SQLite truncates strings at ASCII value 00 aka \0. Strings
containing \0 need to be represented in hexadecimal form.

Reported to PHP as bug 63419
 https://bugs.php.net/bug.php?id=63419

Change-Id: I2bbc445ffebd41e181edfc3201e6e5514de06142
2012-11-02 14:23:55 +01:00
Timo Tijhof
181c7cdc8e Clean and repair many phpunit tests (+ fix implied configuration)
This commit depends on the introduction of
MediaWikiTestCase::setMwGlobals in change Iccf6ea81f4.

Various tests already set their globals, but forgot to restore
them afterwards, or forgot to call the parent setUp, tearDown...

Either way they won't have to anymore with setMwGlobals.

Consistent use of function characteristics:
* protected function setUp
* protected function tearDown
* public static function (provide..)

(Matching the function signature with PHPUnit/Framework/TestCase.php)

Replaces:
 * public function (setUp|tearDown)\(
 * protected function $1(

 * \tfunction (setUp|tearDown)\(
 * \tprotected function $1(

 * \tfunction (data|provide)\(
 * \tpublic static function $1\(

Also renamed a few "data#", "provider#" and "provides#" functions
to "provide#" for consistency. This also removes confusion where
the /media tests had a few private methods called dataFile(),
which were sometimes expected to be data providers.

Fixes:

TimestampTest often failed due to a previous test setting a
different language (it tests "1 hour ago" so need to make sure
it is set to English).

MWNamespaceTest became a lot cleaner now that it executes with
a known context. Though the now-redundant code that was removed
didn't work anyway because wgContentNamespaces isn't keyed by
namespace id, it had them was values...

FileBackendTest:
* Fixed: "PHP Fatal: Using $this when not in object context"

HttpTest
* Added comment about:
  "PHP Fatal: Call to protected MWHttpRequest::__construct()"
  (too much unrelated code to fix in this commit)

ExternalStoreTest
* Add an assertTrue as well, without it the test is useless
  because regardless of whether wgExternalStores is true or false
  it only uses it if it is an array.

Change-Id: I9d2b148e57bada64afeb7d5a99bec0e58f8e1561
2012-10-09 03:01:51 +02:00
Christian Aistleitner
02c05b9d0e Correcting type of DatabaseSqlite::insertId()
Change-Id: I37ebe291cf8c4fd66a1ee236fcfa063016efbc8d
2012-04-06 21:02:27 +02:00
Antoine Musso
79c979b4e8 tests: mark tests requiring a database connection 2012-01-18 15:50:00 +00:00
Max Semenik
713ffa90f2 Moved SQLite test .sql files to the common test data directory 2011-12-22 09:18:39 +00:00
Max Semenik
e159355c7f Added 1.18 schema to tests, comment 2011-12-11 16:56:37 +00:00
Max Semenik
a1ec828b46 Follow-up r104051: fix tests 2011-11-23 17:27:08 +00:00
Max Semenik
3a20036ca4 Revert r98355 and r98357; drop the field instead. 2011-10-02 06:10:55 +00:00
Sam Reed
52bb2e5a28 Followup r98339
Don't try and remove the user_options column in SQLite

Added 'user.user_options' to ignores
2011-09-28 19:28:19 +00:00
Platonides
1d92cdc827 Follow up r93253. Do not mark DatabaseSqliteTest.php as needing a db.
An existing db is not needed, since it uses a memory one.
Having this in Database group fails in DatabaseSqlite->listTables 
since it is working with a MockDatabaseSqlite whose query() return true.
2011-07-27 14:50:10 +00:00
Chad Horohoe
edf1143de1 Mark 2 tests as requiring a DB...since they do :) 2011-07-26 23:39:48 +00:00
Max Semenik
94035c764f Follow-up r90356 & r90363: test deleteJoin() on SQLite 2011-06-18 20:37:02 +00:00
Max Semenik
b6905779bd Also check indexes in SQLite upgrade tests 2011-06-15 17:59:02 +00:00
Max Semenik
568b0489fe avoid test being marked as incomplete due to lack of assertions 2011-06-13 19:22:52 +00:00
Max Semenik
6bc8410924 Column checks for updater 2011-05-09 18:49:56 +00:00
Max Semenik
fcfa72b43a Automatic testing of SQLite updates from all (previoisly) supported versions 2011-05-09 16:41:51 +00:00
Platonides
eb7e30ee42 I forgot to commit this in r85906 2011-04-12 20:48:19 +00:00
Max Semenik
1275cc6df6 SQLite is picky about the position of AUTOINCREMENT in field definition, handle it when converting from MySQL syntax 2011-04-10 08:44:06 +00:00
Max Semenik
798dafa4dd Follow-up r82856: instead of remembering magic table names, just analyse its structure, added tests. 2011-02-26 16:45:35 +00:00
Chad Horohoe
447529064b * verbose and color default output from phpunit
* Make a bunch of tests subclass MediaWikiTestCase
* Parser tests and ResourceLoaderTest can't subclass it yet due to various issues
2010-12-28 18:17:16 +00:00
Chad Horohoe
23f69f10ed Per wikitech-l discussion: Move tests from maintenance/tests/ to tests/. They're not strictly maintenance scripts, and some people want to do a selective checkout that doesn't include the tests. There's still debate on whether we should include these in the release downloads, but we had a pretty firm consensus to move this. 2010-12-14 16:26:35 +00:00