phpunit - Models unit testing on Yii2 -


i'm trying build yii2 app through unit testing , have questions it.

class userstest extends \codeception\testcase\test {    /**     * @var \unittester     */     protected $users;      protected function _before()     {         $this->users = new \app\models\users;     }      protected function _after()     {     }      // tests     public function testgeid()     {      }  } 

when try run test class have fatal error message users class not found. cause of problem , how solve it?

there readme file in yii2 tests folder tell setup yii2-faker , yii2_basic_tests database. these 2 things , why should use them?

thank you.

it need create application instance in tests/_bootstrap.php. must following code in file:

require('/../vendor/autoload.php'); require('/../vendor/yiisoft/yii2/yii.php');  $config = require('config/web.php');  (new yii\web\application($config)); 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -