Option 1
It's possible to make step argument transformations. Then you can easily convert comma-separated string to an array. An Example:
Behat step
Given article "Test article" is published at "Foo, Bar"
Step code:
<?php
use Behat\Behat\Context\BehatContext;
class FeatureContext extends BehatContext
{
/**
* @Transform "([^"]*)"
*/
public function castStringToNumber($value)
{
return explode(',' $value);
}
/**
* @Given /^article "([^"]*)" is published at "([^"]*)"$/
*/
public function givenArticleIsPublishedAtPages($title, $pages){
foreach ($pages as $page) {
// ...
}
}
Option 2
Another option is to explode a comma-separated string:
Behat step
Given article "Test article" is published at "Foo, Bar"
Step code:
/**
* @Given /^article "([^"]*)" is published at "([^"]*)"$/
*/
public function givenArticleIsPublishedAtMediums($title, $mediums){
// Explode mediums from a string.
foreach (explode(',', $mediums) as $medium) {
// ...
}
}