wiki.techinc.nl/tests/phpunit
C. Scott Ananian ea4bedee9d Remove misleading test in SerializationTestTrain::validateObjectEquality()
The initial object comparison using `==` compares all the property values
using `==` as well.  This causes (for example) the string "1" to compare
as equal to the number `1`, the empty string `""` to compare as equal
to the number `0` and other surprising things.

It appears that this comparison was done at an attempt at performance
optimization, but that has little place in a test suite.  Use the full
recursive strict comparison instead.

This requires updating one ParserCache test case which was apparently
created incorrectly (or not properly updated) and relied on the
previous behavior (numbers comparing as equal to strings) to pass.

Change-Id: Ife0e9ccc7be0f4933975bb326203693bc15a9658
2022-03-31 09:50:51 -04:00
..
data Remove misleading test in SerializationTestTrain::validateObjectEquality() 2022-03-31 09:50:51 -04:00
docs
includes Remove misleading test in SerializationTestTrain::validateObjectEquality() 2022-03-31 09:50:51 -04:00
integration/includes Merge "Improve error messages in EditFilterMergedContentHookConstraint" 2022-03-26 06:23:15 +00:00
languages Language: retrieve MainConfig instead of using a bunch of globals 2022-03-15 02:58:42 +00:00
maintenance Benchmark: Force string representation of arguments 2022-03-11 23:14:36 +00:00
mocks Set page id to 0 for pages in virtual namespaces 2022-03-10 20:12:27 +00:00
structure Add SpecialPageFatalTest to @group Database 2022-03-26 15:43:46 +02:00
suites SuiteEventsTrait: don't call setUp() for an empty suite 2022-03-17 14:47:21 +11:00
tests Revert "tests: Add @group Broken to 2022-03-17 23:02:55 +00:00
unit Merge "Copy over Parsoid's Config and ServiceWiring classes" 2022-03-29 18:29:16 +00:00
bootstrap.maintenance.php
bootstrap.php Define MW_INSTALL_PATH constant and BaseDirectory config. 2022-03-04 14:18:27 +01:00
HamcrestPHPUnitIntegration.php
LessFileCompilationTest.php
Makefile
MediaWikiCliOptions.php Improve ObjectCache integration tests 2022-02-11 10:20:33 +11:00
MediaWikiCoversValidator.php
MediaWikiGroupValidator.php
MediaWikiIntegrationTestCase.php Revert "phpunit: Set $wgSQLMode from DevelopmentSettings instead of MediaWikiIntegrationTestCase" 2022-03-24 16:55:02 +00:00
MediaWikiLangTestCase.php
MediaWikiLoggerPHPUnitExtension.php
MediaWikiPHPUnitCommand.php
MediaWikiPHPUnitResultPrinter.php
MediaWikiTestCaseTrait.php Add convenience methods for asserting status. 2022-03-16 22:44:25 +01:00
MediaWikiUnitTestCase.php Use updated ObjectFactory namespace 2022-03-09 23:04:51 +00:00
phpunit.php tests: Change use of AtEase to at operator 2022-02-24 21:29:51 +00:00
README
ResourceLoaderTestCase.php Define MW_INSTALL_PATH constant and BaseDirectory config. 2022-03-04 14:18:27 +01:00
run-tests.bat
suite.xml

== MediaWiki PHPUnit Tests ==

The unit and integration tests for MediaWiki are implemented using the PHPUnit testing
framework and require PHPUnit to run.


=== WARNING ===

Some of the integration tests are DESTRUCTIVE and WILL ALTER YOUR WIKI'S CONTENTS.

DO NOT RUN THESE TESTS ON A PRODUCTION SYSTEM OR ON ANY SYSTEM WHERE YOU NEED
TO RETAIN YOUR DATA.


== Installation ==

If you used composer to install MediaWiki's dependencies PHPUnit will already be available, unless
you explicitly specified the --no-dev flag during the install. In this case just run "composer update".

Otherwise follow the installation instructions in the
PHPUnit Manual at:

  https://phpunit.de/manual/current/en/installation.html


== Running tests ==

The tests are run from your operating system's command line.

Ensure that you are in the tests/phpunit directory of your MediaWiki
installation.


On Unix-like operating systems, the tests runs are controlled with a makefile.
Run command:

  make help

for a full list of options for running tests.


On Windows-family operating systems, run the 'run-tests.bat' batch file.


=== Writing tests ===

A guide to writing PHP unit tests for MediaWiki can be found at:

	https://www.mediawiki.org/wiki/Manual:PHP_unit_testing