wiki.techinc.nl/tests/phpunit/includes
Timo Tijhof 3dad835561 content: Remove unclear assertEquals() on Status objects
We don't usually compare object serializations with assertEquals as
they tend to make it difficult to know what is and isn't being asserted,
giving the illusion that it checks "everything" but can in some cases
be closer to "too much" or "nothing".

Actual logic:
* https://github.com/sebastianbergmann/phpunit/blob/9.6.17/src/Framework/Assert.php#L330
* https://github.com/sebastianbergmann/phpunit/blob/9.6.17/src/Framework/Constraint/Equality/IsEqual.php
* https://github.com/sebastianbergmann/comparator/blob/5.0.1/src/ObjectComparator.php
* https://github.com/sebastianbergmann/exporter/blob/5.1.2/src/Exporter.php

This means sub classes or value objects are needlessly discarded,
as well as potentially irrelevant state in the object is becoming
part of the test.

It is not a surprise then, that these assertions are not comparing
against any particular desired outcome, but are literally a copy-paste
of the source code, including functions that have no effect in testing
such as `ContentHandler::getLocalizedName( 'testing' )` === 'testing',
and untested expressions like `$wikipage->getTitle()->getPrefixedText()`
instead of an explicit expectation.

Replace this with assertStatusError and limit the assertion to
being !isOK, and error using the specified interface message key.

Testing that the correct parameters are passed is imho not a part
of this test, since the test isn't actually validating it to be
correct or sensible in terms of message contents and parsed outcome,
it is only verifying that we have correctly copied the source, which
still needs the same review as it otherwise would.

Change-Id: I8c7a660489e9000f9790f8d69478a05ad8c446b6
2024-03-12 06:28:08 +00:00
..
actions tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
api Group temporary users with IP users in ApiQueryWatchlist filters 2024-03-03 06:26:03 +00:00
auth tests: More use statements in auth tests 2024-02-16 21:49:35 +00:00
block Namespace includes/context 2024-02-08 11:07:01 -05:00
cache Namespace includes/cache 2024-02-20 10:28:03 -05:00
Category tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
changes tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
changetags Add PHPUnit test for ChangeTagsList class 2024-02-23 16:05:45 +00:00
collation tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
CommentStore CommentStore: Remove unused getFields method 2024-01-20 16:21:39 +01:00
composer tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
config tests: Use namespaced class names in @covers annotations 2024-01-27 01:11:07 +01:00
content content: Remove unclear assertEquals() on Status objects 2024-03-12 06:28:08 +00:00
db rdbms: Drop ILoadBalancer::getAnyOpenConnection() 2023-11-28 15:42:39 +01:00
debug tests: Add replacement for assertions deprecated in PHPUnit 9.6 2024-02-23 22:09:45 +01:00
deferred Merge "ParserOutput::setPageProperty(): Emit deprecation warning for non-scalar values" 2024-03-11 17:08:20 +00:00
diff Fix weird (auto-generated?) namespaces in PHPUnit tests 2024-02-20 19:23:36 +00:00
editpage tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
exception tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
export Merge "[ParserOutput] Rename $mText to $mRawText and ::setText() to ::setRawText()" 2024-02-21 17:11:00 +00:00
ExternalLinks build: Fix line indents 2024-03-11 00:14:16 +01:00
externalstore tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
filebackend filebackend: add FileStatePredicates helper class for file operations 2024-02-21 14:00:27 -08:00
filerepo tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
GlobalFunctions
HookContainer tests: Add Tests to PHP namespacing 2024-02-16 19:10:11 +00:00
Html Rename dropdown-related methods to avoid random camel-case 2024-03-09 02:31:33 +01:00
http tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
import tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
installer Namespace WebInstaller classes 2024-01-11 23:29:14 +00:00
interwiki tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
jobqueue tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
language Follow-up "ZhConverter: Fix language variant fallback chain" 2024-03-08 11:37:41 +08:00
languages tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
libs tests: Move Wikimedia tests into Wikimedia\Tests 2024-02-17 02:09:08 +00:00
linkeddata tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
linker Namespace includes/cache 2024-02-20 10:28:03 -05:00
logging Namespace includes/cache 2024-02-20 10:28:03 -05:00
mail tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
media tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
Message Namespace Message, move to appropriate directory 2024-02-14 15:10:36 -05:00
Navigation
objectcache tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
Output build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0 2024-03-01 15:58:13 -05:00
OutputTransform Merge "HandleSectionLinks: Fix handling headings with raw > in attributes" 2024-03-04 21:09:43 +00:00
page Merge "parser: Remove LoggerSpi override from ParserOutputAccessTest" 2024-03-11 20:03:42 +00:00
pager Replace last remaining wfGetDB() calls in core, except ResourceLoader 2024-02-14 11:02:01 -05:00
ParamValidator/TypeDef tests: Move Wikimedia tests into Wikimedia\Tests 2024-02-17 02:09:08 +00:00
parser tests: Avoid php warnings about deprecation from data providers 2024-02-25 15:55:30 +00:00
password tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
Permissions tests: Add Tests to PHP namespacing 2024-02-16 19:10:11 +00:00
poolcounter Add ParserOutput::{get,set}RenderId() and set render id in ContentRenderer 2024-02-07 21:22:06 -05:00
preferences build: Fix line indents 2024-03-11 00:14:16 +01:00
profiler
rcfeed tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
registration tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
Request tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
ResourceLoader Merge "ResourceLoader: Migrate wfGetDB call to ICP and move to WikiModule" 2024-03-11 19:50:59 +00:00
Rest REST: allow lower-case method names 2024-03-06 13:15:17 +01:00
Revision Merge "[ParserOutput] Rename $mText to $mRawText and ::setText() to ::setRawText()" 2024-02-21 17:11:00 +00:00
search tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
session session: Improve text and documentation of SessionManager warnings 2024-02-26 11:34:13 +00:00
shell
site tests: Namespace Site classes 2024-02-17 00:50:52 +00:00
SiteStats tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
skins tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
sparql tests: Add Tests to PHP namespacing 2024-02-16 19:10:11 +00:00
specialpage ChangesListSpecialPage: Refactor user experience conditions 2024-03-06 17:29:42 +00:00
specials build: Fix line indents 2024-03-11 00:14:16 +01:00
Status message: Don't load user language when a specific language was requested 2024-03-04 12:03:38 +11:00
Storage tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
title Merge "Namespace includes/cache" 2024-02-28 15:10:38 +00:00
upload Add getCacheKey static method to UploadFromUrl 2024-02-28 16:15:39 +01:00
user Merge "Remove IDBAccessObject from being implemented in many classes" 2024-02-21 17:35:07 +00:00
utils tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
watcheditem Namespace includes/cache 2024-02-20 10:28:03 -05:00
WikiMap tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
xml Rename dropdown-related methods to avoid random camel-case 2024-03-09 02:31:33 +01:00
AutoLoaderTest.php tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
MediaWikiServicesTest.php tests: Fix @covers and @coversDefaultClass to have leading \ 2024-02-16 22:43:56 +00:00
MockServiceWiring.php
SampleTest.php
TestUser.php Change uses of getDBLoadBalancerFactory() to getConnectionProvider() 2024-01-22 22:27:45 +01:00
TestUserRegistry.php update a few tests to use PHP 7.4 syntax 2024-01-09 10:19:00 +02:00