File tree Expand file tree Collapse file tree 1 file changed +43
-2
lines changed Expand file tree Collapse file tree 1 file changed +43
-2
lines changed Original file line number Diff line number Diff line change @@ -1279,10 +1279,51 @@ public function testFindDangerousArgChanges()
12791279
12801280 $ this ->assertEquals (
12811281 [
1282- 'type ' => FindBreakingChanges::DANGEROUS_CHANGE_ARG_DEFAULT_VALUE ,
1283- 'description ' => 'Type1->field1 arg name has changed defaultValue '
1282+ 'type ' => FindBreakingChanges::DANGEROUS_CHANGE_ARG_DEFAULT_VALUE ,
1283+ 'description ' => 'Type1->field1 arg name has changed defaultValue '
12841284 ],
12851285 FindBreakingChanges::findArgChanges ($ oldSchema , $ newSchema )['dangerousChanges ' ][0 ]
12861286 );
12871287 }
1288+
1289+ public function testDetectsEnumValueAdditions ()
1290+ {
1291+ $ oldEnumType = new EnumType ([
1292+ 'name ' => 'EnumType1 ' ,
1293+ 'values ' => [
1294+ 'VALUE0 ' => 0 ,
1295+ 'VALUE1 ' => 1 ,
1296+ ]
1297+ ]);
1298+ $ newEnumType = new EnumType ([
1299+ 'name ' => 'EnumType1 ' ,
1300+ 'values ' => [
1301+ 'VALUE0 ' => 0 ,
1302+ 'VALUE1 ' => 1 ,
1303+ 'VALUE2 ' => 2
1304+ ]
1305+ ]);
1306+
1307+ $ oldSchema = new Schema ([
1308+ 'query ' => $ this ->queryType ,
1309+ 'types ' => [
1310+ $ oldEnumType
1311+ ]
1312+ ]);
1313+
1314+ $ newSchema = new Schema ([
1315+ 'query ' => $ this ->queryType ,
1316+ 'types ' => [
1317+ $ newEnumType
1318+ ]
1319+ ]);
1320+
1321+ $ this ->assertEquals (
1322+ [
1323+ 'type ' => FindBreakingChanges::DANGEROUS_CHANGE_VALUE_ADDED_TO_ENUM ,
1324+ 'description ' => 'VALUE2 was added to enum type EnumType1 '
1325+ ],
1326+ FindBreakingChanges::findValuesAddedToEnums ($ oldSchema , $ newSchema )[0 ]
1327+ );
1328+ }
12881329}
You can’t perform that action at this time.
0 commit comments