I'm making function test on my laravel(4) project with Codeception. But it doesn't detected function define in Laravel helper.php file. If anybody know please let me know the way to fix it. Thanks.
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;
}
I use this helper function for form select but when run codeception, got Call to undefined function rangeWithKeys() error.
{{ Form::select('birthMonth', array('M' => 'M') + rangeWithKeys(1,12, TRUE), Input::old('Month') ? Input::old('Month') : 'M',['class' => 'form-control'])}}
You can include the following syntax in top of the controller file.