Skip to content

Commit e0a63ec

Browse files
author
Ben Roberts
committed
testDetectsEnumValueAdditions
1 parent c4ae034 commit e0a63ec

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

tests/Utils/FindBreakingChangesTest.php

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)