Skip to content

Commit

Permalink
Ensure TaintTest datasets have unique keys
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcev106 committed Jan 2, 2023
1 parent a5fe942 commit c6879ef
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/TaintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ public function providerInvalidCodeParse(): array
'array_values([$_GET["a"]])',
]);

return array_merge([
$otherDataSets = [
'taintedInputFromMethodReturnTypeSimple' => [
'code' => '<?php
class A {
Expand Down Expand Up @@ -2598,7 +2598,22 @@ public static function getPrevious(string $s): string {
echo pg_escape_string($conn, $_GET["a"]);',
'error_message' => 'TaintedHtml',
],
], $arrayFunctionTaintFlowDataSets);
];

$dataSetsArrays = [
$otherDataSets,
$arrayFunctionTaintFlowDataSets
];

$expectedCount = 0;
foreach($dataSetsArrays as $array){
$expectedCount += count($array);
}

$mergedDataSets = array_merge(...$dataSetsArrays);
$this->assertSame($expectedCount, count($mergedDataSets), "Please make sure none of the datasets have duplicate keys!");

return $mergedDataSets;
}

/**
Expand Down

0 comments on commit c6879ef

Please sign in to comment.