Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jaspreetaxelerant/6faf1b7cd5d9aa28f82cff64cfbef5e3 to your computer and use it in GitHub Desktop.
Save jaspreetaxelerant/6faf1b7cd5d9aa28f82cff64cfbef5e3 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