aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/integration/includes/user
diff options
context:
space:
mode:
authorPetr Pchelko <ppchelko@wikimedia.org>2021-04-15 21:16:55 -0700
committerPetr Pchelko <ppchelko@wikimedia.org>2021-04-26 14:02:00 -0700
commitf50c097b9a04a5260d03c70ff8eb58a0f1ccdf6c (patch)
tree891dcc7d37e8e4d5b6d30484287b58dd748659d7 /tests/phpunit/integration/includes/user
parentc32e539bcd78820b0bcdecb727cebb718950e15e (diff)
downloadmediawikicore-f50c097b9a04a5260d03c70ff8eb58a0f1ccdf6c.tar.gz
mediawikicore-f50c097b9a04a5260d03c70ff8eb58a0f1ccdf6c.zip
Keep ActorStore caches consistent on user rename
Multi-key in-memory keys for the actors is complicated enough to have it's own small abstraction. Change-Id: Id0e091504b71a44ce52d418c5737d64ac70495e9
Diffstat (limited to 'tests/phpunit/integration/includes/user')
-rw-r--r--tests/phpunit/integration/includes/user/ActorStoreTest.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/phpunit/integration/includes/user/ActorStoreTest.php b/tests/phpunit/integration/includes/user/ActorStoreTest.php
index 79bd4d040f38..c0524353b366 100644
--- a/tests/phpunit/integration/includes/user/ActorStoreTest.php
+++ b/tests/phpunit/integration/includes/user/ActorStoreTest.php
@@ -750,6 +750,23 @@ class ActorStoreTest extends ActorStoreTestBase {
$this->assertSameActors( $anotherActor, $store->getActorById( $anotherActorId, $this->db ) );
}
+ public function testUserRenameUpdatesActor() {
+ $user = $this->getMutableTestUser()->getUser();
+ $oldName = $user->getName();
+
+ $store = $this->getStore();
+ $actorId = $store->findActorId( $user, $this->db );
+ $this->assertTrue( $actorId > 0 );
+
+ $user->setName( 'NewName' );
+ $user->saveSettings();
+
+ $this->assertSameActors( $user, $store->getActorById( $actorId, $this->db ) );
+ $this->assertSameActors( $user, $store->getUserIdentityByName( 'NewName' ) );
+ $this->assertSameActors( $user, $store->getUserIdentityByUserId( $user->getId() ) );
+ $this->assertNull( $store->getUserIdentityByName( $oldName ) );
+ }
+
/**
* @covers ::acquireSystemActorId
*/