jeudi 23 juin 2016

Yii2 Codception, Usage of Model displays html elements in the command prompt

I am using Codception for testing, I have configured them and It is all set with my yii2 application. For some reason when ever I call the instance of my model it displays html elements when I run my run test command. AserTest.php file

use app\models\SimUser;
use app\models\LoginForm;
use Codeception\Specify;
class AserTest extends \Codeception\Test\Unit
{

    protected $tester;

    // executed before each test
    protected function _before()
    {
    }

    // executed after each test
    protected function _after()
    {
    }

    // TODO add test methods here
     public function testValidateEmail()
    {
        $user = new \app\models\SimUser();

        $user->findByUsername('sysadmin@dcm.com');
        $this->assertFalse($user->user_email == "sysadmin@dcm.com");
        unset($user);
    }

    public function testValidatePassword()
    {
        $user = SimUser::find()->where(['user_id'=> 1])->one();
        $this->assertTrue(
                $user->validatePassword('Sysadmin13'));  
    }   

If you see the above the testValidatePassword breaks the test and it displays the Html elements in my command prompt. It has title of yii\base\ErrorException. Can anyone help me if you can figure out what's the solution for this? thanks in advance.

Aucun commentaire:

Enregistrer un commentaire