@@ -2654,8 +2654,8 @@ public function testGetAndSetConditions()
2654
2654
$ query ->select (['select1 ' ,'select2 ' ]);
2655
2655
$ query ->skip (24 );
2656
2656
2657
- // sets count = 1 and limit = 0
2658
- $ query ->count ();
2657
+ // sets count = 1
2658
+ $ query ->withCount ();
2659
2659
// reset limit up to 42
2660
2660
$ query ->limit (42 );
2661
2661
@@ -2695,6 +2695,45 @@ public function testGetAndSetConditions()
2695
2695
);
2696
2696
}
2697
2697
2698
+ /**
2699
+ * @group query-count-conditions
2700
+ */
2701
+ public function testCountDoesNotOverrideConditions ()
2702
+ {
2703
+ $ obj = new ParseObject ('TestObject ' );
2704
+ $ obj ->set ('name ' , 'John ' );
2705
+ $ obj ->set ('country ' , 'US ' );
2706
+ $ obj ->save ();
2707
+
2708
+ $ obj = new ParseObject ('TestObject ' );
2709
+ $ obj ->set ('name ' , 'Bob ' );
2710
+ $ obj ->set ('country ' , 'US ' );
2711
+ $ obj ->save ();
2712
+
2713
+ $ obj = new ParseObject ('TestObject ' );
2714
+ $ obj ->set ('name ' , 'Mike ' );
2715
+ $ obj ->set ('country ' , 'CA ' );
2716
+ $ obj ->save ();
2717
+
2718
+ $ query = new ParseQuery ('TestObject ' );
2719
+ $ query ->equalTo ('country ' , 'US ' );
2720
+ $ query ->limit (1 );
2721
+ $ count = $ query ->count ();
2722
+ $ results = $ query ->find ();
2723
+
2724
+ $ this ->assertEquals (1 , count ($ results ));
2725
+ $ this ->assertEquals (2 , $ count );
2726
+
2727
+ $ this ->assertSame ([
2728
+ 'where ' => [
2729
+ 'country ' => [
2730
+ '$eq ' => 'US '
2731
+ ]
2732
+ ],
2733
+ 'limit ' => 1 ,
2734
+ ], $ query ->_getOptions ());
2735
+ }
2736
+
2698
2737
public function testNotArrayConditions ()
2699
2738
{
2700
2739
$ this ->expectException (
@@ -2770,8 +2809,6 @@ public function testEqualToWithSameKeyDoesNotOverrideOtherConditions()
2770
2809
'$eq ' => 'bar ' ,
2771
2810
]
2772
2811
],
2773
- 'limit ' => 0 ,
2774
- 'count ' => 1 ,
2775
2812
], $ query ->_getOptions ());
2776
2813
}
2777
2814
}
0 commit comments