在yii2框架中运行单元测试时获取html脚本

时间:2017-08-07 11:38:33

标签: php yii2

当我在控制台中运行测试时,我正在获取HTML和CSS代码。其他测试运行正常我只有这个问题...任何人都可以帮忙吗? 谢谢

这是我的DemoFeature

namespace app\tests\fixtures;

use yii\test\ActiveFixture;

class DemoFixture extends ActiveFixture{

    public $modelClass = '\website\models\DemoForm';
}

这是我的DemoTest

namespace app\tests\unit;

use app\tests\fixtures\DemoFixture;
use website\models\DemoForm;


class DemoTest extends \Codeception\Test\Unit{

    protected function _before() {
        parent::_before();
    }

    public function _fixtures() {
        return ['demo' => DemoFixture::className()];
    }

    protected function _after() {

    }

    public function testDemoProcess(){

        $demo = new DemoForm;

        $demo->name = 'Sample Name';
        $demo->company = 'cloudadic'.rand(115, 54785);
        $demo->email = 'demo'.rand(115, 547).'@example.com';
        $demo->message = 'Sample Company';
        $this->assertTrue($demo->save());

    }
}

0 个答案:

没有答案