php - Class not found in path -
so have php project , when i'm running tests class testcase
isn't found , can't figure out why. error in question this: fatal error: class 'project\tests\api\testcase' not found in /some/path/here/test/project/tests/api/userstest.php on line 6
the below file named userstest.php
, testcase
class can't found.
<?php namespace project\tests\api; class userstest extends testcase { // code here }
the below file testcase.php
exists in same folder userstest.php
<?php namespace project\tests\api; abstract class testcase extends \phpunit_framework_testcase { abstract protected function getapiclass(); protected function getapimock() { // code here } }
both of these files exists in folder structure test/project/tests/api/
. understanding userstest.php
should able find class because both of these files exist in same namespace.
in test/project
have bootstrap.php file looks this.
<?php function includeifexists($file) { if (file_exists($file)) { return include $file; } } if ((!$loader = includeifexists(__dir__.'/../vendor/autoload.php')) && (!$loader = includeifexists(__dir__.'/../../../.composer/autoload.php'))) { die('you must set project dependencies, run following commands:'.php_eol. 'curl -s http://getcomposer.org/installer | php'.php_eol. 'php composer.phar install'.php_eol); } $loader->add('project\tests', __dir__); return $loader;
Comments
Post a Comment