@@ -60,14 +60,25 @@ public function testInsertUserObject(): void
6060 ]);
6161 }
6262
63+ /**
64+ * This test is not correct.
65+ *
66+ * Entity's `toArray()` method returns array with properties and values.
67+ * The array may have different keys with the DB column names.
68+ * And the values may be different types with the DB column types.
69+ * So $userArray is not data to be inserted into the database.
70+ */
6371 public function testInsertUserArray (): void
6472 {
6573 $ users = $ this ->createUserModel ();
6674
6775 $ user = $ this ->createNewUser ();
6876
6977 $ userArray = $ user ->toArray ();
70- $ id = $ users ->insert ($ userArray );
78+ // Fix value type
79+ $ userArray ['active ' ] = (int ) $ userArray ['active ' ];
80+
81+ $ id = $ users ->insert ($ userArray );
7182
7283 $ this ->dontSeeInDatabase ('auth_identities ' , [
7384 'user_id ' => $ id ,
@@ -85,7 +96,7 @@ private function createNewUser(): User
8596 $ user ->username = 'foo ' ;
8697 $ user ->email = 'foo@bar.com ' ;
8798 $ user ->password = 'password ' ;
88- $ user ->active = 0 ;
99+ $ user ->active = false ;
89100
90101 return $ user ;
91102 }
@@ -100,7 +111,7 @@ public function testSaveUpdateUserObjectWithUserDataToUpdate(): void
100111
101112 $ user ->username = 'bar ' ;
102113 $ user ->email = 'bar@bar.com ' ;
103- $ user ->active = 1 ;
114+ $ user ->active = true ;
104115
105116 $ users ->save ($ user );
106117
@@ -124,7 +135,7 @@ public function testUpdateUserObjectWithUserDataToUpdate(): void
124135
125136 $ user ->username = 'bar ' ;
126137 $ user ->email = 'bar@bar.com ' ;
127- $ user ->active = 1 ;
138+ $ user ->active = true ;
128139
129140 $ users ->update (null , $ user );
130141
@@ -138,6 +149,14 @@ public function testUpdateUserObjectWithUserDataToUpdate(): void
138149 ]);
139150 }
140151
152+ /**
153+ * This test is not correct.
154+ *
155+ * Entity's `toArray()` method returns array with properties and values.
156+ * The array may have different keys with the DB column names.
157+ * And the values may be different types with the DB column types.
158+ * So $userArray is not data to be inserted into the database.
159+ */
141160 public function testUpdateUserArrayWithUserDataToUpdate (): void
142161 {
143162 $ users = $ this ->createUserModel ();
@@ -148,9 +167,12 @@ public function testUpdateUserArrayWithUserDataToUpdate(): void
148167
149168 $ user ->username = 'bar ' ;
150169 $ user ->email = 'bar@bar.com ' ;
151- $ user ->active = 1 ;
170+ $ user ->active = true ;
152171
153172 $ userArray = $ user ->toArray ();
173+ // Fix value type
174+ $ userArray ['active ' ] = (int ) $ userArray ['active ' ];
175+
154176 $ users ->update (null , $ userArray );
155177
156178 $ this ->dontSeeInDatabase ('auth_identities ' , [
0 commit comments