php - phpunit gives errors even with no tests (Laravel) -
hi download phpunit.phar in laravel project (which developed partly). started doing simple
php phpunit.phar
but outputs things whole viewfiles @ end:
{"error":{"type":"errorexception","message":"undefined variable: currency","file":"c:\\wamp\\www\\project.dev\\app\\views\\front\\settings.php","line":79}}
this not test , code works when testing out in browser. using default phpunit configuration file shipped laravel.
edit: code
<label class="radio"> <input type="radio" name="settings_currency" id="set_curr_<?=$currency->id?>" value="<?=$currency->id?>" checked> <span class="symbol"><?=$currency->symbol?></span> <?=$currency->name?> <span><?=$currency->abbr?></span> </label>
you cannot run phpunit , expect test useful. have configure it!
when run, phpunit scans current directory , subdirectories php files, includes them , checks if there test classes defined can run. including view files execute them without context, i.e. you'll complete echo , notices used, undefined variables.
as starter, create "phpunit.xml" in same directory starting phpunit. read documentation on how create it's contents. first , foremost need specify directory scan test classes <testsuites>
element.
Comments
Post a Comment