@@ -963,16 +963,19 @@ public function testQueryParentCategoriesProductCount()
963
963
}
964
964
965
965
/**
966
- * @magentoApiDataFixture Magento/Catalog/_files/categories.php
966
+ * Get categoryList query for page.
967
+ *
968
+ * @param int $page
969
+ * @return string
967
970
*/
968
- public function testCategoryListPaginationLimitsNotAppliedToChildren ( )
971
+ private function getQueryForPage ( int $ page )
969
972
{
970
- $ query = <<<QUERY
973
+ return <<<QUERY
971
974
{
972
975
categoryList(
973
976
filters: {parent_id: {in: ["2"]}}
974
977
pageSize: 1
975
- currentPage: 1
978
+ currentPage: { $ page }
976
979
){
977
980
id
978
981
name
@@ -996,7 +999,14 @@ public function testCategoryListPaginationLimitsNotAppliedToChildren()
996
999
}
997
1000
}
998
1001
QUERY ;
999
- $ response = $ this ->graphQlQuery ($ query );
1002
+ }
1003
+
1004
+ /**
1005
+ * @magentoApiDataFixture Magento/Catalog/_files/categories.php
1006
+ */
1007
+ public function testCategoryListPaginationLimitsNotAppliedToChildren ()
1008
+ {
1009
+ $ response = $ this ->graphQlQuery ($ this ->getQueryForPage (1 ));
1000
1010
$ this ->assertArrayNotHasKey ('errors ' , $ response );
1001
1011
$ this ->assertArrayHasKey ('categoryList ' , $ response );
1002
1012
$ baseCategory = $ response ['categoryList ' ][0 ];
@@ -1006,72 +1016,14 @@ public function testCategoryListPaginationLimitsNotAppliedToChildren()
1006
1016
$ this ->assertEquals ('Category 1.2 ' , $ baseCategory ['children ' ][1 ]['name ' ]);
1007
1017
$ this ->assertEquals ('Category 1.1.1 ' , $ baseCategory ['children ' ][0 ]['children ' ][0 ]['name ' ]);
1008
1018
1009
- $ query2 = <<<QUERY
1010
- {
1011
- categoryList(
1012
- filters: {parent_id: {in: ["2"]}}
1013
- pageSize: 1
1014
- currentPage: 2
1015
- ){
1016
- id
1017
- name
1018
- level
1019
- children{
1020
- name
1021
- level
1022
- children{
1023
- name
1024
- level
1025
- children{
1026
- name
1027
- level
1028
- children {
1029
- name
1030
- level
1031
- }
1032
- }
1033
- }
1034
- }
1035
- }
1036
- }
1037
- QUERY ;
1038
- $ response = $ this ->graphQlQuery ($ query2 );
1019
+ $ response = $ this ->graphQlQuery ($ this ->getQueryForPage (2 ));
1039
1020
$ this ->assertArrayNotHasKey ('errors ' , $ response );
1040
1021
$ this ->assertArrayHasKey ('categoryList ' , $ response );
1041
1022
$ baseCategory = $ response ['categoryList ' ][0 ];
1042
1023
$ this ->assertEquals ('Category 2 ' , $ baseCategory ['name ' ]);
1043
1024
$ this ->assertCount (0 , $ baseCategory ['children ' ]);
1044
1025
1045
- $ query3 = <<<QUERY
1046
- {
1047
- categoryList(
1048
- filters: {parent_id: {in: ["2"]}}
1049
- pageSize: 1
1050
- currentPage: 3
1051
- ){
1052
- id
1053
- name
1054
- level
1055
- children{
1056
- name
1057
- level
1058
- children{
1059
- name
1060
- level
1061
- children{
1062
- name
1063
- level
1064
- children {
1065
- name
1066
- level
1067
- }
1068
- }
1069
- }
1070
- }
1071
- }
1072
- }
1073
- QUERY ;
1074
- $ response = $ this ->graphQlQuery ($ query3 );
1026
+ $ response = $ this ->graphQlQuery ($ this ->getQueryForPage (3 ));
1075
1027
$ this ->assertArrayNotHasKey ('errors ' , $ response );
1076
1028
$ this ->assertArrayHasKey ('categoryList ' , $ response );
1077
1029
$ baseCategory = $ response ['categoryList ' ][0 ];
0 commit comments