Skip to content

fix: MySQL tests#336

Merged
kenjis merged 4 commits intocodeigniter4:developfrom
kenjis:fix-MySQL-tests
Aug 4, 2022
Merged

fix: MySQL tests#336
kenjis merged 4 commits intocodeigniter4:developfrom
kenjis:fix-MySQL-tests

Conversation

@kenjis
Copy link
Copy Markdown
Member

@kenjis kenjis commented Aug 3, 2022

See #331 (comment)

  • set property cast integer for User::$id
$ composer test
> phpunit
PHPUnit 9.5.21 #StandWithUkraine

Runtime:       PHP 8.0.21
Configuration: /Users/kenji/work/codeigniter/codeigniter-shield/phpunit.xml
Random Seed:   1659515574

...............................................................  63 / 218 ( 28%)
............................................................... 126 / 218 ( 57%)
............................................................... 189 / 218 ( 86%)
.............................                                   218 / 218 (100%)

Nexus\PHPUnit\Extension\Tachycardia identified these 30 slow tests:
+----------------------------------------------------------------------------------------------------------------+---------------+-------------+
| Test Case                                                                                                      | Time Consumed | Time Limit  |
+----------------------------------------------------------------------------------------------------------------+---------------+-------------+
| Tests\\Controllers\\ActionsTest::testEmail2FAVerify                                                            | 00:00:02.45   | 00:00:00.50 |
| Tests\\Controllers\\RegisterTest::testRegisterActionSuccess                                                    | 00:00:01.95   | 00:00:00.50 |
| Tests\\Controllers\\RegisterTest::testRegisterRedirectsToActionIfDefined                                       | 00:00:01.89   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testEmailActivateVerify                                                       | 00:00:01.81   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testEmailActivateCannotBeBypassed                                             | 00:00:01.68   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testEmail2FAHandleSendsEmail                                                  | 00:00:01.45   | 00:00:00.50 |
| Tests\\Authentication\\Filters\\TokenFilterTest::testFilterSuccess                                             | 00:00:01.44   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testLoggedInFalse                             | 00:00:01.28   | 00:00:00.50 |
| Tests\\Authorization\\AuthorizableTest::testAddPermissionWithExistingPermissions                               | 00:00:01.24   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\AccessTokenAuthenticatorTest::testCheckBadToken                         | 00:00:01.12   | 00:00:00.50 |
| Tests\\Unit\\DictionaryValidatorTest::testCheckTrueOnNotFound                                                  | 00:00:01.09   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testEmail2FAVerifyFails                                                       | 00:00:01.06   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testAttemptCaseInsensitive                    | 00:00:01.05   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testEmail2FACannotBeBypassed                                                  | 00:00:01.05   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testShowEmail2FACreatesIdentity                                               | 00:00:01.05   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testEmail2FAShow                                                              | 00:00:01.04   | 00:00:00.50 |
| Tests\\Controllers\\MagicLinkTest::testAfterLoggedInNotAllowDisplayMagicLink                                   | 00:00:01.02   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testForgetAnotherUser                         | 00:00:01.01   | 00:00:00.50 |
| Tests\\Authentication\\Filters\\TokenFilterTest::testFilterNotAuthorized                                       | 00:00:01.00   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testLoginByIdRemember                         | 00:00:00.98   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testEmailActivateShow                                                         | 00:00:00.94   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testGetIdentitiesByType                                                                 | 00:00:00.94   | 00:00:00.50 |
| Tests\\Unit\\UserIdentityModelTest::testCreateDuplicateRecordThrowsException                                   | 00:00:00.94   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testAttemptUserHavingSessionDataAttemptsAgain | 00:00:00.93   | 00:00:00.50 |
| Tests\\Authorization\\AuthorizableTest::testAddPermissionsWithUnknownPermission                                | 00:00:00.92   | 00:00:00.50 |
| Tests\\Controllers\\LoginTest::testLoginRedirectsToActionIfDefined                                             | 00:00:00.91   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testLoginWithRemember                         | 00:00:00.90   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testAttemptCannotFindUser                     | 00:00:00.90   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testAttemptUsernameOnly                       | 00:00:00.90   | 00:00:00.50 |
| Tests\\Unit\\UserIdentityModelTest::testCreateCodeIdentityThrowsExceptionIfUniqueCodeIsNotGot                  | 00:00:00.89   | 00:00:00.50 |
+----------------------------------------------------------------------------------------------------------------+---------------+-------------+
...and 101 more tests hidden from view.


Time: 01:59.134, Memory: 42.00 MB

OK (218 tests, 506 assertions)

@kenjis kenjis requested a review from MGatner August 3, 2022 22:28
kenjis added 4 commits August 4, 2022 17:37
User::$id should be 1, not '1'.
We don't need a user recored for the current SessionAuthenticatorTest.
@kenjis
Copy link
Copy Markdown
Member Author

kenjis commented Aug 4, 2022

$ composer test
> phpunit
PHPUnit 9.5.21 #StandWithUkraine

Runtime:       PHP 8.0.21
Configuration: /Users/kenji/work/codeigniter/codeigniter-shield/phpunit.xml
Random Seed:   1659602347

...............................................................  63 / 225 ( 28%)
............................................................... 126 / 225 ( 56%)
............................................................... 189 / 225 ( 84%)
....................................                            225 / 225 (100%)

Nexus\PHPUnit\Extension\Tachycardia identified these 30 slow tests:
+--------------------------------------------------------------------------------------------+---------------+-------------+
| Test Case                                                                                  | Time Consumed | Time Limit  |
+--------------------------------------------------------------------------------------------+---------------+-------------+
| Tests\\Controllers\\RegisterTest::testRegisterActionSuccess                                | 00:00:02.40   | 00:00:00.50 |
| Tests\\Controllers\\LoginTest::testLoginRedirectsToActionIfDefined                         | 00:00:02.29   | 00:00:00.50 |
| Tests\\Controllers\\RegisterTest::testRegisterRedirectsToActionIfDefined                   | 00:00:02.16   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testPreviousLogin                                                   | 00:00:02.11   | 00:00:00.50 |
| Tests\\Authorization\\AuthorizableTest::testCanCascadesToGroupsWithWildcards               | 00:00:01.64   | 00:00:00.50 |
| Tests\\Unit\\UserModelTest::testUpdateUserObjectWithoutUserDataToUpdate                    | 00:00:01.48   | 00:00:00.50 |
| Tests\\Authentication\\MagicLinkTest::testMagicLinkSubmitSuccess                           | 00:00:01.25   | 00:00:00.50 |
| Tests\\Unit\\UserModelTest::testSaveInsertUser                                             | 00:00:01.24   | 00:00:00.50 |
| Tests\\Controllers\\LoginTest::testLogoutAction                                            | 00:00:01.21   | 00:00:00.50 |
| Tests\\Authentication\\Filters\\ChainFilterTest::testFilterSuccessSeession                 | 00:00:01.21   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testGetIdentitiesSome                                               | 00:00:01.20   | 00:00:00.50 |
| Tests\\Unit\\DictionaryValidatorTest::testCheckTrueOnNotFound                              | 00:00:01.16   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\AccessTokenAuthenticatorTest::testCheckOldToken     | 00:00:01.15   | 00:00:00.50 |
| Tests\\Controllers\\LoginTest::testLoginActionEmailSuccess                                 | 00:00:01.09   | 00:00:00.50 |
| Tests\\Controllers\\RegisterTest::testRegisterDisplaysForm                                 | 00:00:01.08   | 00:00:00.50 |
| Tests\\Unit\\UserModelTest::testSaveUpdateUserObjectWithUserDataToUpdate                   | 00:00:01.05   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testAttemptCannotFindUser | 00:00:01.05   | 00:00:00.50 |
| Tests\\Controllers\\LoginTest::testLoginActionUsernameSuccess                              | 00:00:01.04   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testUpdatePasswordHash                                              | 00:00:01.04   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testAttemptUsernameOnly   | 00:00:01.03   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testModelfindAllWithIdentities                                      | 00:00:01.03   | 00:00:00.50 |
| Tests\\Controllers\\MagicLinkTest::testAfterLoggedInNotAllowDisplayMagicLink               | 00:00:01.00   | 00:00:00.50 |
| Tests\\Authorization\\AuthorizableTest::testAddPermissionWithNoExistingPermissions         | 00:00:01.00   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testActionShowNoneAvailable                               | 00:00:00.99   | 00:00:00.50 |
| Tests\\Unit\\UserModelTest::testUpdateUserArrayWithUserDataToUpdate                        | 00:00:00.98   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testModelfindByIdWithIdentities                                     | 00:00:00.98   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testGetIdentitiesByType                                             | 00:00:00.95   | 00:00:00.50 |
| Tests\\Authentication\\Filters\\TokenFilterTest::testFilterSuccess                         | 00:00:00.95   | 00:00:00.50 |
| Tests\\Authentication\\MagicLinkTest::testMagicLinkSubmitNoEmail                           | 00:00:00.94   | 00:00:00.50 |
| Tests\\Authorization\\AuthorizableTest::testRemoveGroupNoGroups                            | 00:00:00.94   | 00:00:00.50 |
+--------------------------------------------------------------------------------------------+---------------+-------------+
...and 108 more tests hidden from view.


Time: 02:02.688, Memory: 42.00 MB

OK (225 tests, 513 assertions)

@kenjis kenjis merged commit fa994dc into codeigniter4:develop Aug 4, 2022
@kenjis kenjis deleted the fix-MySQL-tests branch August 4, 2022 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants