Commit graph

14 commits

Author SHA1 Message Date
Aaron Schulz
815912062f Move ApiQuery* tests under the /query subdirectory
Consistency aside, this is useful for grouping more tests
into separate threads when using directory based suites.

Bug: T50217
Change-Id: Ife9acd5990c4ae4a5fc18371559e93d7d86fb57d
2020-10-30 03:31:12 +00:00
DannyS712
0f826d1f73 Replace uses and hard deprecate Revision::newFromTitle
Also fixed a use of ::newFromId in benchmarkParse and Parser

Bug: T249183
Change-Id: I3219a72f1085836205dc497e2236b52db24d7c16
2020-04-18 04:47:10 +00:00
DannyS712
7380aba100 Pass a user to WikiPage::doDeleteArticleReal, use new signature
Don't need to worry about supporting prior versions, since its core

Bug: T247869
Change-Id: Iad9397327731817b8c276d0b9786c3bc5ecf6476
2020-03-19 00:54:29 +00:00
Timo Tijhof
643b1fce03 watchlist: Misc cleanup for ApiQueryRecentChangesIntegrationTest
* Avoid partial assertions using array subsets.
  Instead, explicitly ignore the keys we want to ignore,
  and then assert the array in full.

  This way, newly added properties are explicitly detected
  by the test, and it also automatically means that no bad
  properties can be added. For example, properties like 'new',
  'minor' and 'bot' express their meaning by sheer existence
  and must never be tolerated to exist.

  This was motivated by the many assertArraySubset() deprecation
  warnings that were making the CI build output very noisy,
  and thus it was difficult to quickly find real problems.

  - For testNamespaceParam() I added rcprop=title, as it was
    only asserting those keys. The alternative was to repeat
    all the assertions for the overall output, which other tests
    already did.

* Avoid using User::getName() or Title::getPrefixedText()
  in the asserted expected value. Be explicit. This also
  makes the test run considerably faster.

* Use 'tablesUsed' the way we normally do in MediaWiki unit
  tests, by declaring the class member. (We never use
  TestCase constructors.)

* Remove use of harcoded DB truncation for 'recentchanges'.
  MediaWikiIntegrationTestCase does this already, which is what
  `@group Database` and `tablesUsed` are for.

* Remove use of mutable TestUser, the user is never mutated.
  This allows the internal registry to re-use the same instance.

* Remove use of assertArrayHasKey() where it only checked
  something the test would immediately assert on the next line.
  We already have PHPUnit configured in general to assert and
  fail directly upon any undefined key access.

* Use sample names like Foo, Bar and Quux which are easier
  to remember and distinguish than overly long and similar
  titles with some word or number added at the end of them.

Change-Id: I8133e1199e3b1d053be7053795172891ad2bf48b
2020-03-08 18:24:22 +00:00
Thiemo Kreuz
e1dd371e11 Make use of PHPUnit's assertCount feature where possible
… and avoid assertEmpty() on arrays, in favor of a much more strict
assertSame( [] ).

Change-Id: I20266b0b1fc38a3a87666ba1b0793cb2b37d94a9
2020-03-02 15:58:41 +00:00
Daimona Eaytoy
6365eaab8d Autofix 94 PHPUnit 8 compat issues
Done automatically using the master version of MW codesniffer and
running composer fix.

Bug: T192167
Change-Id: If6b40f515fde32ab5eff074a90e821c30c791827
2019-12-13 15:29:10 +01:00
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
Aryeh Gregor
69ef837f41 Update MediaWikiTitleCodec to use NamespaceInfo
Depends-On: I759cde50e42020699138d32431c27428737f700f
Change-Id: I57d77754288449ec54b039802adae05d56fa5563
2019-04-14 14:55:58 +03:00
jenkins-bot
b37772a991 Merge "Add ability to filter based on rc_title in API" 2018-05-24 10:13:06 +00:00
Aryeh Gregor
ed40e8ec53 Get rid of ApiTestCase::doLogin
The function is entirely unnecessary.

Change-Id: I805520e5355119e872e602d0bfc93be26f227128
2018-04-11 20:17:52 +03:00
Amir Sarabadani
4158cb5b9b Add ability to filter based on rc_title in API
Bug: T57377
Change-Id: I0b14bde58a4012816f2998d663d88ab035c927b7
2018-03-16 14:58:52 +01:00
Brad Jorsch
27c61fb1e9 Add actor table and code to start using it
Storing the user name or IP in every row in large tables like revision
and logging takes up space and makes operations on these tables slower.
This patch begins the process of moving those into one "actor" table
which other tables can reference with a single integer field.

A subsequent patch will remove the old columns.

Bug: T167246
Depends-On: I9293fd6e0f958d87e52965de925046f1bb8f8a50
Change-Id: I8d825eb02c69cc66d90bd41325133fd3f99f0226
2018-02-23 10:06:20 -08:00
Thiemo Mättig
e02e140e2d Simplify ApiQueryRecentChangesIntegrationTest
This patch does two major things to the newly introduced
ApiQueryRecentChangesIntegrationTest:

* It rips the confusingly complicated assertArraySubsetsEqual appart.

* It removes all wikitext content. Note that no assertion is done on this
content (not even in the test that is about adding a category). The tests
run just fine with automatically generated content. I had to introduce the
$i counter to make sure consecutive edits are done with different content.
Otherwise the later edit is not stored.

Change-Id: Iae585be86f3fd9bff7d2b4b7b218d5b0b4258603
2017-12-27 13:23:17 +01:00
Amir Sarabadani
b29d4e2789 Integration tests for ApiQueryRecentChanges
It looks big but it's mostly copy from ApiQueryWatchlistIntegrationTest

Change-Id: I96ccd3e2813e77f47a4432ca434c1c6a212d90ea
2017-12-25 14:13:47 +01:00