You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
urlhub/tests/Unit/Controllers/UrlRedirectControllerTest.php

26 lines
545 B

<?php
namespace Tests\Unit\Controllers;
use App\Models\Url;
use App\Models\Visit;
use Tests\TestCase;
class UrlRedirectControllerTest extends TestCase
{
/**
* @test
* @group u-controller
*/
public function urlRedirection()
{
$url = Url::factory()->create();
$response = $this->get(route('home').'/'.$url->keyword);
$response->assertRedirect($url->long_url);
$response->assertStatus((int) config('urlhub.redirect_status_code'));
$this->assertCount(1, Visit::all());
}
}