assertGreaterThanOrEqual($iSeverity, $oCheck->iSeverity); if (!$bLabelFound && (empty($sLabel) || strpos($oCheck->sLabel, $sLabel) !== false)) { $bLabelFound = true; } } $this->assertTrue($bLabelFound, "label '$sLabel' not found"); } public function CheckGraphvizProvider(){ if (substr(PHP_OS,0,3) === 'WIN'){ return []; } return [ "bash injection" => [ "touch /tmp/toto", self::WARNING, "could not be executed: Please make sure it is installed and in the path", ], "command ok" => [ "/usr/bin/whereis", self::INFO, "", ], "empty command => dot by default" => [ "", self::INFO, "", ], "command failed" => [ "/bin/ls", self::WARNING, "dot could not be executed (retcode=2): Please make sure it is installed and in the path", ] ]; } /** * @dataProvider HumanReadableSizeProvider */ public function testHumanReadableSize($fBytes, $sExpected) { $sOutput = SetupUtils::HumanReadableSize($fBytes); $this->assertEquals($sExpected, $sOutput); } public function HumanReadableSizeProvider(): array { return [ '10 bytes' => [ 10, '10 bytes', ], '10 kilobytes' => [ 10 * 1024, '10.24 KB', ], '10 megabytes' => [ 10 * 1024 * 1024, '10.49 MB', ], '10 gigabytes' => [ 10 * 1024 * 1024 * 1024, '10.74 GB', ], '10 terabytes' => [ 10 * 1024 * 1024 * 1024 * 1024, '11.00 TB', ], '10 petabytes' => [ 10 * 1024 * 1024 * 1024 * 1024 * 1024, '11.26 PB', ], '10 heptabytes' => [ 10 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, '11.53 HB', ], ]; } }