Bug in unit test: CMDBObjectTest->testCreateWithCategories()
tschreiner opened this issue · comments
Expected behavior
The test testCreateWithCategories() in CMDBObjectTest.php verifies from line 233-256 the creation of three category entries by checking the content of the $result associative array.
$modelEntryID, $firstIPEntryID and $secondIPEntryID should contain the correct references (
):
// Verify entries:
$objectID = $result['id'];
$modelEntryID = (int) $result['categories'][Category::CATG__MODEL][0];
$firstIPEntryID = $result['categories'][Category::CATG__IP][0];
$secondIPEntryID = $result['categories'][Category::CATG__IP][1];
Actual behavior
$secondIPEntryID contains an incorrect index and references the first IP entry of the array $result['categories'].
// Verify entries:
$objectID = $result['id'];
$modelEntryID = (int) $result['categories'][Category::CATG__MODEL][0];
$firstIPEntryID = $result['categories'][Category::CATG__IP][0];
$secondIPEntryID = $result['categories'][Category::CATG__IP][0];
Steps to reproduce the behavior
Run the unit test CMDBObjectTest->testCreateWithCategories().
Environment
Current main branch.