제 테스트 코드는 다음과 같습니다
<code><?php use app\models\UserSource; class UserSourceUintTest extends \PHPUnit_Framework_TestCase { protected function setUp() { } protected function tearDown() { } // tests public function testMe() { $params = [ 'user_id' => 1, 'channel_id' => 2, ]; $this->assertTrue(UserSource::recordUserReg($params)); } }</code>
실행 시 다음 오류가 발생합니다.
<code>Unit Tests (1) -------------------------------------------------------------------------- E UserSourceUintTest: Me ----------------------------------------------------------------------------------------- Time: 40 ms, Memory: 6.00MB There was 1 error: --------- 1) UserSourceUintTest: Me Test tests/unit/UserSourceUintTest.php:testMe [Error] Class 'app\models\UserSource' not found #1 UserSourceUintTest->testMe ERRORS! Tests: 1, Assertions: 0, Errors: 1. </code>
아래 코드는 제가 참고하기 위한 공식코드입니다
<code>Classical Unit Testing Unit tests in Codeception are written in absolutely the same way as it is done in PHPUnit: <?php class UserTest extends \Codeception\Test\Unit { public function testValidation() { $user = User::create(); $user->username = null; $this->assertFalse($user->validate(['username'])); $user->username = 'toolooooongnaaaaaaameeee'; $this->assertFalse($user->validate(['username'])); $user->username = 'davert'; $this->assertTrue($user->validate(['username'])); } }</code>
내 문제는 무엇입니까? 여러분의 아낌없는 조언에 감사드립니다.
제 테스트 코드는 다음과 같습니다
<code><?php use app\models\UserSource; class UserSourceUintTest extends \PHPUnit_Framework_TestCase { protected function setUp() { } protected function tearDown() { } // tests public function testMe() { $params = [ 'user_id' => 1, 'channel_id' => 2, ]; $this->assertTrue(UserSource::recordUserReg($params)); } }</code>
실행 시 다음 오류가 발생합니다.
<code>Unit Tests (1) -------------------------------------------------------------------------- E UserSourceUintTest: Me ----------------------------------------------------------------------------------------- Time: 40 ms, Memory: 6.00MB There was 1 error: --------- 1) UserSourceUintTest: Me Test tests/unit/UserSourceUintTest.php:testMe [Error] Class 'app\models\UserSource' not found #1 UserSourceUintTest->testMe ERRORS! Tests: 1, Assertions: 0, Errors: 1. </code>
아래 코드는 공식 코드를 참고하기 위한 것입니다
<code>Classical Unit Testing Unit tests in Codeception are written in absolutely the same way as it is done in PHPUnit: <?php class UserTest extends \Codeception\Test\Unit { public function testValidation() { $user = User::create(); $user->username = null; $this->assertFalse($user->validate(['username'])); $user->username = 'toolooooongnaaaaaaameeee'; $this->assertFalse($user->validate(['username'])); $user->username = 'davert'; $this->assertTrue($user->validate(['username'])); } }</code>
내 문제는 무엇입니까? 아낌없는 조언 감사드립니다.