Created
July 3, 2019 10:24
-
-
Save jaspreetaxelerant/69158e60626b594081b78b1e2eaf012d to your computer and use it in GitHub Desktop.
runbehat.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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