Created
July 10, 2019 16:02
-
-
Save jaspreetaxelerant/6faf1b7cd5d9aa28f82cff64cfbef5e3 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