Skip to main content

Ruta de laravelLaravel 5.5 con where"where"

Hola estoy empezando a pasar mi web a laravelLaravel y me encuentro con un problema en una ruta con clausula wherewhere que tiene una pequeña regexregex

Route::get('/{region}/leader/{bracket}', 'LeaderController')
        ->where(['region' => '(en|us)', 'bracket' => '(2v2|3v3|rbg)']);

Os dejo la salida del test:

.3 by Sebastian Bergmann and contributors.

F.                                                                  2 / 2 (100%)

Time: 202 ms, Memory: 12.00MB

There was 1 failure:

1) Tests\Feature\LeaderControllerTest::its_load_leader_eu_2v2
Expected status code 200 but received 404.
Failed asserting that false is true.

C:\laragon\www\murlocmate\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:78
C:\laragon\www\murlocmate\tests\Feature\LeaderControllerTest.php:14

FAILURES!
Tests: 2, Assertions: 2, Failures: 1.

CodigoCódigo del test:

public function its_load_leader_eu_2v2()
    {
        $this->get('/eu/leader/2v2')
            ->assertStatus(200)
            ->assertSee('eu 2v2');
    }

Ruta de laravel con where

Hola estoy empezando a pasar mi web a laravel y me encuentro con un problema en una ruta con clausula where que tiene una pequeña regex

Route::get('/{region}/leader/{bracket}', 'LeaderController')
        ->where(['region' => '(en|us)', 'bracket' => '(2v2|3v3|rbg)']);

Os dejo la salida del test:

.3 by Sebastian Bergmann and contributors.

F.                                                                  2 / 2 (100%)

Time: 202 ms, Memory: 12.00MB

There was 1 failure:

1) Tests\Feature\LeaderControllerTest::its_load_leader_eu_2v2
Expected status code 200 but received 404.
Failed asserting that false is true.

C:\laragon\www\murlocmate\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:78
C:\laragon\www\murlocmate\tests\Feature\LeaderControllerTest.php:14

FAILURES!
Tests: 2, Assertions: 2, Failures: 1.

Codigo del test:

public function its_load_leader_eu_2v2()
    {
        $this->get('/eu/leader/2v2')
            ->assertStatus(200)
            ->assertSee('eu 2v2');
    }

Ruta de Laravel 5.5 con "where"

Hola estoy empezando a pasar mi web a Laravel y me encuentro con un problema en una ruta con clausula where que tiene una pequeña regex

Route::get('/{region}/leader/{bracket}', 'LeaderController')
        ->where(['region' => '(en|us)', 'bracket' => '(2v2|3v3|rbg)']);

Os dejo la salida del test:

.3 by Sebastian Bergmann and contributors.

F.                                                                  2 / 2 (100%)

Time: 202 ms, Memory: 12.00MB

There was 1 failure:

1) Tests\Feature\LeaderControllerTest::its_load_leader_eu_2v2
Expected status code 200 but received 404.
Failed asserting that false is true.

C:\laragon\www\murlocmate\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:78
C:\laragon\www\murlocmate\tests\Feature\LeaderControllerTest.php:14

FAILURES!
Tests: 2, Assertions: 2, Failures: 1.

Código del test:

public function its_load_leader_eu_2v2()
    {
        $this->get('/eu/leader/2v2')
            ->assertStatus(200)
            ->assertSee('eu 2v2');
    }
Origen Enlace
Akond
  • 45
  • 1
  • 6

Ruta de laravel con where

Hola estoy empezando a pasar mi web a laravel y me encuentro con un problema en una ruta con clausula where que tiene una pequeña regex

Route::get('/{region}/leader/{bracket}', 'LeaderController')
        ->where(['region' => '(en|us)', 'bracket' => '(2v2|3v3|rbg)']);

Os dejo la salida del test:

.3 by Sebastian Bergmann and contributors.

F.                                                                  2 / 2 (100%)

Time: 202 ms, Memory: 12.00MB

There was 1 failure:

1) Tests\Feature\LeaderControllerTest::its_load_leader_eu_2v2
Expected status code 200 but received 404.
Failed asserting that false is true.

C:\laragon\www\murlocmate\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:78
C:\laragon\www\murlocmate\tests\Feature\LeaderControllerTest.php:14

FAILURES!
Tests: 2, Assertions: 2, Failures: 1.

Codigo del test:

public function its_load_leader_eu_2v2()
    {
        $this->get('/eu/leader/2v2')
            ->assertStatus(200)
            ->assertSee('eu 2v2');
    }