public function testCreateOK() { // prevent validation error on captcha NoCaptcha::shouldReceive('verifyResponse')->once()->andReturn(true); // provide hidden input for your 'required' validation NoCaptcha::shouldReceive('display')->zeroOrMoreTimes()->andReturn('<input type="hidden" name="g-recaptcha-response" value="1" />'); // Good $this->visit('/reservations/create')->see('Formulaire de Réservation')->type($this->reservation->name, 'name')->type($this->reservation->forename, 'forename')->type($this->reservation->email, 'email')->type($this->reservation->nb_people, 'nb_people')->type($this->reservation->arrive_at, 'arrive_at')->type($this->reservation->leave_at, 'leave_at')->press('Envoyer')->see('Réservation')->see(htmlentities("De {$this->reservation->name} {$this->reservation->forename} pour {$this->reservation->nb_people} personne(s).", ENT_QUOTES))->see('Refusée'); }
public function testRegisterAction() { // use the factory to create a Faker\Generator instance $faker = Faker\Factory::create(); // Add pt_BR provider $faker->addProvider(new Faker\Provider\pt_BR\Person($faker)); //Generate a User Data to Register $name = $faker->name($gender = null | 'male' | 'female'); $email = $faker->freeEmail(); $cpf = $faker->cpf; $pwd = '123456'; $state = State::all()->random(); $uuid = $faker->uuid; // prevent validation error on captcha NoCaptcha::shouldReceive('verifyResponse')->once()->andReturn(true); // provide hidden input for your 'required' validation NoCaptcha::shouldReceive('display')->zeroOrMoreTimes()->andReturn('<input type="hidden" name="g-recaptcha-response" value="1" />'); $this->visit('/')->click('Registro')->seePageIs('/login')->type($name, 'name')->type($email, 'email')->type($cpf, 'cpf')->type($pwd, 'password')->type($pwd, 'password_confirmation')->select($state->uf, 'uf')->type($uuid, 'uuid')->press('Registro')->see('Registro feito com Sucesso.')->seePageIs('/')->seeInDatabase('users', ['email' => $email]); }
/** * @test */ public function it_can_display_recaptcha() { $this->app['config']->set('laravolt.auth.captcha', true); $this->get(route('auth::login')); NoCaptcha::shouldReceive('display')->zeroOrMoreTimes()->andReturn('<input type="hidden" name="g-recaptcha-response" value="1" />'); }