I create a new user in testRegisterNewUser and save username in class field variable:
private $_userName; protected function userName () { if (empty($this->_userName)) { $this->_userName = uniqid('test_'); } return $this->_userName; } public function testRegisterNewUser() { $user = new User($this->userName() ); // create user with random name }
After that, I try to use this value in another class method, but $_userName not initialized with original value from testRegisterNewUser!
public function testFundUser() { $user = User::findByUsername( $this->userName() ); // fails, $this->userName() gives "non original" value }
Question, is when I run tests with codecept run
,
Is this mean that Codeception\TestCase\Test
class recreated for every test* method call ?
0 comments:
Post a Comment