gpt4 book ai didi

arrays - 数组作为 Behat 步骤中的参数

转载 作者:行者123 更新时间:2023-12-01 09:24:52 24 4
gpt4 key购买 nike

是否可以在 Behat 步骤中将数组作为参数传递?

例如想要这样的东西:

When I select <"Alex","Sergey"> in "users"

我知道对于这种情况,我可以使用:
When I select "Alex" from "users"
And I additionally select "Sergey" from "users"

但问题是关于在这里使用数组。

最佳答案

这是我想出的

Given "foo" translations equal "[foo,bar,bazz]"

/**
* @Transform /^\[(.*)\]$/
*/
public function castStringToArray($string)
{
return explode(',', $string);
}

/**
* @Given /^"([^"]*)" translations equal "([^"]*)"$/
*/
public function translationsEqual($phraseName, $translations)
{
// we have an array now
var_dump($translations);
}

关于arrays - 数组作为 Behat 步骤中的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26927454/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com