Page MenuHomePhabricator

PHPUnit warning noise from MwApiContentProviderTest (MobileFrontend)
Closed, ResolvedPublic

Description

These are making it hard for developers to find what the real issue is when they look at a build failure, especially if they're less experienced with PHPUnit or MW.

These warnings weren't there until a few weeks ago, which suggests it is either a recent regression due to a change in the test suite, or a pre-existing mistake that the recent PHPUnit upgrade started noticing and warning us about.

1) ApiMobileViewTest::testViewWithTransforms with data set #0 (array('Foo', '', 'thumb'), array(array(), array('http://dummy', 50, 50)))
Trying to set mock method "getWidth" with onlyMethods, but it does not exist in class "MockFSFile". Use addMethods() for methods that don't exist in the class.

2) ApiMobileViewTest::testViewWithTransforms with data set #1 (array('Foo', '', 'thumb', 55), array(array(), array('http://dummy', 55, 55)))
Trying to set mock method "getWidth" with onlyMethods, but it does not exist in class "MockFSFile". Use addMethods() for methods that don't exist in the class.

3) ApiMobileViewTest::testViewWithTransforms with data set #2 (array('Foo', '', 'thumb', 100), array(array(), array('http://dummy', 100, 480)))
Trying to set mock method "getWidth" with onlyMethods, but it does not exist in class "MockFSFile". Use addMethods() for methods that don't exist in the class.

4) ApiMobileViewTest::testViewWithTransforms with data set #3 (array('Foo', '', 'thumb', 200), array(array(), array('http://dummy', 640, 200)))
Trying to set mock method "getWidth" with onlyMethods, but it does not exist in class "MockFSFile". Use addMethods() for methods that don't exist in the class.

5) ApiMobileViewTest::testViewWithTransforms with data set #4 (array('Foo', '', 'thumb', 200, 'image/svg'), array(array(), array('http://dummy', 200, 150)))
Trying to set mock method "getWidth" with onlyMethods, but it does not exist in class "MockFSFile". Use addMethods() for methods that don't exist in the class.

6) ApiMobileViewTest::testViewWithTransforms with data set #5 (array('Foo', '', 'thumb', 200, 'image/svg'), array(array(), array('http://dummy', 267, 200)))
Trying to set mock method "getWidth" with onlyMethods, but it does not exist in class "MockFSFile". Use addMethods() for methods that don't exist in the class.

7) ApiMobileViewTest::testViewWithTransforms with data set #6 (array('Foo', '', 'thumb', 800, 'image/svg'), array(array(), array('http://dummy', 800, 600)))
Trying to set mock method "getWidth" with onlyMethods, but it does not exist in class "MockFSFile". Use addMethods() for methods that don't exist in the class.

8) ApiMobileViewTest::testViewWithTransforms with data set #7 (array('Foo', '', 'thumb', 800, 'image/svg'), array(array(), array('http://dummy', 1067, 800)))
Trying to set mock method "getWidth" with onlyMethods, but it does not exist in class "MockFSFile". Use addMethods() for methods that don't exist in the class.

9) MwApiContentProviderTest::testHttpRequestIsNotOK
Trying to set mock method "getPrefixedDBkey" with onlyMethods, but it does not exist in class "OutputPage". Use addMethods() for methods that don't exist in the class.

10) MwApiContentProviderTest::testGetHtmlWithNoRevIdAndValidTitle
Trying to set mock method "getPrefixedDBkey" with onlyMethods, but it does not exist in class "OutputPage". Use addMethods() for methods that don't exist in the class.

11) MwApiContentProviderTest::testGetHtmlWithIncorrectResponse
Trying to set mock method "getPrefixedDBkey" with onlyMethods, but it does not exist in class "OutputPage". Use addMethods() for methods that don't exist in the class.

12) MwApiContentProviderTest::testGetHtmlWithCorrectResponse
Trying to set mock method "getPrefixedDBkey" with onlyMethods, but it does not exist in class "OutputPage". Use addMethods() for methods that don't exist in the class.

Event Timeline

I can't replicate . Does it need a PHP version or argument? I'm running:

php ~/git/core/tests/phpunit/phpunit.php tests/phpunit/integration/api/ApiMobileViewTest.php
with PHP 7.4.0

Looks lke it was fixed already by 9298341908 (https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/MobileFrontend/+/574238/)
and 4ae4182dc (https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/MobileFrontend/+/586058/).

After the latter, there are no longer any of the above PHPUnit warnings in the Jenkins builds for paches on mediawiki repos (incl on MobileFrontend itself).