protected function setUp() { parent::setUp(); $this->mockApplication($this->getParam('app'), '\\yii\\console\\Application'); $this->identity = $this->getMock('nineinchnick\\usr\\tests\\User', ['getPasswordDate', 'getOneTimePasswordSecret', 'getOneTimePassword']); $this->identity->expects($this->any())->method('getPasswordDate')->will($this->returnValue('2013-10-10')); $this->identity->expects($this->any())->method('getOneTimePasswordSecret')->will($this->returnValue('ZCIDBJZMPVFXZIKA')); $this->identity->expects($this->any())->method('getOneTimePassword')->will($this->returnValue([null, 1])); $this->owner = $this->getMock('stdClass', ['on', 'getIdentity', 'hasErrors', 'getErrors', 'addError', 'rules', 'attributeLabels', 'attributes']); $this->owner->username = '******'; $this->owner->expects($this->any())->method('on'); $this->owner->expects($this->any())->method('getIdentity')->will($this->returnValue($this->identity)); $this->owner->expects($this->any())->method('hasErrors')->will($this->returnValue(false)); $this->owner->expects($this->any())->method('getErrors')->will($this->returnValue([])); $this->owner->expects($this->any())->method('addError'); $this->owner->expects($this->any())->method('rules')->will($this->returnValue([['username', 'required']])); $this->owner->expects($this->any())->method('attributeLabels')->will($this->returnValue(['username' => 'label'])); $this->owner->expects($this->any())->method('attributes')->will($this->returnValue(['username'])); }
protected function setUp() { parent::setUp(); $this->mockApplication($this->getParam('app'), '\\yii\\console\\Application'); }