3 years ago

How to test form containing php captcha validation in laravel

Posted 3 years ago by vishal.varshney

hi guys, while writing php unit test case in laravel, how we send php captcha value. i am using php captcha

public function testSignupStoreFunction() {
        $data['first_name'] = "vsdghvfas";
        $data['last_name'] = "asdas";
        $data['email_id'] = "[email protected]";
        $data['password'] = "asd1#";
        $data['password_confirmation'] = "asd1#";
        $data['d_o_b'] = "1/20/1970";
        $data['gender'] = "M";
        $data['terms_condition'] = true;
        Session::start(); // Start a session for the current test
        $data['captcha_code'] = ""; // session('catcha_code')// <---------------------- here
        $data['_token'] = csrf_token(); // Retrieve current csrf token
        $response = $this->call('POST', 'candidate/store', $data); 

My rules in CandidateSignupRequest.php

public function rules()
        return [

Please sign in or create an account to participate in this conversation.