-
-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathPluginTableOfContentsTest.php
More file actions
43 lines (34 loc) · 1.14 KB
/
PluginTableOfContentsTest.php
File metadata and controls
43 lines (34 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace Tests\Feature;
use App\Features\ShowPlugins;
use App\Models\Plugin;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Laravel\Pennant\Feature;
use Tests\TestCase;
class PluginTableOfContentsTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
Feature::define(ShowPlugins::class, true);
}
public function test_toc_component_rendered_when_readme_has_content(): void
{
$plugin = Plugin::factory()->approved()->create([
'readme_html' => '<h2 id="installation">Installation</h2><p>Steps here.</p><h2 id="usage">Usage</h2><p>More content.</p>',
]);
$this->get(route('plugins.show', $plugin->routeParams()))
->assertStatus(200)
->assertSee('On this page');
}
public function test_toc_component_not_rendered_when_no_readme(): void
{
$plugin = Plugin::factory()->approved()->create([
'readme_html' => null,
]);
$this->get(route('plugins.show', $plugin->routeParams()))
->assertStatus(200)
->assertDontSee('On this page');
}
}