diff options
author | Brian Evans <grknight@gentoo.org> | 2020-10-06 11:22:15 -0400 |
---|---|---|
committer | Brian Evans <grknight@gentoo.org> | 2020-10-06 11:22:15 -0400 |
commit | 4a2d3a0b7596731e11ef9257138653bec81d6fd3 (patch) | |
tree | 0e33fdfd38e791cc9ffe46f11f954a7dce86d618 /OAuth/tests/phpunit/Backend/MWOAuthHooksTest.php | |
parent | OpenIDConnect: Fix newly protected function (diff) | |
download | extensions-4a2d3a0b7596731e11ef9257138653bec81d6fd3.tar.gz extensions-4a2d3a0b7596731e11ef9257138653bec81d6fd3.tar.bz2 extensions-4a2d3a0b7596731e11ef9257138653bec81d6fd3.zip |
Add OAuth for API access
Signed-off-by: Brian Evans <grknight@gentoo.org>
Diffstat (limited to 'OAuth/tests/phpunit/Backend/MWOAuthHooksTest.php')
-rw-r--r-- | OAuth/tests/phpunit/Backend/MWOAuthHooksTest.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/OAuth/tests/phpunit/Backend/MWOAuthHooksTest.php b/OAuth/tests/phpunit/Backend/MWOAuthHooksTest.php new file mode 100644 index 00000000..116c4a46 --- /dev/null +++ b/OAuth/tests/phpunit/Backend/MWOAuthHooksTest.php @@ -0,0 +1,34 @@ +<?php + +namespace MediaWiki\Extensions\OAuth\Tests\Backend; + +use MediaWiki\Extensions\OAuth\Backend\Hooks; +use PHPUnit\Framework\TestCase; +use Status; +use User; + +/** + * @covers \MediaWiki\Extensions\OAuth\Backend\MWOAuthServer + */ +class MWOAuthHooksTest extends TestCase { + + /** + * @dataProvider provideOnChangeTagCanCreate + */ + public function testOnChangeTagCanCreate( $tagName, $statusOk ) { + $status = Status::newGood(); + Hooks::onChangeTagCanCreate( $tagName, new User, $status ); + $this->assertSame( $statusOk, $status->isOK() ); + } + + public function provideOnChangeTagCanCreate() { + return [ + [ 'foo', true ], + [ 'OAuth CID', true ], + [ 'OAuth CID:', false ], + [ 'oauth cid:', false ], + [ 'OAuth CID: 123', false ], + ]; + } + +} |