Yii Framework Forum: Yii2 captcha unit test - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii2 captcha unit test How make works unit test with captcha

#1 User is offline   TinweDeveloper 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 30-November 17

Posted 30 November 2017 - 03:00 PM

Hello,
Should i make unit test with validate my RegisterForm with some difference data? I can't make it work beacuse captcha throw exception about action ID.


   
$this->model = new RegisterForm([
               UserFormsEnums::FIELD_CAPTCHA => 'testme',
        ]);

        $this->model->validate();

  codecept_debug($this->model->errors);
        expect($this->model->errors)->isEmpty();



Thank you for any advice.
0

#2 User is offline   alrazi 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,490
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 01 December 2017 - 05:13 AM

activerecord has support for scenarios basically you can skip validation rules based on scenarios here is a link to the docs

http://www.yiiframew....html#scenarios
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users