This adds a few very basic tests to this component. I started doing this
while working on T112865 but later realized I do not need to touch this
extension. However, I started setting up tests and wanted to submit them.
Bug: T112865
Change-Id: I9d00b2baed8da97ffb6af94a6e3b8b63621b876a
Titles that correspond to foreign files aren't included in the set of
titles returned by ApiPageSet#getGoodTitles. However, since
ApiQueryPageImages#execute finds files with wfFindFile, these "missing"
titles can be included.
Add the ApiQueryPageImages#getTitles helper function, which returns the
set of "good" titles union the set of missing titles in the File
namespace.
Also, register the PHPUnit tests directory in the UnitTestsList hook
handler.
The original version of this patch was reverted due to a (stupid) bug
wherein a fatal error was triggered because there was no check for there
being no missing titles in the File namespace [0] and, consequently, an
invalid operand was being passed to the array union operator. This bug
is fixed as well as proven to work with a simple set of test cases.
[0] https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FPageImages.git/47137e7ee671c89667d620bc04ac7649b1d9af96/ApiQueryPageImages.php#L31
Bug: T98791
Bug: T114417
Change-Id: I923e88dde3a8ced4921b4192d90b4f3dc4b19e7b
Fatal error: Invalid operand type was used: cannot perform this operation with arrays
This reverts commit 47137e7ee6.
Bug: T114417
Change-Id: I89a2bfd69775a698f3000f48ea85465e193fb095
Titles that correspond to foreign files aren't included in the set of
titles returned by ApiPageSet#getGoodTitles. However, since
ApiQueryPageImages#execute finds files with wfFindFile, these "missing"
titles can be included.
Add the ApiQueryPageImages#getTitles helper function, which returns the
set of "good" titles union the set of missing titles in the File
namespace.
Bug: T98791
Change-Id: I6ef9a925c749ed6c830c0ff9bb824753df65740a
PS25 and later changed things around a fair bit, meaning the previous update
needs some further updating. In some cases additional cleanup is also necessary
for future core API changes.
Bug: T96595
Change-Id: Iad2959862ea8a45ebddd0f076344f0f950d30c80
There's already a 'source' that points to the thumbnail URL
source and thus two 'sources' are confusing. Call it 'original'
intead, and move it to inside the 'thumbnail' dict so it is
clear what it is an original of
Bug: T94928
Change-Id: I3298e9ab511226c17010dc018f6e7d5f0a0babe5
In the spirit of escaping as close to the output as possible, cast $id
to an int before using it in the sql query where other types could lead
to sql injection.
Change-Id: I9e4ceaf67df4e0d2270302bd65ff0a022de03e6b
Change I7b37295e for mediawiki/core deprecates several methods, and more
importantly changes the format of the data returned from
ApiResult::getData(). This change should handle these differences in a
backwards-compatible manner.
Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678e