Hashar has uploaded a new change for review. Change subject: Generic API loading system ......................................................................
Generic API loading system This patch abstract out the login system which was previously only available to UploadTestCase childs. Basically moved it to ApiTestCase so other API tests can reuse it. When you want to make an API call that need a token, you can make it depends upon testLogin() which will return a session that can in turn be passed as an argument to your test command. Acquiring a session is thus as easy as doing: class MyTest extends ApiTestCase { function testLoginSysop() { return ApiTestCase::testLoginSysop(); } /** * @depends testLogin */ function testSomething( $session ) { $this->doApiRequestWithTokens( $queryParams, $session, self::$users['sysop']->user ); } } Whenever testSomething() is triggered, it will first trigger testLogin and acquire you a token to play with. The local testLoginSysop() is required because PHPUnit does not let you depends from a test in the parent class. Code originally by Neil Kandalgaonkar Change-Id: I0258831fd41bed6196bac42980ab8213711720c9 --- M tests/phpunit/includes/api/ApiTestCase.php M tests/phpunit/includes/api/ApiUploadTest.php 2 files changed, 88 insertions(+), 37 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/05/14305/1 -- To view, visit https://gerrit.wikimedia.org/r/14305 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0258831fd41bed6196bac42980ab8213711720c9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Hashar <has...@free.fr> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits