Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaspreetaxelerant/69158e60626b594081b78b1e2eaf012d to your computer and use it in GitHub Desktop.
Save jaspreetaxelerant/69158e60626b594081b78b1e2eaf012d to your computer and use it in GitHub Desktop.
runbehat.php
#!/usr/bin/env php
<?php
//Read CSV
//Open the file with correct path.
$fileHandle = fopen("/localpath/sites.csv", "r");
//Loop through the CSV rows.
while (($row = fgetcsv($fileHandle, 0, ",")) !== FALSE) {
//Dump out the row for the sake of clarity.
//var_dump($row);
//Generate json params
$params =
[ 'extensions' =>
[
'Behat\MinkExtension' =>
[
'base_url' => 'https://' . $row[1]
],
"emuse\BehatHTMLFormatter\BehatHTMLFormatterExtension" =>
[
"file_name" => $row[0]
]
]
];
$params = json_encode($params);
//Export json Params and run behat test
$json = "export BEHAT_PARAMS='" . $params . "'";
echo exec($json . "&& bin/behat");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment