getLocaleOfSystemLanguage example

'uploaded_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT),
            'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT),
        ]);

        $connection->insert('user', [
            'id' => $userId,
            'first_name' => $username,
            'last_name' => '',
            'email' => "{$email}@example.com",
            'username' => $username,
            'password' => TestDefaults::HASHED_PASSWORD,
            'locale_id' => self::getLocaleOfSystemLanguage($connection),
            'active' => 1,
            'admin' => 0,
            'avatar_id' => $avatarId,
            'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_FORMAT),
        ]);

        $roleId = self::buildRole($permissions$connection);
        if ($roleId) {
            $connection->insert(
                'acl_user_role',
                [
                    
$username = Uuid::randomHex();
        $userId = Uuid::randomBytes();

        $connection = $browser->getContainer()->get(Connection::class);

        $user = [
            'id' => $userId,
            'first_name' => $username,
            'last_name' => '',
            'username' => $username,
            'password' => TestDefaults::HASHED_PASSWORD,
            'locale_id' => $this->getLocaleOfSystemLanguage($connection),
            'active' => 1,
            'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
        ];

        if ($aclPermissions !== null) {
            $aclRoleId = Uuid::randomBytes();
            $user['admin'] = 0;
            $user['email'] = md5(json_encode($aclPermissions, \JSON_THROW_ON_ERROR)) . '@example.com';
            $aclRole = [
                'id' => $aclRoleId,
                'name' => 'testPermissions',
                


        $password = $password ?? Random::getAlphanumericString(max($minPasswordLength, 8));

        $userPayload = [
            'id' => Uuid::randomBytes(),
            'first_name' => $additionalData['firstName'] ?? '',
            'last_name' => $additionalData['lastName'] ?? $username,
            'email' => $additionalData['email'] ?? 'info@shopware.com',
            'username' => $username,
            'password' => password_hash($password, \PASSWORD_BCRYPT),
            'locale_id' => $additionalData['localeId'] ?? $this->getLocaleOfSystemLanguage(),
            'active' => true,
            'admin' => $additionalData['admin'] ?? true,
            'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
        ];

        $this->connection->insert('user', $userPayload);

        return $password;
    }

    private function userExists(string $username): bool
    {
Home | Imprint | This part of the site doesn't use cookies.