-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PHPUnit tests for more paths in MobilePage::class
* createTestTitle() - creates a title object from the Title class. * mockRevisionStoreReturnNullTitle() - mock Revision store that will return a revision by a null title. * testGetSmallThumbnailHtmlWithNoFile() - covers getSmallThumbnailHtml() in cases when no file is provided with or without a background image. * getGetSmallThumbnailHtmlWithNoFileDataProvider() - data provider for the testGetSmallThumbnailHtmlWithNoFile() unit test. * testLatestTimestamp() - covers the getLatestTimestamp() and also the setLatestTimestamp() paths default. * testLatestTimestampWithNullTitle() - covers the getLatestTimestamp() path for when the revision is null. * testLatestTimestampWhenNoRevision() - for when there is no revision at all. * testGetLatestEdit() - covers the getLatestEdit() method and also the getRevision() method too. * mockRevisionStore() - mocks the RevisionStore class and sets a service using MediaWikiServices' RevisionStore service to set a revision mock. This enables testing the getLatestEdit() method as it injects $rev into the class. * testGetSmallThumbnailHtmlWithNoThumb() - covers test case for there is a file provided but thumb couldn't be generated via calling the transform() method. Hence return empty string. Also, update Revision::newKnownCurrent() call to use the mediawiki service MediaWikiServices::getInstance()->getRevisionStore()->getRevisionByTitle(). Thanks to @pmiazga for the ideas and guidance for achieving this solution by using MediaWikiServices. Bug: T209476 Change-Id: I4234b2b731ccfd3fcce2cc8abf8a823b750ad115
- Loading branch information
Showing
2 changed files
with
240 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters