Yii2codeceptunit class not found

Source: Internet
Author: User
My test code is as follows {code ...} the following error occurs during execution: {code ...} for the code below, refer to the official {code ...} where is my problem? Thank you for your advice. My test code is as follows:


   1,            'channel_id' => 2,        ];        $this->assertTrue(UserSource::recordUserReg($params));    }}

The following error occurs during execution:

Unit Tests (1) --------------------------------------------------------------------------E UserSourceUintTest: Me -----------------------------------------------------------------------------------------Time: 40 ms, Memory: 6.00MBThere was 1 error:---------1) UserSourceUintTest: Me Test  tests/unit/UserSourceUintTest.php:testMe                                                     [Error] Class 'app\models\UserSource' not found                                                     #1  UserSourceUintTest->testMeERRORS!Tests: 1, Assertions: 0, Errors: 1.

Refer to the official

Classical Unit TestingUnit tests in Codeception are written in absolutely the same way as it is done in PHPUnit:
  username = null;        $this->assertFalse($user->validate(['username']));        $user->username = 'toolooooongnaaaaaaameeee';        $this->assertFalse($user->validate(['username']));        $user->username = 'davert';        $this->assertTrue($user->validate(['username']));               }}

Where is my problem? Thank you for your advice.

Reply content:

My test code is as follows:


   1,            'channel_id' => 2,        ];        $this->assertTrue(UserSource::recordUserReg($params));    }}

The following error occurs during execution:

Unit Tests (1) --------------------------------------------------------------------------E UserSourceUintTest: Me -----------------------------------------------------------------------------------------Time: 40 ms, Memory: 6.00MBThere was 1 error:---------1) UserSourceUintTest: Me Test  tests/unit/UserSourceUintTest.php:testMe                                                     [Error] Class 'app\models\UserSource' not found                                                     #1  UserSourceUintTest->testMeERRORS!Tests: 1, Assertions: 0, Errors: 1.

Refer to the official

Classical Unit TestingUnit tests in Codeception are written in absolutely the same way as it is done in PHPUnit:
  username = null;        $this->assertFalse($user->validate(['username']));        $user->username = 'toolooooongnaaaaaaameeee';        $this->assertFalse($user->validate(['username']));        $user->username = 'davert';        $this->assertTrue($user->validate(['username']));               }}

Where is my problem? Thank you for your advice.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.