@@ -909,7 +909,7 @@ public function testAfterKeyForQueryOperation()
909909 $ this ->assertEquals (10 , $ count );
910910 });
911911 }
912-
912+
913913 public function testAfterKeyForScanOperation ()
914914 {
915915 foreach (range (0 , 9 ) as $ i ) {
@@ -919,18 +919,18 @@ public function testAfterKeyForScanOperation()
919919 $ assert = function (callable $ getKey ) {
920920 $ paginationResult = collect ();
921921 $ afterKey = null ;
922-
922+
923923 do {
924924 $ items = $ this ->testModel
925925 ->afterKey ($ afterKey )
926926 ->limit (2 )->all ();
927927 $ afterKey = $ getKey ($ items );
928928 $ paginationResult = $ paginationResult ->merge ($ items ->pluck ('count ' ));
929929 } while ($ afterKey );
930-
930+
931931 $ this ->assertEquals (range (0 , 9 ), $ paginationResult ->sort ()->values ()->toArray ());
932932 };
933-
933+
934934 $ assert (function ($ items ) {
935935 return $ items ->lastKey ();
936936 });
@@ -1156,6 +1156,28 @@ public function testQueryNestedAttributes()
11561156 $ this ->assertEquals ($ item ['id ' ]['S ' ], $ results ->first ()->id );
11571157 }
11581158
1159+ public function testBuilderContainsAllWhereClausesWhenGivenArrayOfConditions ()
1160+ {
1161+ /** @var array $conditions */
1162+ $ conditions = [
1163+ "foo " => "bar " ,
1164+ "bin " => "baz "
1165+ ];
1166+
1167+ $ builder = $ this ->getTestModel ()->where ($ conditions );
1168+
1169+ /** @var array $conditionsFromBuilder */
1170+ $ conditionsFromBuilder = [];
1171+
1172+ /** @var array $builderConditions */
1173+ foreach ($ builder ->wheres as $ builderConditions ) {
1174+ $ conditionsFromBuilder [$ builderConditions ['column ' ]] = $ builderConditions ['value ' ];
1175+ }
1176+
1177+ // Assert that the builder has the where-conditions we expect to see
1178+ $ this ->assertEquals ($ conditions , $ conditionsFromBuilder );
1179+ }
1180+
11591181 protected function assertRemoveAttributes ($ item )
11601182 {
11611183 $ this ->assertNull ($ item ->name );
0 commit comments