【发布时间】:2015-06-24 15:22:51
【问题描述】:
我正在使用 Codeception 对我的 laravel(4) 项目进行功能测试。但它没有检测到 Laravel helper.php 文件中定义的函数。如果有人知道,请告诉我解决方法。谢谢。
function rangeWithKeys($from, $to, $leadingZeros = false)
{
if ($leadingZeros === TRUE )
{
$array = [];
for($i =$from; $i <= $to; $i++)
{
if($i<10){
$prefixedNumber = '0'.$i;
$array[$prefixedNumber] = $prefixedNumber;
}else{
$array[$i] = $i;
}
}
return $array;
}
$array = array_combine(range($from,$to),range($from,$to));
return $array;
}
我使用此辅助函数进行表单选择,但在运行代码接收时,调用未定义函数 rangeWithKeys() 错误。
{{ Form::select('birthMonth', array('M' => 'M') + rangeWithKeys(1,12, TRUE), Input::old('Month') ? Input::old('Month') : 'M',['class' => 'form-control'])}}
【问题讨论】:
标签: php laravel-4 codeception