Commit graph

17 commits

Author SHA1 Message Date
umherirrender
aa09312ac0 Remove require_once from some tests by adding classes to TestsAutoLoader
Change-Id: If6d0a72acb98e0971fcce2facb239b67cbe639a5
2014-11-12 20:24:08 +01:00
Thiemo Mättig
9bd9c31c73 Deprecate ORMTable::getFieldPrefix
Internal calls to this method show up in my XDebug profiling as
the second most called method (after array_key_exists). Called
10000 times. Sure, it's very cheap and clearly not a bottleneck.
But just not necesarry to have a method for that. The benefit of
having a method is to have a dynamic prefix that can change
depending on other things in an object. But I think this is not
a good idea for a prefix.

Since this is protected it is part of the contract of this class.
I already cleaned known subclasses. Should be @deprecated for
some time and can be removed later.

Change-Id: I46a0d7e072d0a69e9aef5f77e92044b62e3d0ce7
2014-10-14 16:14:17 +02:00
addshore
aea1b27db0 @covers tags for more test classes
Change-Id: I19d49c279646a4b4c595700e53b790ba4eb9521e
2013-10-24 20:35:04 +01:00
umherirrender
c6894adefc Fixed spacing
Added spaces around some parenthesis

Change-Id: If1e50e2a7b0046e91c0bbce8bf6641d8b2446a1d
2013-05-09 19:48:10 +02:00
Brent Garber
58c72e5aa6 Fix PHPUnit ORM Tests to work with Postgres
Change-Id: Ia4321727f6f1eab65c91d9876f87d51b545a72c2
2013-04-28 12:54:56 +00:00
Siebrand Mazeland
791d0b2a98 Update code formatting
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
2013-04-26 14:21:20 +00:00
nischayn22
b9b3d8821a (bug 37352) Boolean issue when using sqlite.
using a type cast instead, otherwise an empty string gets converted to
true when set with bool type.

Change-Id: I4161de32151a649161ab4084e80cafe4a462c7d5
2013-03-06 03:45:48 +00:00
umherirrender
83f883c7cb Fix data type for timestamp in TestORMRowTest
1) TestORMRowTest::testConstructor with data set #0 (array('Foobar',
'20120101020202', 42, 9000.1, true, array(13, 11, 7, 5, 3, 2),
stdClass), true)
Failed asserting that 2147483647 matches expected '20120101020202'.

Change-Id: I4dddaedf4e386c2061ee79fe0ab18af59033f052
2012-11-23 13:50:43 +01:00
umherirrender
93dd5435f0 drop orm_test table on teardown
No need to keep this table after the test

Change-Id: Id6814ceca063294da0761caa9a0d9975118dd4f1
2012-11-10 19:05:04 +00:00
daniel
980da6d6a7 ORMRow must not ignore failures on insert by deault.
ORMRow shouldn't apply the "IGNORE" modifier for insertions by default.
IGNORE means pretending the insert was successfull even if it wasn't.
That's not a good default, and for some databases (like sqlite), may
actually hide errors beyond key conflicts.

Change-Id: I8b00cd03a459419441195ed25091385371b027a5
2012-10-31 20:15:02 +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
jeroendedauw
38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00
Aaron Schulz
eb16f5898d [Database] Various DB cleanups.
* Removed unused and obsolete set() and safeQuery() functions.
* Removed unused deprecated constructor functions.
* Removed unused limitResultForUpdate() cruft function.
* Removed unused standardSelectDistinct(), it's better to just follow the standard for all queries.
* Removed other cruft functions unused by core/extensions.
* Made some internal functions protected.

Change-Id: I90be88ea740834a417a17d7751f1be7bac4eae4e
2012-08-08 11:00:48 -07:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Platonides
e4b2dea3c4 Use canonical class name. Include ORMRowTest.php
Change-Id: Ia6bc39492056bb3aa3a1a17097b71b70d1344e50
2012-06-03 15:22:31 +02:00
jeroendedauw
298c8b4786 Added base class for testing ORMRow deriving classes and added a mock implementation in order to test the abstract parent class itself
Patchset 2: attempt to fix sql error when using sqlite
Patchset 3: for great justice
Patchset 4: sqlite, not postgres... /facepalm
Patchset 5: joy, more sql divergence...
Patchset 7: handle inconsistencies in MWs database abstraction layer

Change-Id: I1948c4ad815008321801c93584eb249c1f597560
2012-05-28 17:35:05 +02:00