Captures the current working tree after theme slots, ArticleAccess, and the payment / paid-content plugins so subsequent work has a reviewable git history.
41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Article;
|
|
use App\Models\Category;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class BlogFrontendTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_home_and_article_legacy_urls(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
$category = Category::query()->create(['name' => '随笔', 'display_order' => 0]);
|
|
$article = Article::query()->create([
|
|
'category_id' => $category->id,
|
|
'user_id' => $user->id,
|
|
'title' => 'Hello',
|
|
'content' => "## Hi\n\nworld",
|
|
'content_format' => 'markdown',
|
|
'published_at' => now()->subHour(),
|
|
'visible' => true,
|
|
]);
|
|
|
|
$this->get('/')
|
|
->assertOk()
|
|
->assertSee('Hello')
|
|
->assertSee('/themes/default/style.css', false);
|
|
$this->get('/show-'.$article->id.'.shtml')->assertOk()->assertSee('Hi');
|
|
$this->get('/tburl.php')->assertStatus(410);
|
|
$this->get('/llms.txt')->assertOk()->assertSee('Guidance for AI systems');
|
|
$this->get('/robots.txt')->assertOk()->assertSee('Sitemap:');
|
|
$this->get('/rss.xml')->assertOk();
|
|
$this->get('/sitemap.xml')->assertOk();
|
|
}
|
|
}
|