@@ -20,8 +20,6 @@ abstract class ActiveQueryFindTest extends TestCase
20
20
{
21
21
public function testFindScalar (): void
22
22
{
23
- $ this ->checkFixture ($ this ->db (), 'customer ' );
24
-
25
23
$ customerQuery = new ActiveQuery (Customer::class);
26
24
27
25
/** query scalar */
@@ -32,8 +30,6 @@ public function testFindScalar(): void
32
30
33
31
public function testFindExists (): void
34
32
{
35
- $ this ->checkFixture ($ this ->db (), 'customer ' );
36
-
37
33
$ customerQuery = new ActiveQuery (Customer::class);
38
34
39
35
$ this ->assertTrue ($ customerQuery ->where (['[[id]] ' => 2 ])->exists ());
@@ -45,25 +41,21 @@ public function testFindExists(): void
45
41
46
42
public function testFindColumn (): void
47
43
{
48
- $ this ->checkFixture ($ this ->db (), 'customer ' );
49
-
50
44
$ customerQuery = new ActiveQuery (Customer::class);
51
45
52
46
$ this ->assertEquals (
53
47
['user1 ' , 'user2 ' , 'user3 ' ],
54
48
$ customerQuery ->select ('[[name]] ' )->column ()
55
49
);
56
50
57
- $ this ->assertEquals (
51
+ $ this ->assertSame (
58
52
['user3 ' , 'user2 ' , 'user1 ' ],
59
53
$ customerQuery ->orderBy (['[[name]] ' => SORT_DESC ])->select ('[[name]] ' )->column ()
60
54
);
61
55
}
62
56
63
57
public function testFindLazyViaTable (): void
64
58
{
65
- $ this ->checkFixture ($ this ->db (), 'order ' );
66
-
67
59
$ orderQuery = new ActiveQuery (Order::class);
68
60
69
61
$ orders = $ orderQuery ->findByPk (2 );
@@ -76,8 +68,6 @@ public function testFindLazyViaTable(): void
76
68
77
69
public function testFindEagerViaTable (): void
78
70
{
79
- $ this ->checkFixture ($ this ->db (), 'order ' );
80
-
81
71
$ orderQuery = new ActiveQuery (Order::class);
82
72
$ orders = $ orderQuery ->with ('books ' )->orderBy ('id ' )->all ();
83
73
$ this ->assertCount (3 , $ orders );
@@ -117,8 +107,6 @@ public function testFindEagerViaTable(): void
117
107
*/
118
108
public function testFindCompositeRelationWithJoin (): void
119
109
{
120
- $ this ->checkFixture ($ this ->db (), 'order_item ' );
121
-
122
110
$ orderItemQuery = new ActiveQuery (OrderItem::class);
123
111
124
112
/** @var $orderItems OrderItem */
@@ -133,8 +121,6 @@ public function testFindCompositeRelationWithJoin(): void
133
121
134
122
public function testFindSimpleRelationWithJoin (): void
135
123
{
136
- $ this ->checkFixture ($ this ->db (), 'order ' );
137
-
138
124
$ orderQuery = new ActiveQuery (Order::class);
139
125
140
126
$ orders = $ orderQuery ->findByPk (1 );
@@ -152,8 +138,6 @@ public function testFindSimpleRelationWithJoin(): void
152
138
153
139
public function testFind (): void
154
140
{
155
- $ this ->checkFixture ($ this ->db (), 'customer ' );
156
-
157
141
$ customerQuery = new ActiveQuery (Customer::class);
158
142
$ this ->assertInstanceOf (ActiveQueryInterface::class, $ customerQuery );
159
143
@@ -183,8 +167,6 @@ public function testFind(): void
183
167
184
168
public function testFindAsArray (): void
185
169
{
186
- $ this ->checkFixture ($ this ->db (), 'customer ' );
187
-
188
170
/** asArray */
189
171
$ customerQuery = new ActiveQuery (Customer::class);
190
172
$ customer = $ customerQuery ->where (['id ' => 2 ])->asArray ()->one ();
@@ -221,8 +203,6 @@ public function testFindAsArray(): void
221
203
222
204
public function testFindIndexBy (): void
223
205
{
224
- $ this ->checkFixture ($ this ->db (), 'customer ' );
225
-
226
206
$ customerQuery = new ActiveQuery (Customer::class);
227
207
228
208
$ customers = $ customerQuery ->indexBy ('name ' )->orderBy ('id ' )->all ();
@@ -248,8 +228,6 @@ public function testFindIndexBy(): void
248
228
249
229
public function testFindIndexByAsArray (): void
250
230
{
251
- $ this ->checkFixture ($ this ->db (), 'customer ' );
252
-
253
231
$ customerQuery = new ActiveQuery (Customer::class);
254
232
$ customers = $ customerQuery ->asArray ()->indexBy ('name ' )->all ();
255
233
$ this ->assertCount (3 , $ customers );
@@ -292,8 +270,6 @@ public function testFindIndexByAsArray(): void
292
270
293
271
public function testFindCount (): void
294
272
{
295
- $ this ->checkFixture ($ this ->db (), 'customer ' );
296
-
297
273
$ customerQuery = new ActiveQuery (Customer::class);
298
274
$ this ->assertEquals (3 , $ customerQuery ->count ());
299
275
$ this ->assertEquals (1 , $ customerQuery ->where (['id ' => 1 ])->count ());
@@ -310,8 +286,6 @@ public function testFindCount(): void
310
286
311
287
public function testFindLimit (): void
312
288
{
313
- $ this ->checkFixture ($ this ->db (), 'customer ' );
314
-
315
289
/** one */
316
290
$ customerQuery = new ActiveQuery (Customer::class);
317
291
$ customer = $ customerQuery ->orderBy ('id ' )->one ();
@@ -361,8 +335,6 @@ public function testFindLimit(): void
361
335
362
336
public function testFindComplexCondition (): void
363
337
{
364
- $ this ->checkFixture ($ this ->db (), 'customer ' );
365
-
366
338
$ customerQuery = new ActiveQuery (Customer::class);
367
339
368
340
$ this ->assertEquals (
@@ -398,7 +370,7 @@ public function testFindComplexCondition(): void
398
370
399
371
public function testFindNullValues (): void
400
372
{
401
- $ this ->checkFixture ( $ this -> db (), ' customer ' );
373
+ $ this ->reloadFixtureAfterTest ( );
402
374
403
375
$ customerQuery = new ActiveQuery (Customer::class);
404
376
@@ -413,8 +385,6 @@ public function testFindNullValues(): void
413
385
414
386
public function testFindEager (): void
415
387
{
416
- $ this ->checkFixture ($ this ->db (), 'customer ' );
417
-
418
388
$ customerQuery = new ActiveQuery (Customer::class);
419
389
$ customers = $ customerQuery ->with ('orders ' )->indexBy ('id ' )->all ();
420
390
@@ -450,8 +420,6 @@ public function testFindEager(): void
450
420
451
421
public function testFindEagerViaRelation (): void
452
422
{
453
- $ this ->checkFixture ($ this ->db (), 'order ' );
454
-
455
423
$ orderQuery = new ActiveQuery (Order::class);
456
424
$ orders = $ orderQuery ->with ('items ' )->orderBy ('id ' )->all ();
457
425
$ this ->assertCount (3 , $ orders );
@@ -466,8 +434,6 @@ public function testFindEagerViaRelation(): void
466
434
467
435
public function testFindNestedRelation (): void
468
436
{
469
- $ this ->checkFixture ($ this ->db (), 'customer ' );
470
-
471
437
$ customerQuery = new ActiveQuery (Customer::class);
472
438
$ customers = $ customerQuery ->with ('orders ' , 'orders.items ' )->indexBy ('id ' )->all ();
473
439
@@ -502,8 +468,6 @@ public function testFindNestedRelation(): void
502
468
*/
503
469
public function testFindEagerViaRelationPreserveOrder (): void
504
470
{
505
- $ this ->checkFixture ($ this ->db (), 'order ' );
506
-
507
471
$ orderQuery = new ActiveQuery (Order::class);
508
472
$ orders = $ orderQuery ->with ('itemsInOrder1 ' )->orderBy ('created_at ' )->all ();
509
473
$ this ->assertCount (3 , $ orders );
@@ -532,8 +496,6 @@ public function testFindEagerViaRelationPreserveOrder(): void
532
496
533
497
public function testFindEagerViaRelationPreserveOrderB (): void
534
498
{
535
- $ this ->checkFixture ($ this ->db (), 'order ' );
536
-
537
499
/** different order in via table. */
538
500
$ orderQuery = new ActiveQuery (Order::class);
539
501
$ orders = $ orderQuery ->with ('itemsInOrder2 ' )->orderBy ('created_at ' )->all ();
@@ -563,8 +525,6 @@ public function testFindEagerViaRelationPreserveOrderB(): void
563
525
564
526
public function testFindEmptyInCondition (): void
565
527
{
566
- $ this ->checkFixture ($ this ->db (), 'customer ' );
567
-
568
528
$ customerQuery = new ActiveQuery (Customer::class);
569
529
$ customers = $ customerQuery ->where (['id ' => [1 ]])->all ();
570
530
$ this ->assertCount (1 , $ customers );
@@ -581,8 +541,6 @@ public function testFindEmptyInCondition(): void
581
541
582
542
public function testFindEagerIndexBy (): void
583
543
{
584
- $ this ->checkFixture ($ this ->db (), 'order ' );
585
-
586
544
$ orderQuery = new ActiveQuery (Order::class);
587
545
$ order = $ orderQuery ->with ('itemsIndexed ' )->where (['id ' => 1 ])->one ();
588
546
$ this ->assertTrue ($ order ->isRelationPopulated ('itemsIndexed ' ));
@@ -604,8 +562,6 @@ public function testFindEagerIndexBy(): void
604
562
605
563
public function testFindLazy (): void
606
564
{
607
- $ this ->checkFixture ($ this ->db (), 'customer ' );
608
-
609
565
$ customerQuery = new ActiveQuery (Customer::class);
610
566
$ customer = $ customerQuery ->findByPk (2 );
611
567
$ this ->assertFalse ($ customer ->isRelationPopulated ('orders ' ));
@@ -630,8 +586,6 @@ public function testFindLazy(): void
630
586
631
587
public function testFindLazyVia (): void
632
588
{
633
- $ this ->checkFixture ($ this ->db (), 'order ' );
634
-
635
589
$ orderQuery = new ActiveQuery (Order::class);
636
590
$ order = $ orderQuery ->findByPk (1 );
637
591
@@ -643,8 +597,6 @@ public function testFindLazyVia(): void
643
597
644
598
public function testFindByPk (): void
645
599
{
646
- $ this ->checkFixture ($ this ->db (), 'customer ' );
647
-
648
600
$ customerQuery = new ActiveQuery (new Customer ());
649
601
650
602
$ this ->assertEquals (
@@ -658,8 +610,6 @@ public function testFindByPk(): void
658
610
659
611
public function testFindByPkComposite (): void
660
612
{
661
- $ this ->checkFixture ($ this ->db (), 'order_item ' );
662
-
663
613
$ query = new ActiveQuery (OrderItem::class);
664
614
665
615
$ orderItem = $ query ->findByPk ([1 , 2 ]);
@@ -676,8 +626,6 @@ public function testFindByPkComposite(): void
676
626
677
627
public function testFindByPkWithoutPk (): void
678
628
{
679
- $ this ->checkFixture ($ this ->db (), 'type ' );
680
-
681
629
$ query = new ActiveQuery (Type::class);
682
630
683
631
$ this ->expectException (InvalidConfigException::class);
@@ -688,8 +636,6 @@ public function testFindByPkWithoutPk(): void
688
636
689
637
public function testFindByPkWithJoin (): void
690
638
{
691
- $ this ->checkFixture ($ this ->db (), 'order ' );
692
-
693
639
$ query = new ActiveQuery (Order::class);
694
640
695
641
$ query ->joinWith ('items ' );
0 commit comments