Finish re-working tests to run on test database
This commit is contained in:
parent
09fc211623
commit
1abca77bdc
50 changed files with 535 additions and 265 deletions
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Article;
|
||||
use Jonnybarnes\IndieWeb\Numbers;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ArticlesTest extends TestCase
|
||||
|
@ -18,22 +20,26 @@ class ArticlesTest extends TestCase
|
|||
/** @test */
|
||||
public function singleArticlePageLoads()
|
||||
{
|
||||
$response = $this->get('/blog/' . date('Y') . '/' . date('m') . '/some-code-i-did');
|
||||
$article = Article::factory()->create();
|
||||
$response = $this->get($article->link);
|
||||
$response->assertViewIs('articles.show');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function wrongDateInUrlRedirectsToCorrectDate()
|
||||
{
|
||||
$response = $this->get('/blog/1900/01/some-code-i-did');
|
||||
$response->assertRedirect('/blog/' . date('Y') . '/' . date('m') . '/some-code-i-did');
|
||||
$article = Article::factory()->create();
|
||||
$response = $this->get('/blog/1900/01/' . $article->titleurl);
|
||||
$response->assertRedirect('/blog/' . date('Y') . '/' . date('m') . '/' . $article->titleurl);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function oldUrlsWithIdAreRedirected()
|
||||
{
|
||||
$response = $this->get('/blog/s/2');
|
||||
$response->assertRedirect('/blog/' . date('Y') . '/' . date('m') . '/some-code-i-did');
|
||||
$article = Article::factory()->create();
|
||||
$num60Id = resolve(Numbers::class)->numto60($article->id);
|
||||
$response = $this->get('/blog/s/' . $num60Id);
|
||||
$response->assertRedirect($article->link);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue