@@ -244,6 +244,7 @@ public function testActionCount(): void
244
244
$ m ->addField ('surname ' );
245
245
246
246
$ this ->assertSame (2 , $ m ->action ('count ' )->getOne ());
247
+ $ this ->assertSame (2 , $ m ->executeCountQuery ());
247
248
}
248
249
249
250
/**
@@ -259,8 +260,6 @@ public function testActionField(): void
259
260
$ m ->addField ('name ' );
260
261
$ m ->addField ('surname ' );
261
262
262
- $ this ->assertSame (2 , $ m ->action ('count ' )->getOne ());
263
-
264
263
// use alias as array key if it is set
265
264
$ q = $ m ->action ('field ' , ['name ' , 'alias ' => 'first_name ' ]);
266
265
$ this ->assertSame ([
@@ -643,40 +642,40 @@ public function testImportAndAutoincrement(): void
643
642
['id ' => 1 , 'f1 ' => 'A ' ],
644
643
['id ' => 2 , 'f1 ' => 'B ' ],
645
644
]);
646
- $ this ->assertSame (2 , $ m ->action ( ' count ' )-> getOne ());
645
+ $ this ->assertSame (2 , $ m ->executeCountQuery ());
647
646
648
647
$ m ->import ([
649
648
['f1 ' => 'C ' ],
650
649
['f1 ' => 'D ' ],
651
650
]);
652
- $ this ->assertSame (4 , $ m ->action ( ' count ' )-> getOne ());
651
+ $ this ->assertSame (4 , $ m ->executeCountQuery ());
653
652
654
653
$ m ->import ([
655
654
['id ' => 6 , 'f1 ' => 'E ' ],
656
655
['id ' => 7 , 'f1 ' => 'F ' ],
657
656
]);
658
- $ this ->assertSame (6 , $ m ->action ( ' count ' )-> getOne ());
657
+ $ this ->assertSame (6 , $ m ->executeCountQuery ());
659
658
660
659
$ m ->delete (6 );
661
- $ this ->assertSame (5 , $ m ->action ( ' count ' )-> getOne ());
660
+ $ this ->assertSame (5 , $ m ->executeCountQuery ());
662
661
663
662
$ m ->import ([
664
663
['f1 ' => 'G ' ],
665
664
['f1 ' => 'H ' ],
666
665
]);
667
- $ this ->assertSame (7 , $ m ->action ( ' count ' )-> getOne ());
666
+ $ this ->assertSame (7 , $ m ->executeCountQuery ());
668
667
669
668
$ m ->import ([
670
669
['id ' => 99 , 'f1 ' => 'I ' ],
671
670
['id ' => 20 , 'f1 ' => 'J ' ],
672
671
]);
673
- $ this ->assertSame (9 , $ m ->action ( ' count ' )-> getOne ());
672
+ $ this ->assertSame (9 , $ m ->executeCountQuery ());
674
673
675
674
$ m ->import ([
676
675
['f1 ' => 'K ' ],
677
676
['f1 ' => 'L ' ],
678
677
]);
679
- $ this ->assertSame (11 , $ m ->action ( ' count ' )-> getOne ());
678
+ $ this ->assertSame (11 , $ m ->executeCountQuery ());
680
679
681
680
$ m ->delete (100 );
682
681
$ m ->createEntity ()->set ('f1 ' , 'M ' )->save ();
@@ -711,18 +710,18 @@ public function testLimit(): void
711
710
$ m = new Model ($ p );
712
711
$ m ->addField ('f1 ' );
713
712
714
- $ this ->assertSame (4 , $ m ->action ( ' count ' )-> getOne ());
713
+ $ this ->assertSame (4 , $ m ->executeCountQuery ());
715
714
716
715
$ m ->setLimit (3 );
717
- $ this ->assertSame (3 , $ m ->action ( ' count ' )-> getOne ());
716
+ $ this ->assertSame (3 , $ m ->executeCountQuery ());
718
717
$ this ->assertSame ([
719
718
['id ' => 1 , 'f1 ' => 'A ' ],
720
719
['id ' => 2 , 'f1 ' => 'D ' ],
721
720
['id ' => 3 , 'f1 ' => 'E ' ],
722
721
], array_values ($ m ->export ()));
723
722
724
723
$ m ->setLimit (2 , 1 );
725
- $ this ->assertSame (2 , $ m ->action ( ' count ' )-> getOne ());
724
+ $ this ->assertSame (2 , $ m ->executeCountQuery ());
726
725
$ this ->assertSame ([
727
726
['id ' => 2 , 'f1 ' => 'D ' ],
728
727
['id ' => 3 , 'f1 ' => 'E ' ],
@@ -731,7 +730,7 @@ public function testLimit(): void
731
730
// well, this is strange, that you can actually change limit on-the-fly and then previous
732
731
// limit is not taken into account, but most likely you will never set it multiple times
733
732
$ m ->setLimit (3 );
734
- $ this ->assertSame (3 , $ m ->action ( ' count ' )-> getOne ());
733
+ $ this ->assertSame (3 , $ m ->executeCountQuery ());
735
734
}
736
735
737
736
/**
@@ -749,19 +748,19 @@ public function testCondition(): void
749
748
$ m ->addField ('name ' );
750
749
$ m ->addField ('surname ' );
751
750
752
- $ this ->assertSame (4 , $ m ->action ( ' count ' )-> getOne ());
751
+ $ this ->assertSame (4 , $ m ->executeCountQuery ());
753
752
$ this ->assertSame (['data ' => $ dbData ], $ this ->getInternalPersistenceData ($ p ));
754
753
755
754
$ m ->addCondition ('name ' , 'Sarah ' );
756
- $ this ->assertSame (3 , $ m ->action ( ' count ' )-> getOne ());
755
+ $ this ->assertSame (3 , $ m ->executeCountQuery ());
757
756
758
757
$ m ->addCondition ('surname ' , 'Smith ' );
759
- $ this ->assertSame (1 , $ m ->action ( ' count ' )-> getOne ());
758
+ $ this ->assertSame (1 , $ m ->executeCountQuery ());
760
759
$ this ->assertSame ([4 => ['id ' => 4 , 'name ' => 'Sarah ' , 'surname ' => 'Smith ' ]], $ m ->export ());
761
760
$ this ->assertSame ([4 => ['id ' => 4 , 'name ' => 'Sarah ' , 'surname ' => 'Smith ' ]], $ m ->action ('select ' )->getRows ());
762
761
763
762
$ m ->addCondition ('surname ' , 'Siiiith ' );
764
- $ this ->assertSame (0 , $ m ->action ( ' count ' )-> getOne ());
763
+ $ this ->assertSame (0 , $ m ->executeCountQuery ());
765
764
}
766
765
767
766
public function testUnsupportedAction (): void
@@ -863,10 +862,10 @@ public function testHasMany(): void
863
862
$ user ->hasOne ('country_id ' , ['model ' => $ country ]);
864
863
865
864
$ cc = $ country ->load (1 );
866
- $ this ->assertSame (2 , $ cc ->ref ('Users ' )->action ( ' count ' )-> getOne ());
865
+ $ this ->assertSame (2 , $ cc ->ref ('Users ' )->executeCountQuery ());
867
866
868
867
$ cc = $ country ->load (2 );
869
- $ this ->assertSame (1 , $ cc ->ref ('Users ' )->action ( ' count ' )-> getOne ());
868
+ $ this ->assertSame (1 , $ cc ->ref ('Users ' )->executeCountQuery ());
870
869
}
871
870
872
871
public function testLoadAnyThrowsExceptionOnRecordNotFound (): void
0 commit comments