aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/integration/includes/user
diff options
context:
space:
mode:
authorPetr Pchelko <ppchelko@wikimedia.org>2021-04-26 19:15:43 -0700
committerPetr Pchelko <ppchelko@wikimedia.org>2021-04-29 05:13:55 -0700
commit8ef1a9826015048615f710b9c31e0a834b552bae (patch)
tree86aa04f76551f99a0f24225c3521ff40d827ec97 /tests/phpunit/integration/includes/user
parent8bec6ceebbc75dca98bcdb7229ca6a731f531107 (diff)
downloadmediawikicore-8ef1a9826015048615f710b9c31e0a834b552bae.tar.gz
mediawikicore-8ef1a9826015048615f710b9c31e0a834b552bae.zip
Add ActorStore::deleteActor
This is an extremely dangerous method, but it's needed for the temporary users magic in translate extension. At least going via ActorStore we can keep our in-process caches consistent and get rid of some static methods and caching in user object. Change-Id: I8157f7ccee7d72aee405e9b6109dfc1838e1f380
Diffstat (limited to 'tests/phpunit/integration/includes/user')
-rw-r--r--tests/phpunit/integration/includes/user/ActorStoreTest.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/phpunit/integration/includes/user/ActorStoreTest.php b/tests/phpunit/integration/includes/user/ActorStoreTest.php
index c0524353b366..e6a2c987cc62 100644
--- a/tests/phpunit/integration/includes/user/ActorStoreTest.php
+++ b/tests/phpunit/integration/includes/user/ActorStoreTest.php
@@ -817,6 +817,30 @@ class ActorStoreTest extends ActorStoreTestBase {
}
/**
+ * @covers ::deleteActor
+ */
+ public function testDelete() {
+ $store = $this->getStore();
+ $actor = new UserIdentityValue( 9999, 'DeleteTest' );
+ $actorId = $store->acquireActorId( $actor, $this->db );
+ $this->assertTrue( $store->deleteActor( $actor, $this->db ) );
+
+ $this->assertNull( $store->findActorId( $actor, $this->db ) );
+ $this->assertNull( $store->getUserIdentityByUserId( $actor->getId() ) );
+ $this->assertNull( $store->getUserIdentityByName( $actor->getName() ) );
+ $this->assertNull( $store->getActorById( $actorId, $this->db ) );
+ }
+
+ /**
+ * @covers ::deleteActor
+ */
+ public function testDeleteDoesNotExist() {
+ $this->assertFalse(
+ $this->getStore()->deleteActor( new UserIdentityValue( 9998, 'DoesNotExist' ), $this->db )
+ );
+ }
+
+ /**
* @covers ::getUnknownActor
*/
public function testGetUnknownActor() {