Commit graph

23 commits

Author SHA1 Message Date
Max Semenik
48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00
Fomafix
110a5877e9 Use [...] instead of array(...) in PHP comments and documentation
Change-Id: I0c83783051bf35fe785bc01644eeb2946902b6b2
2019-06-17 21:15:09 +02:00
Legoktm
4e35134f7a Revert "Separate MediaWiki unit and integration tests"
This reverts commit 0a2b996278.

Reason for revert: Broke postgres tests.

Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
2019-06-13 23:00:08 +00:00
Máté Szabó
0a2b996278 Separate MediaWiki unit and integration tests
This changeset implements T89432 and related tickets and is based on exploration
done at the Prague Hackathon. The goal is to identify tests in MediaWiki core
that can be run without having to install & configure MediaWiki and its dependencies,
and provide a way to execute these tests via the standard phpunit entry point,
allowing for faster development and integration with existing tooling like IDEs.

The initial set of tests that met these criteria were identified using the work Amir did in
I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory
under phpunit/ and organized into a separate test suite. The environment for this suite
is set up via a PHPUnit bootstrap file without a custom entry point.

You can execute these tests by running:
$ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml

Bug: T89432
Bug: T87781
Bug: T84948
Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
2019-06-13 22:56:31 +02:00
Timo Tijhof
1d0e26cf83 UIDGenerator: Misc clean up
Various miscellaneous clean ups with no change to any of the
logical code. This to make the next commit have a cleaner diff
for easier review.

* Make internal millitime() non-static.

* Improve documentation and add missing @covers annotations.

* Correct getTimestampedID88() documentation to state that
  only two values need to be passed, not three.
  This is significant because the Flow extension is actually
  using this method in a subclass and passes only two values.

Bug: T94522
Change-Id: I2a0c51bea58df4cc0c253c1c10de3ac383f04c8e
2018-10-04 12:44:17 +02:00
Fomafix
1472f02b36 Phabricator: Use Tddddd instead of Bug ddddd in comments
Change-Id: Ic9fe03cab270bd6be738af346164ad5d31a0d780
2018-10-04 09:15:02 +02:00
Umherirrender
63d96c15fd build: Updating mediawiki/mediawiki-codesniffer to 16.0.0
Change-Id: I59b59f79bbf3ce4feff3b3a20c1c31bc16370531
2018-02-17 13:29:13 +01:00
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
Kunal Mehta
75160bdd3b Use MediaWikiCoversValidator for tests that don't use MediaWikiTestCase
Change-Id: I8c4de7e9c72c9969088666007b54c6fd23f6cc13
2018-01-01 08:28:02 +00:00
Bartosz Dziewoński
ecdef925bb Miscellaneous indentation tweaks
I was bored. What? Don't look at me that way.

I mostly targetted mixed tabs and spaces, but others were not spared.
Note that some of the whitespace changes are inside HTML output,
extended regexps or SQL snippets.

Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
2017-02-27 19:23:54 +01:00
Matthew Flaschen
aef78d13d4 Fix UID test and make debugging easier
This should fix the test and make the test failures (if any)
more informative.

The issue was that it was trying to extract a 46-bit segment
(the timestamp).  But because the whole thing wasn't 0-padded first,
the timestamp might be shorter.  So it would extract part of the next
segment too.  That meant it was testing a 46-bit segment with no
guaranteed properties, with arbitrary results.

Bug: T131549
Change-Id: I11c9e86951cc1d6b186710cda6e42ee58c920db8
2016-04-05 18:52:14 -04:00
Timo Tijhof
7c5991bcbc Disable flaky UIDGeneratorTest::testTimestampedUID test
Currently causing builds to break all over the place. Disable
until someone can attend to it.

Bug: T131549
Change-Id: I0eb29c53e70ef84a4facc137a3bf20f64a673511
2016-04-02 00:06:21 +01:00
jenkins-bot
ae69acacf5 Merge "Remove no-op parameter from UIDGeneratorTest" 2016-02-25 17:11:58 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Reedy
ca87078f16 Remove no-op parameter from UIDGeneratorTest
Change-Id: Ifdbfa007d7f5011403572d3bf2e1ac559ad93458
2016-01-24 12:39:47 +00:00
Ori Livneh
f5eba88680 Add UUIDv1 function to UIDGenerator
* Added some more unit tests.

Change-Id: Ieb7e66b1319df2e9c6da1518cc9539f276da1838
2015-12-05 20:14:11 +00:00
Reedy
00c426e3c2 Replace wfBaseConvert with Wikimedia\base_convert
Change-Id: Iadab3d018c3559daf79be90edb23d131729bdb68
2015-11-24 22:51:42 +00:00
aude
851552a5c4 Replace use of assertType with assertInternalType and assertInstanceOf
These are available in phpunit since 3.5.0, which I think
is reasonable to expect people to have at this point,
especially when we actually require 3.7.0 or higher in phpunit.php:

Use assertSame instead of assertArrayEquals in UIDGeneratorTest.
assertSame (and assertEqual) care about sortorder of the array,
and is perfectly sufficient in this case to check they array is correct.

if ( $puVersion !== '@package_version@' && version_compare( $puVersion, '3.7.0', '<' ) ) {
        die( "PHPUnit 3.7.0 or later required; you have {$puVersion}.\n" );
}

Change-Id: Ic32ab45110e4c4304ef046ae8d0e98c741255559
2015-04-09 01:15:44 -04:00
Tim Landscheidt
24b08513ef Fix errors in UIDGeneratorTest::testTimestampedUID
Currently, this test passes in Jenkins, but not with Travis
CI's hhvm where apparently code execution is slower so not
all UIDs are created within the same millisecond.  This also
previously masked that the test did not indeed test if the
host bits are identical as instead it tested the MSBs twice.

Bug: 73668
Change-Id: Ic68af599599ace5faa6a687d115d2d3802f6ba1b
2014-11-20 23:52:16 +00:00
Bryan Davis
e68e48c050 Delete UIDGenerator cache files after unit tests
Add a UIDGenerator::unitTestTearDown() method that can find an delete
cache files created by UIDGenerator. Call that cleanup method from the
tearDown() method of the UIDGenerator unit tests.

Bug: 44850
Change-Id: If342586d93bbc2a926af2dc388325dcb7c345e37
2014-04-02 23:58:28 +00:00
addshore
f86db05d8d Remove unused stuff from tests
Change-Id: Iddabfbc80378b02fa4a2c58f80d50241be8105d3
2014-03-07 21:16:32 +00:00
Aaron Schulz
f8f452554e Added per-node sequential ID method and made SquidUpdate use it
* This replaces a live wmf hack

Change-Id: Ie01fd27386d5d7197968b6a8157b7220ba685f7b
2014-01-03 00:41:33 +00:00
Siebrand Mazeland
8ba4964fac Move files with tests to reflect the code
Change-Id: I7949457fb1ad056dc3db09b43ecf73bc8a61d5a8
2013-11-07 18:03:04 +01:00
Renamed from tests/phpunit/includes/UIDGeneratorTest.php (Browse further)