Skip to content

fix: PostgreSQL tests #339

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

Merged
merged 7 commits into from
Aug 6, 2022
Merged

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Aug 5, 2022

Fixes #328
Fixes #327

  • add IntBoolCast
  • add abstract Entity class
  • fix migration file
  • fix CheckQueryReturnTrait
  • fix tests
$ composer test
> phpunit
PHPUnit 9.5.21 #StandWithUkraine

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

...............................................................  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.49   | 00:00:00.50 |
| Tests\\Controllers\\RegisterTest::testRegisterRedirectsToActionIfDefined                                       | 00:00:02.15   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\AccessTokenAuthenticatorTest::testLogin                                 | 00:00:01.47   | 00:00:00.50 |
| Tests\\Unit\\DictionaryValidatorTest::testCheckTrueOnNotFound                                                  | 00:00:01.16   | 00:00:00.50 |
| Tests\\Unit\\UserModelTest::testSaveUpdateUserObjectWithUserDataToUpdate                                       | 00:00:01.16   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testAttemptCannotFindUser                     | 00:00:01.04   | 00:00:00.50 |
| Tests\\Controllers\\LoginTest::testLoginActionUsernameSuccess                                                  | 00:00:01.01   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testShowEmail2FACreatesIdentity                                               | 00:00:00.96   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testLoginById                                 | 00:00:00.95   | 00:00:00.50 |
| Tests\\Authorization\\AuthorizableTest::testRemoveGroupExistingGroup                                           | 00:00:00.95   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testCheckSuccess                              | 00:00:00.93   | 00:00:00.50 |
| Tests\\Authentication\\MagicLinkTest::testMagicLinkSubmitSuccess                                               | 00:00:00.92   | 00:00:00.50 |
| Tests\\Unit\\UserModelTest::testSaveUpdateUserObjectWithoutUserDataToUpdate                                    | 00:00:00.91   | 00:00:00.50 |
| Tests\\Unit\\UserModelTest::testUpdateUserArrayWithUserDataToUpdate                                            | 00:00:00.91   | 00:00:00.50 |
| Tests\\Authentication\\AuthHelperTest::testAuthReturnsSpecifiedAuthenticator                                   | 00:00:00.89   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testAttemptUserHavingSessionDataAttemptsAgain | 00:00:00.88   | 00:00:00.50 |
| Tests\\Unit\\UserIdentityModelTest::testCreateCodeIdentityThrowsExceptionIfUniqueCodeIsNotGot                  | 00:00:00.88   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testPreviousLogin                                                                       | 00:00:00.86   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testCheckBadPassword                          | 00:00:00.85   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testEmailActivateVerify                                                       | 00:00:00.82   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testLoggedInFalse                             | 00:00:00.80   | 00:00:00.50 |
| Tests\\Authentication\\HasAccessTokensTest::testAccessTokens                                                   | 00:00:00.80   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testLoginWithRemember                         | 00:00:00.80   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testEmail2FAHandleSendsEmail                                                  | 00:00:00.79   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testModelfindByIdWithIdentities                                                         | 00:00:00.79   | 00:00:00.50 |
| Tests\\Authentication\\Authenticators\\SessionAuthenticatorTest::testForgetCurrentUser                         | 00:00:00.78   | 00:00:00.50 |
| Tests\\Controllers\\ActionsTest::testEmail2FAVerify                                                            | 00:00:00.78   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testUpdatePassword                                                                      | 00:00:00.76   | 00:00:00.50 |
| Tests\\Controllers\\LoginTest::testAfterLoggedInNotDisplayLoginPage                                            | 00:00:00.76   | 00:00:00.50 |
| Tests\\Unit\\UserTest::testUpdateEmail                                                                         | 00:00:00.75   | 00:00:00.50 |
+----------------------------------------------------------------------------------------------------------------+---------------+-------------+
...and 61 more tests hidden from view.


Time: 01:33.103, Memory: 42.00 MB

OK (225 tests, 513 assertions)

kenjis added 6 commits August 5, 2022 11:12
$this->db->disableForeignKeyChecks() does not work on PostgreSQL.
pg_query(): Query failed: ERROR: column "active" is of type smallint but expression is of type boolean
LINE 1: UPDATE "users" SET "active" = TRUE, "updated_at" = '2022-07-...
Postgre driver returns string as error code.
The DB column type is integer.
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! What do you think about submitting IntBoolCast to the framework?

@MGatner
Copy link
Member

MGatner commented Aug 5, 2022

It seems like all our tests are slower than Tachycardia wants; it might be good to increase the base rate so we can actually see which tests are particularly slow.

@kenjis
Copy link
Member Author

kenjis commented Aug 5, 2022

It might be slow because of my Docker environment.
Docker on macOS is generally slow.

@kenjis kenjis merged commit 9786d68 into codeigniter4:develop Aug 6, 2022
@kenjis kenjis deleted the fix-PostgreSQL-tests branch August 6, 2022 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PostgreSQL] Issue error register new user [PostgreSQL] Error migrate:rollback
2 participants