Created
December 9, 2015 16:24
-
-
Save resmall/3290f15ac7e56fc300de to your computer and use it in GitHub Desktop.
Alguns scripts/snippets pra testes no Laravel.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function test_atualizar_tarefa_from_user_panel() { | |
Session::start(); // Start a session | |
$this->patch('/projetos/1/tarefa/30', ['progresso' => 10, "_token" => csrf_token()], ['HTTP_REFERER' => 'http://localhost/usuarios/1/tarefa/30/edit']); | |
$this->assertResponseStatus(302); | |
$this->assertRedirectedToRoute('usuarios.tarefa.index', [1]); | |
} | |
// Metodo 2 sem desabilitar middleware | |
Session::start(); // Start a session | |
$response = $this->call('PATCH', '/projetos/1/tarefa/30', array("progresso" => "10", "_token" => csrf_token()), [], [], ['HTTP_REFERER' => 'http://localhost/usuarios/1/tarefa/30/edit']); | |
$this->assertEquals(302, $response->getStatusCode()); | |
$this->assertRedirectedToRoute('usuarios.tarefa.index', [1]); | |
// Metodo 3, não tem como verificar a URL | |
$response = $this->actingAs($this->user) | |
->visit('/usuarios/1/tarefa/30/edit') | |
->select('10', 'progresso') | |
->press('Salvar') | |
->see('Tarefas'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment