-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lang('Auth.errorPasswordEmpty')
fails sometime
#88
Comments
lang('Auth.errorPasswordEmpty')
fails
lang('Auth.errorPasswordEmpty')
failslang('Auth.errorPasswordEmpty')
fails sometime
While we're collecting evidence I will add that I see this occasionally across many repos that use the framework. Not sure if it is some testing behavior or a bug in the repo itself. |
I see this error every day lately. |
I know, it's a pain. It happens elsewhere so definitely not something specific to this repo. Here's what I feel fairly certain about: the error only happens erratically because we run tests in random order, therefor the underlying issue has something to do with ordering of service interactions. That said, because it is random and rare it is very hard to reproduce the scenario that caused the failure to troubleshoot. My hunch is that it is related to |
|
It's a good practice. With so many moving pieces it is easy to write a test that passes accidentally because of some "bleed over" from another test. Sometimes it can complicate things like debugging though! We could disable the random order, but I doubt that would help fix the underlying issue. And long-term I would prefer to keep the tests random. |
I got the cause. This test case shows the cause. --- a/tests/Unit/PasswordsTest.php
+++ b/tests/Unit/PasswordsTest.php
@@ -6,6 +6,7 @@
use CodeIgniter\Shield\Config\Auth as AuthConfig;
use CodeIgniter\Shield\Entities\User;
use CodeIgniter\Test\CIUnitTestCase;
+use Config\Services;
/**
* @internal
@@ -14,6 +15,9 @@ final class PasswordsTest extends CIUnitTestCase
{
public function testEmptyPassword()
{
+ Services::reset();
+ d(Services::autoloader()->getNamespace());
+
$passwords = new Passwords(new AuthConfig());
$result = $passwords->check('', new User());
|
@MGatner The random order is fine. But it requires all test methods to be independent, or with proper
|
From #71 (comment)
https://github.com/codeigniter4/shield/runs/6222433930?check_suite_focus=true
Ref lonnieezell/myth-auth#494 (comment)
The text was updated successfully, but these errors were encountered: