| Total Lines | 643 |
| Code Lines | 418 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 812 | public static function queryExpressionProvider(): Generator |
||
| 813 | { |
||
| 814 | yield 'Ascending forward start inclusive with QueryExpression' => [ |
||
| 815 | function () { |
||
| 816 | return [ |
||
| 817 | 'forward' => true, |
||
| 818 | 'seekable' => true, |
||
| 819 | 'limit' => 3, |
||
| 820 | 'order' => [ |
||
| 821 | new OrderClauseExpression('modified', 'asc'), |
||
| 822 | new OrderClauseExpression('id', 'asc'), |
||
| 823 | ], |
||
| 824 | ]; |
||
| 825 | }, |
||
| 826 | new PaginationResult( |
||
| 827 | [ |
||
| 828 | new Entity([ |
||
| 829 | 'id' => 1, |
||
| 830 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 831 | ]), |
||
| 832 | new Entity([ |
||
| 833 | 'id' => 3, |
||
| 834 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 835 | ]), |
||
| 836 | new Entity([ |
||
| 837 | 'id' => 5, |
||
| 838 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 839 | ]), |
||
| 840 | ], |
||
| 841 | [ |
||
| 842 | 'hasPrevious' => null, |
||
| 843 | 'previousCursor' => null, |
||
| 844 | 'hasNext' => true, |
||
| 845 | 'nextCursor' => [ |
||
| 846 | 'id' => 2, |
||
| 847 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 848 | ], |
||
| 849 | ] |
||
| 850 | ), |
||
| 851 | ]; |
||
| 852 | |||
| 853 | yield 'Ascending forward start exclusive with QueryExpression' => [ |
||
| 854 | function () { |
||
| 855 | return [ |
||
| 856 | 'forward' => true, |
||
| 857 | 'seekable' => true, |
||
| 858 | 'exclusive' => true, |
||
| 859 | 'limit' => 3, |
||
| 860 | 'order' => [ |
||
| 861 | new OrderClauseExpression('modified', 'asc'), |
||
| 862 | new OrderClauseExpression('id', 'asc'), |
||
| 863 | ], |
||
| 864 | ]; |
||
| 865 | }, |
||
| 866 | new PaginationResult( |
||
| 867 | [ |
||
| 868 | new Entity([ |
||
| 869 | 'id' => 1, |
||
| 870 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 871 | ]), |
||
| 872 | new Entity([ |
||
| 873 | 'id' => 3, |
||
| 874 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 875 | ]), |
||
| 876 | new Entity([ |
||
| 877 | 'id' => 5, |
||
| 878 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 879 | ]), |
||
| 880 | ], |
||
| 881 | [ |
||
| 882 | 'hasPrevious' => null, |
||
| 883 | 'previousCursor' => null, |
||
| 884 | 'hasNext' => true, |
||
| 885 | 'nextCursor' => [ |
||
| 886 | 'id' => 5, |
||
| 887 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 888 | ], |
||
| 889 | ] |
||
| 890 | ), |
||
| 891 | ]; |
||
| 892 | |||
| 893 | yield 'Ascending forward inclusive with QueryExpression' => [ |
||
| 894 | function () { |
||
| 895 | return [ |
||
| 896 | 'forward' => true, |
||
| 897 | 'seekable' => true, |
||
| 898 | 'limit' => 3, |
||
| 899 | 'order' => [ |
||
| 900 | new OrderClauseExpression('modified', 'asc'), |
||
| 901 | new OrderClauseExpression('id', 'asc'), |
||
| 902 | ], |
||
| 903 | 'cursor' => [ |
||
| 904 | 'id' => 3, |
||
| 905 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 906 | ], |
||
| 907 | ]; |
||
| 908 | }, |
||
| 909 | new PaginationResult( |
||
| 910 | [ |
||
| 911 | new Entity([ |
||
| 912 | 'id' => 3, |
||
| 913 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 914 | ]), |
||
| 915 | new Entity([ |
||
| 916 | 'id' => 5, |
||
| 917 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 918 | ]), |
||
| 919 | new Entity([ |
||
| 920 | 'id' => 2, |
||
| 921 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 922 | ]), |
||
| 923 | ], |
||
| 924 | [ |
||
| 925 | 'hasPrevious' => true, |
||
| 926 | 'previousCursor' => [ |
||
| 927 | 'id' => 1, |
||
| 928 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 929 | ], |
||
| 930 | 'hasNext' => true, |
||
| 931 | 'nextCursor' => [ |
||
| 932 | 'id' => 4, |
||
| 933 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 934 | ], |
||
| 935 | ] |
||
| 936 | ), |
||
| 937 | ]; |
||
| 938 | |||
| 939 | yield 'Ascending forward exclusive with QueryExpression' => [ |
||
| 940 | function () { |
||
| 941 | return [ |
||
| 942 | 'forward' => true, |
||
| 943 | 'seekable' => true, |
||
| 944 | 'exclusive' => true, |
||
| 945 | 'limit' => 3, |
||
| 946 | 'order' => [ |
||
| 947 | new OrderClauseExpression('modified', 'asc'), |
||
| 948 | new OrderClauseExpression('id', 'asc'), |
||
| 949 | ], |
||
| 950 | 'cursor' => [ |
||
| 951 | 'id' => 3, |
||
| 952 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 953 | ], |
||
| 954 | ]; |
||
| 955 | }, |
||
| 956 | new PaginationResult( |
||
| 957 | [ |
||
| 958 | new Entity([ |
||
| 959 | 'id' => 5, |
||
| 960 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 961 | ]), |
||
| 962 | new Entity([ |
||
| 963 | 'id' => 2, |
||
| 964 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 965 | ]), |
||
| 966 | new Entity([ |
||
| 967 | 'id' => 4, |
||
| 968 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 969 | ]), |
||
| 970 | ], |
||
| 971 | [ |
||
| 972 | 'hasPrevious' => true, |
||
| 973 | 'previousCursor' => [ |
||
| 974 | 'id' => 5, |
||
| 975 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 976 | ], |
||
| 977 | 'hasNext' => false, |
||
| 978 | 'nextCursor' => null, |
||
| 979 | ] |
||
| 980 | ), |
||
| 981 | ]; |
||
| 982 | |||
| 983 | yield 'Ascending backward start inclusive with QueryExpression' => [ |
||
| 984 | function () { |
||
| 985 | return [ |
||
| 986 | 'backward' => true, |
||
| 987 | 'seekable' => true, |
||
| 988 | 'limit' => 3, |
||
| 989 | 'order' => [ |
||
| 990 | new OrderClauseExpression('modified', 'asc'), |
||
| 991 | new OrderClauseExpression('id', 'asc'), |
||
| 992 | ], |
||
| 993 | ]; |
||
| 994 | }, |
||
| 995 | new PaginationResult( |
||
| 996 | [ |
||
| 997 | new Entity([ |
||
| 998 | 'id' => 5, |
||
| 999 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1000 | ]), |
||
| 1001 | new Entity([ |
||
| 1002 | 'id' => 2, |
||
| 1003 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1004 | ]), |
||
| 1005 | new Entity([ |
||
| 1006 | 'id' => 4, |
||
| 1007 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1008 | ]), |
||
| 1009 | ], |
||
| 1010 | [ |
||
| 1011 | 'hasPrevious' => true, |
||
| 1012 | 'previousCursor' => [ |
||
| 1013 | 'id' => 3, |
||
| 1014 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1015 | ], |
||
| 1016 | 'hasNext' => null, |
||
| 1017 | 'nextCursor' => null, |
||
| 1018 | ] |
||
| 1019 | ), |
||
| 1020 | ]; |
||
| 1021 | |||
| 1022 | yield 'Ascending backward start exclusive with QueryExpression' => [ |
||
| 1023 | function () { |
||
| 1024 | return [ |
||
| 1025 | 'backward' => true, |
||
| 1026 | 'seekable' => true, |
||
| 1027 | 'exclusive' => true, |
||
| 1028 | 'limit' => 3, |
||
| 1029 | 'order' => [ |
||
| 1030 | new OrderClauseExpression('modified', 'asc'), |
||
| 1031 | new OrderClauseExpression('id', 'asc'), |
||
| 1032 | ], |
||
| 1033 | ]; |
||
| 1034 | }, |
||
| 1035 | new PaginationResult( |
||
| 1036 | [ |
||
| 1037 | new Entity([ |
||
| 1038 | 'id' => 5, |
||
| 1039 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1040 | ]), |
||
| 1041 | new Entity([ |
||
| 1042 | 'id' => 2, |
||
| 1043 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1044 | ]), |
||
| 1045 | new Entity([ |
||
| 1046 | 'id' => 4, |
||
| 1047 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1048 | ]), |
||
| 1049 | ], |
||
| 1050 | [ |
||
| 1051 | 'hasPrevious' => true, |
||
| 1052 | 'previousCursor' => [ |
||
| 1053 | 'id' => 5, |
||
| 1054 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1055 | ], |
||
| 1056 | 'hasNext' => null, |
||
| 1057 | 'nextCursor' => null, |
||
| 1058 | ] |
||
| 1059 | ), |
||
| 1060 | ]; |
||
| 1061 | |||
| 1062 | yield 'Ascending backward inclusive with QueryExpression' => [ |
||
| 1063 | function () { |
||
| 1064 | return [ |
||
| 1065 | 'backward' => true, |
||
| 1066 | 'seekable' => true, |
||
| 1067 | 'limit' => 3, |
||
| 1068 | 'order' => [ |
||
| 1069 | new OrderClauseExpression('modified', 'asc'), |
||
| 1070 | new OrderClauseExpression('id', 'asc'), |
||
| 1071 | ], |
||
| 1072 | 'cursor' => [ |
||
| 1073 | 'id' => 3, |
||
| 1074 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1075 | ], |
||
| 1076 | ]; |
||
| 1077 | }, |
||
| 1078 | new PaginationResult( |
||
| 1079 | [ |
||
| 1080 | new Entity([ |
||
| 1081 | 'id' => 1, |
||
| 1082 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1083 | ]), |
||
| 1084 | new Entity([ |
||
| 1085 | 'id' => 3, |
||
| 1086 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1087 | ]), |
||
| 1088 | ], |
||
| 1089 | [ |
||
| 1090 | 'hasPrevious' => false, |
||
| 1091 | 'previousCursor' => null, |
||
| 1092 | 'hasNext' => true, |
||
| 1093 | 'nextCursor' => [ |
||
| 1094 | 'id' => 5, |
||
| 1095 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1096 | ], |
||
| 1097 | ] |
||
| 1098 | ), |
||
| 1099 | ]; |
||
| 1100 | |||
| 1101 | yield 'Ascending backward exclusive with QueryExpression' => [ |
||
| 1102 | function () { |
||
| 1103 | return [ |
||
| 1104 | 'backward' => true, |
||
| 1105 | 'seekable' => true, |
||
| 1106 | 'exclusive' => true, |
||
| 1107 | 'limit' => 3, |
||
| 1108 | 'order' => [ |
||
| 1109 | new OrderClauseExpression('modified', 'asc'), |
||
| 1110 | new OrderClauseExpression('id', 'asc'), |
||
| 1111 | ], |
||
| 1112 | 'cursor' => [ |
||
| 1113 | 'id' => 3, |
||
| 1114 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1115 | ], |
||
| 1116 | ]; |
||
| 1117 | }, |
||
| 1118 | new PaginationResult( |
||
| 1119 | [ |
||
| 1120 | new Entity([ |
||
| 1121 | 'id' => 1, |
||
| 1122 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1123 | ]), |
||
| 1124 | ], |
||
| 1125 | [ |
||
| 1126 | 'hasPrevious' => false, |
||
| 1127 | 'previousCursor' => null, |
||
| 1128 | 'hasNext' => true, |
||
| 1129 | 'nextCursor' => [ |
||
| 1130 | 'id' => 1, |
||
| 1131 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1132 | ], |
||
| 1133 | ] |
||
| 1134 | ), |
||
| 1135 | ]; |
||
| 1136 | |||
| 1137 | yield 'Descending forward start inclusive with QueryExpression' => [ |
||
| 1138 | function () { |
||
| 1139 | return [ |
||
| 1140 | 'forward' => true, |
||
| 1141 | 'seekable' => true, |
||
| 1142 | 'limit' => 3, |
||
| 1143 | 'order' => [ |
||
| 1144 | new OrderClauseExpression('modified', 'desc'), |
||
| 1145 | new OrderClauseExpression('id', 'desc'), |
||
| 1146 | ], |
||
| 1147 | ]; |
||
| 1148 | }, |
||
| 1149 | new PaginationResult( |
||
| 1150 | [ |
||
| 1151 | new Entity([ |
||
| 1152 | 'id' => 4, |
||
| 1153 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1154 | ]), |
||
| 1155 | new Entity([ |
||
| 1156 | 'id' => 2, |
||
| 1157 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1158 | ]), |
||
| 1159 | new Entity([ |
||
| 1160 | 'id' => 5, |
||
| 1161 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1162 | ]), |
||
| 1163 | ], |
||
| 1164 | [ |
||
| 1165 | 'hasPrevious' => null, |
||
| 1166 | 'previousCursor' => null, |
||
| 1167 | 'hasNext' => true, |
||
| 1168 | 'nextCursor' => [ |
||
| 1169 | 'id' => 3, |
||
| 1170 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1171 | ], |
||
| 1172 | ] |
||
| 1173 | ), |
||
| 1174 | ]; |
||
| 1175 | |||
| 1176 | yield 'Descending forward start exclusive with QueryExpression' => [ |
||
| 1177 | function () { |
||
| 1178 | return [ |
||
| 1179 | 'forward' => true, |
||
| 1180 | 'seekable' => true, |
||
| 1181 | 'exclusive' => true, |
||
| 1182 | 'limit' => 3, |
||
| 1183 | 'order' => [ |
||
| 1184 | new OrderClauseExpression('modified', 'desc'), |
||
| 1185 | new OrderClauseExpression('id', 'desc'), |
||
| 1186 | ], |
||
| 1187 | ]; |
||
| 1188 | }, |
||
| 1189 | new PaginationResult( |
||
| 1190 | [ |
||
| 1191 | new Entity([ |
||
| 1192 | 'id' => 4, |
||
| 1193 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1194 | ]), |
||
| 1195 | new Entity([ |
||
| 1196 | 'id' => 2, |
||
| 1197 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1198 | ]), |
||
| 1199 | new Entity([ |
||
| 1200 | 'id' => 5, |
||
| 1201 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1202 | ]), |
||
| 1203 | ], |
||
| 1204 | [ |
||
| 1205 | 'hasPrevious' => null, |
||
| 1206 | 'previousCursor' => null, |
||
| 1207 | 'hasNext' => true, |
||
| 1208 | 'nextCursor' => [ |
||
| 1209 | 'id' => 5, |
||
| 1210 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1211 | ], |
||
| 1212 | ] |
||
| 1213 | ), |
||
| 1214 | ]; |
||
| 1215 | |||
| 1216 | yield 'Descending forward inclusive with QueryExpression' => [ |
||
| 1217 | function () { |
||
| 1218 | return [ |
||
| 1219 | 'forward' => true, |
||
| 1220 | 'seekable' => true, |
||
| 1221 | 'limit' => 3, |
||
| 1222 | 'order' => [ |
||
| 1223 | new OrderClauseExpression('modified', 'desc'), |
||
| 1224 | new OrderClauseExpression('id', 'desc'), |
||
| 1225 | ], |
||
| 1226 | 'cursor' => [ |
||
| 1227 | 'id' => 3, |
||
| 1228 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1229 | ], |
||
| 1230 | ]; |
||
| 1231 | }, |
||
| 1232 | new PaginationResult( |
||
| 1233 | [ |
||
| 1234 | new Entity([ |
||
| 1235 | 'id' => 3, |
||
| 1236 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1237 | ]), |
||
| 1238 | new Entity([ |
||
| 1239 | 'id' => 1, |
||
| 1240 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1241 | ]), |
||
| 1242 | ], |
||
| 1243 | [ |
||
| 1244 | 'hasPrevious' => true, |
||
| 1245 | 'previousCursor' => [ |
||
| 1246 | 'id' => 5, |
||
| 1247 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1248 | ], |
||
| 1249 | 'hasNext' => false, |
||
| 1250 | 'nextCursor' => null, |
||
| 1251 | ] |
||
| 1252 | ), |
||
| 1253 | ]; |
||
| 1254 | |||
| 1255 | yield 'Descending forward exclusive with QueryExpression' => [ |
||
| 1256 | function () { |
||
| 1257 | return [ |
||
| 1258 | 'forward' => true, |
||
| 1259 | 'seekable' => true, |
||
| 1260 | 'exclusive' => true, |
||
| 1261 | 'limit' => 3, |
||
| 1262 | 'order' => [ |
||
| 1263 | new OrderClauseExpression('modified', 'desc'), |
||
| 1264 | new OrderClauseExpression('id', 'desc'), |
||
| 1265 | ], |
||
| 1266 | 'cursor' => [ |
||
| 1267 | 'id' => 3, |
||
| 1268 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1269 | ], |
||
| 1270 | ]; |
||
| 1271 | }, |
||
| 1272 | new PaginationResult( |
||
| 1273 | [ |
||
| 1274 | new Entity([ |
||
| 1275 | 'id' => 1, |
||
| 1276 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1277 | ]), |
||
| 1278 | ], |
||
| 1279 | [ |
||
| 1280 | 'hasPrevious' => true, |
||
| 1281 | 'previousCursor' => [ |
||
| 1282 | 'id' => 1, |
||
| 1283 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1284 | ], |
||
| 1285 | 'hasNext' => false, |
||
| 1286 | 'nextCursor' => null, |
||
| 1287 | ] |
||
| 1288 | ), |
||
| 1289 | ]; |
||
| 1290 | |||
| 1291 | yield 'Descending backward start inclusive with QueryExpression' => [ |
||
| 1292 | function () { |
||
| 1293 | return [ |
||
| 1294 | 'backward' => true, |
||
| 1295 | 'seekable' => true, |
||
| 1296 | 'limit' => 3, |
||
| 1297 | 'order' => [ |
||
| 1298 | new OrderClauseExpression('modified', 'desc'), |
||
| 1299 | new OrderClauseExpression('id', 'desc'), |
||
| 1300 | ], |
||
| 1301 | ]; |
||
| 1302 | }, |
||
| 1303 | new PaginationResult( |
||
| 1304 | [ |
||
| 1305 | new Entity([ |
||
| 1306 | 'id' => 5, |
||
| 1307 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1308 | ]), |
||
| 1309 | new Entity([ |
||
| 1310 | 'id' => 3, |
||
| 1311 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1312 | ]), |
||
| 1313 | new Entity([ |
||
| 1314 | 'id' => 1, |
||
| 1315 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1316 | ]), |
||
| 1317 | ], |
||
| 1318 | [ |
||
| 1319 | 'hasPrevious' => true, |
||
| 1320 | 'previousCursor' => [ |
||
| 1321 | 'id' => 2, |
||
| 1322 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1323 | ], |
||
| 1324 | 'hasNext' => null, |
||
| 1325 | 'nextCursor' => null, |
||
| 1326 | ] |
||
| 1327 | ), |
||
| 1328 | ]; |
||
| 1329 | |||
| 1330 | yield 'Descending backward start exclusive with QueryExpression' => [ |
||
| 1331 | function () { |
||
| 1332 | return [ |
||
| 1333 | 'backward' => true, |
||
| 1334 | 'seekable' => true, |
||
| 1335 | 'exclusive' => true, |
||
| 1336 | 'limit' => 3, |
||
| 1337 | 'order' => [ |
||
| 1338 | new OrderClauseExpression('modified', 'desc'), |
||
| 1339 | new OrderClauseExpression('id', 'desc'), |
||
| 1340 | ], |
||
| 1341 | ]; |
||
| 1342 | }, |
||
| 1343 | new PaginationResult( |
||
| 1344 | [ |
||
| 1345 | new Entity([ |
||
| 1346 | 'id' => 5, |
||
| 1347 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1348 | ]), |
||
| 1349 | new Entity([ |
||
| 1350 | 'id' => 3, |
||
| 1351 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1352 | ]), |
||
| 1353 | new Entity([ |
||
| 1354 | 'id' => 1, |
||
| 1355 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1356 | ]), |
||
| 1357 | ], |
||
| 1358 | [ |
||
| 1359 | 'hasPrevious' => true, |
||
| 1360 | 'previousCursor' => [ |
||
| 1361 | 'id' => 5, |
||
| 1362 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1363 | ], |
||
| 1364 | 'hasNext' => null, |
||
| 1365 | 'nextCursor' => null, |
||
| 1366 | ] |
||
| 1367 | ), |
||
| 1368 | ]; |
||
| 1369 | |||
| 1370 | yield 'Descending backward inclusive with QueryExpression' => [ |
||
| 1371 | function () { |
||
| 1372 | return [ |
||
| 1373 | 'backward' => true, |
||
| 1374 | 'seekable' => true, |
||
| 1375 | 'limit' => 3, |
||
| 1376 | 'order' => [ |
||
| 1377 | new OrderClauseExpression('modified', 'desc'), |
||
| 1378 | new OrderClauseExpression('id', 'desc'), |
||
| 1379 | ], |
||
| 1380 | 'cursor' => [ |
||
| 1381 | 'id' => 3, |
||
| 1382 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1383 | ], |
||
| 1384 | ]; |
||
| 1385 | }, |
||
| 1386 | new PaginationResult( |
||
| 1387 | [ |
||
| 1388 | new Entity([ |
||
| 1389 | 'id' => 2, |
||
| 1390 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1391 | ]), |
||
| 1392 | new Entity([ |
||
| 1393 | 'id' => 5, |
||
| 1394 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1395 | ]), |
||
| 1396 | new Entity([ |
||
| 1397 | 'id' => 3, |
||
| 1398 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1399 | ]), |
||
| 1400 | ], |
||
| 1401 | [ |
||
| 1402 | 'hasPrevious' => true, |
||
| 1403 | 'previousCursor' => [ |
||
| 1404 | 'id' => 4, |
||
| 1405 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1406 | ], |
||
| 1407 | 'hasNext' => true, |
||
| 1408 | 'nextCursor' => [ |
||
| 1409 | 'id' => 1, |
||
| 1410 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1411 | ], |
||
| 1412 | ] |
||
| 1413 | ), |
||
| 1414 | ]; |
||
| 1415 | |||
| 1416 | yield 'Descending backward exclusive with QueryExpression' => [ |
||
| 1417 | function () { |
||
| 1418 | return [ |
||
| 1419 | 'backward' => true, |
||
| 1420 | 'seekable' => true, |
||
| 1421 | 'exclusive' => true, |
||
| 1422 | 'limit' => 3, |
||
| 1423 | 'order' => [ |
||
| 1424 | new OrderClauseExpression('modified', 'desc'), |
||
| 1425 | new OrderClauseExpression('id', 'desc'), |
||
| 1426 | ], |
||
| 1427 | 'cursor' => [ |
||
| 1428 | 'id' => 3, |
||
| 1429 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1430 | ], |
||
| 1431 | ]; |
||
| 1432 | }, |
||
| 1433 | new PaginationResult( |
||
| 1434 | [ |
||
| 1435 | new Entity([ |
||
| 1436 | 'id' => 4, |
||
| 1437 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1438 | ]), |
||
| 1439 | new Entity([ |
||
| 1440 | 'id' => 2, |
||
| 1441 | 'modified' => new DateTime('2017-01-01 11:00:00'), |
||
| 1442 | ]), |
||
| 1443 | new Entity([ |
||
| 1444 | 'id' => 5, |
||
| 1445 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1446 | ]), |
||
| 1447 | ], |
||
| 1448 | [ |
||
| 1449 | 'hasPrevious' => false, |
||
| 1450 | 'previousCursor' => null, |
||
| 1451 | 'hasNext' => true, |
||
| 1452 | 'nextCursor' => [ |
||
| 1453 | 'id' => 5, |
||
| 1454 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
| 1455 | ], |
||
| 1461 |