createMock(User::class); $user->expects($this->once())->method('getIdentifier')->willReturn('userId'); $factory = new ValidatePermissionsCacheKeyFactory(); $key = $factory->create('resourceId', $user); $this->assertEquals('validperm:userId:resourceId', $key); } }