Skip to content

Conversation

@mshannaq
Copy link
Contributor

@mshannaq mshannaq commented Sep 24, 2023

Description
fix #851

number is variable and it should b us as is and not translated. and , comma should be in standard character .

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the lang Languages file label Sep 24, 2023
@datamweb
Copy link
Collaborator

datamweb commented Sep 24, 2023

public function testRegisterUserWhitPwnedValidatorActiveInLangAr(): void
{

$currentLocale = Locale::getDefault();
Locale::setDefault('ar');

$language = Services::language();
$language->setLocale('ar');

$config                      = config('Auth');
$config->passwordValidators  = [PwnedValidator::class];
Factories::injectMock('config', 'Auth', $config);

$this->expectException(TypeError::class);
$this->expectExceptionMessage('Cannot assign bool to property CodeIgniter\Shield\Result::$reason of type ?string');

$result = $this->post('/register', [
    'email'            => 'foo@example.com',
    'username'         => 'foo',
    'password'         => 'testpassword',
    'password_confirm' => 'testpassword',
]);

Locale::setDefault($currentLocale);
    
}

@kenjis, how can I set the defaultLocale = 'ar'?

@kenjis
Copy link
Member

kenjis commented Sep 24, 2023

Try

$language = Services::language();
$language->setLocale($locale);

@datamweb
Copy link
Collaborator

@kenjis Thank you!
It worked well.

@datamweb datamweb merged commit 425a550 into codeigniter4:develop Sep 24, 2023
@datamweb
Copy link
Collaborator

@mshannaq thank you!

@mshannaq mshannaq deleted the ar-fix branch September 24, 2023 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang Languages file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Cannot assign bool to property CodeIgniter\Shield\Result::$reason

3 participants