summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'OAuth/tests/phpunit/Backend/MWOAuthHooksTest.php')
-rw-r--r--OAuth/tests/phpunit/Backend/MWOAuthHooksTest.php34
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 ],
+ ];
+ }
+
+}