summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Evans <grknight@gentoo.org>2020-10-06 11:22:15 -0400
committerBrian Evans <grknight@gentoo.org>2020-10-06 11:22:15 -0400
commit4a2d3a0b7596731e11ef9257138653bec81d6fd3 (patch)
tree0e33fdfd38e791cc9ffe46f11f954a7dce86d618 /OAuth/tests/phpunit/Repository/ScopeRepositoryTest.php
parentOpenIDConnect: Fix newly protected function (diff)
downloadextensions-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/Repository/ScopeRepositoryTest.php')
-rw-r--r--OAuth/tests/phpunit/Repository/ScopeRepositoryTest.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/OAuth/tests/phpunit/Repository/ScopeRepositoryTest.php b/OAuth/tests/phpunit/Repository/ScopeRepositoryTest.php
new file mode 100644
index 00000000..41196aef
--- /dev/null
+++ b/OAuth/tests/phpunit/Repository/ScopeRepositoryTest.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace MediaWiki\Extensions\OAuth\Tests\Repository;
+
+use MediaWiki\Extensions\OAuth\Entity\ScopeEntity;
+use MediaWiki\Extensions\OAuth\Repository\ScopeRepository;
+use MediaWikiTestCase;
+
+/**
+ * @covers \MediaWiki\Extensions\OAuth\Repository\ScopeRepository
+ */
+class ScopeRepositoryTest extends MediaWikiTestCase {
+ public function testScopes() {
+ $repo = new ScopeRepository();
+
+ $this->assertInstanceOf(
+ ScopeEntity::class, $repo->getScopeEntityByIdentifier( 'editpage' ),
+ 'Scope \"editpage\" should be a valid scope'
+ );
+ $this->assertInstanceOf(
+ ScopeEntity::class, $repo->getScopeEntityByIdentifier( 'mwoauth-authonlyprivate' ),
+ 'Scope \"mwoauth-authonlyprivate\" should be a valid scope'
+ );
+
+ $this->assertNotInstanceOf(
+ ScopeEntity::class, $repo->getScopeEntityByIdentifier( 'dummynonexistent' ),
+ 'Scope \"dummynonexistent\" should not be a valid scope'
+ );
+ }
+}