eZ\Bundle\EzPublishCoreBundle\Features\Context\UserContext::findNonExistingUserEmail PHP Method

findNonExistingUserEmail() private method

Find a non existing User email.
private findNonExistingUserEmail ( $username = 'User' ) : string
return string A not used email
    private function findNonExistingUserEmail($username = 'User')
    {
        $email = "{$username}@ez.no";
        if ($this->checkUserExistenceByEmail($email)) {
            return $email;
        }
        for ($i = 0; $i < 20; ++$i) {
            $email = 'User#' . uniqid() . '@ez.no';
            if (!$this->checkUserExistenceByEmail($email)) {
                return $email;
            }
        }
        throw new \Exception('Possible endless loop when attempting to find a new email for User.');
    }