getUserRepository(); $count = $repo->count([]); self::assertSame(self::COUNT, $count); $user = new User(); $user->setEmail(ByteString::fromRandom(6)->toString().'@example.com'); $user->setPassword('foo'); $repo->save($user, true); $count = $repo->count([]); self::assertSame(self::COUNT + 1, $count); $repo->upgradePassword($user, 'foo'); $repo->remove($user, true); $count = $repo->count([]); self::assertSame(self::COUNT, $count); } public function testUpgradePasswordException(): void { self::bootKernel(); $repo = $this->getUserRepository(); $user = $this->getMockBuilder(PasswordAuthenticatedUserInterface::class)->getMock(); $this->expectException(UnsupportedUserException::class); $repo->upgradePassword($user, 'foo'); } }