File tree Expand file tree Collapse file tree 4 files changed +20
-58
lines changed
Expand file tree Collapse file tree 4 files changed +20
-58
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ class Database extends Config
177177 'swapPre ' => '' ,
178178 'encrypt ' => false ,
179179 'compress ' => false ,
180- 'strictOn ' => false ,
180+ 'strictOn ' => true ,
181181 'failover ' => [],
182182 'port ' => 3306 ,
183183 'foreignKeys ' => true ,
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class Registrar
4141 'swapPre ' => '' ,
4242 'encrypt ' => false ,
4343 'compress ' => false ,
44- 'strictOn ' => false ,
44+ 'strictOn ' => true ,
4545 'failover ' => [],
4646 'port ' => 3306 ,
4747 ],
@@ -60,7 +60,7 @@ class Registrar
6060 'swapPre ' => '' ,
6161 'encrypt ' => false ,
6262 'compress ' => false ,
63- 'strictOn ' => false ,
63+ 'strictOn ' => true , // @todo 4.8.0 to remove
6464 'failover ' => [],
6565 'port ' => 5432 ,
6666 ],
@@ -79,7 +79,7 @@ class Registrar
7979 'swapPre ' => '' ,
8080 'encrypt ' => false ,
8181 'compress ' => false ,
82- 'strictOn ' => false ,
82+ 'strictOn ' => true , // @todo 4.8.0 to remove
8383 'failover ' => [],
8484 'port ' => 3306 ,
8585 'foreignKeys ' => true ,
@@ -100,7 +100,7 @@ class Registrar
100100 'swapPre ' => '' ,
101101 'encrypt ' => false ,
102102 'compress ' => false ,
103- 'strictOn ' => false ,
103+ 'strictOn ' => true , // @todo 4.8.0 to remove
104104 'failover ' => [],
105105 'port ' => 1433 ,
106106 ],
@@ -119,7 +119,7 @@ class Registrar
119119 'swapPre ' => '' ,
120120 'encrypt ' => false ,
121121 'compress ' => false ,
122- 'strictOn ' => false ,
122+ 'strictOn ' => true , // @todo 4.8.0 to remove
123123 'failover ' => [],
124124 ],
125125 ];
Original file line number Diff line number Diff line change @@ -30,13 +30,8 @@ final class InsertTest extends CIUnitTestCase
3030{
3131 use DatabaseTestTrait;
3232
33- /**
34- * @var Forge
35- */
36- public $ forge ;
37-
38- protected $ refresh = true ;
39- protected $ seed = CITestSeeder::class;
33+ protected $ seed = CITestSeeder::class;
34+ private Forge $ forge ;
4035
4136 public function testInsert (): void
4237 {
@@ -93,26 +88,10 @@ public function testInsertBatchFailed(): void
9388 {
9489 $ this ->expectException (DatabaseException::class);
9590
96- $ data = [
97- [
98- 'name ' => 'Grocery Sales ' ,
99- ],
100- [
101- 'name ' => null ,
102- ],
103- ];
104-
105- $ db = $ this ->db ;
106-
107- if ($ this ->db ->DBDriver === 'MySQLi ' ) {
108- // strict mode is required for MySQLi to throw an exception here
109- $ config = config ('Database ' );
110- $ config ->tests ['strictOn ' ] = true ;
111-
112- $ db = Database::connect ($ config ->tests );
113- }
114-
115- $ db ->table ('job ' )->insertBatch ($ data );
91+ $ this ->db ->table ('job ' )->insertBatch ([
92+ ['name ' => 'Grocery Sales ' ],
93+ ['name ' => null ],
94+ ]);
11695 }
11796
11897 public function testReplaceWithNoMatchingData (): void
Original file line number Diff line number Diff line change @@ -245,33 +245,16 @@ public function testTransStrictFalseAndDBDebugFalse(): void
245245 */
246246 public function testTransInsertBatchFailed (): void
247247 {
248- $ data = [
249- [
250- 'name ' => 'Grocery Sales ' ,
251- ],
252- [
253- 'name ' => null ,
254- ],
255- ];
256-
257- $ db = $ this ->db ;
258-
259- if ($ this ->db ->DBDriver === 'MySQLi ' ) {
260- // strict mode is required for MySQLi to throw an exception here
261- $ config = config ('Database ' );
262- $ config ->tests ['strictOn ' ] = true ;
263-
264- $ db = Database::connect ($ config ->tests );
265- }
248+ $ this ->db ->transStrict (false )->transBegin ();
249+ $ this ->db ->table ('job ' )->insertBatch ([
250+ ['name ' => 'Grocery Sales ' ],
251+ ['name ' => null ],
252+ ]);
266253
267- $ db ->transStrict (false )->transBegin ();
268- $ db ->table ('job ' )->insertBatch ($ data );
269-
270- $ this ->assertFalse ($ db ->transStatus ());
271-
272- $ db ->transComplete ();
254+ $ this ->assertFalse ($ this ->db ->transStatus ());
273255
274- $ db ->transStrict ();
256+ $ this ->db ->transComplete ();
257+ $ this ->db ->transStrict ();
275258
276259 $ this ->dontSeeInDatabase ('job ' , ['name ' => 'Grocery Sales ' ]);
277260 }
You can’t perform that action at this time.
0 commit comments