php - I keep getting this error when I try input phpunit -
i keep getting error in command line on phpstorm when try use phpunit. can explain me? i'm new phpunit.
c:\xampp\php\phpunit.bat
warning: missing argument 3 phpunit_textui_testrunner::dorun(), called in c:\xampp\php\pear\phpunit\textui\command.php on line 176 , defined in c:\xampp\htdocs\tutorials\php_unit_testing\vendor\phpunit\phpunit\src\textui\testrunner.php on line 148
phpunit 5.3-dev sebastian bergmann , contributors.
fatal error: class 'controllers\core\web\pages' not found in c:\xampp\htdocs\tutorials\php_unit_testing\tests\app\controllers\core\web\pagestest.php on line 6
process finished exit code 255 @ 22:23:20. execution time: 186 ms.
here code xml file:
<?xml version='1.0' encoding='utf-8' ?> <phpunit bootstrap="./vendor/autoload.php" color="true" converterrorstoexceptions="true" convertnoticestoexceptions="true" convertwarningstoexceptions="true" stoponfailures="false" syntaxcheck="false" > <testsuites> <testsuite name="tutorial unit tests"> <directory>./tests/</directory> </testsuite> </testsuites> </phpunit>
and code pages.php:
<?php namespace controllers\core\web; class pages{ public function rendor(){ return 'hello world'; } public function return_true(){ return true; } public function return_array(){ return array('hello', 'world', 'this', 'is', 'an', 'array'); } } ?>
and code pagestest.php:
<?php class pagestest extends phpunit_framework_testcase { public function testrenderreturnshelloworld(){ $pages = new \controllers\core\web\pages(); $expected = 'hello word'; $this->assertequals($expected, $pages->rendor()); } } ?>
it doesn't you're loading in library. typically have create alternate autoload.php
file , include in phpunit bootsrap value. this:
<phpunit bootstrap="./autoload.php" ...
#./auotload.php $loader = require_once __dir__ . '/vendor/autoload.php'; $loader.add('directory_of_code', 'path/to/that/directory'); return $loader;
Comments
Post a Comment