-
-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathRuleDetailControllerTest.php
More file actions
40 lines (31 loc) · 1.17 KB
/
RuleDetailControllerTest.php
File metadata and controls
40 lines (31 loc) · 1.17 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
<?php
declare(strict_types=1);
namespace App\Tests\Controller;
use App\Tests\AbstractTestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
final class RuleDetailControllerTest extends AbstractTestCase
{
public function testItRendersRulesBySlug(): void
{
$testResponse = $this->get('/rule-detail/simplify-array-search-rector');
$testResponse
->assertOk()
->assertViewIs('homepage.rule_detail')
->assertViewHas('ruleMetadata')
->assertViewHas('codeMirror', true)
->assertViewHas('page_title', 'SimplifyArraySearchRector')
->assertSeeText('SimplifyArraySearchRector');
}
public function testItRedirectsToFindRuleIfRuleNotFound(): void
{
$testResponse = $this->get('/rule-detail/unknown-rule');
$testResponse->assertRedirect('/find-rule');
}
public function testItRedirectsToKebabCaseSlugIfPascalCaseSlug(): void
{
$testResponse = $this->get('/rule-detail/SimplifyArraySearchRector');
$testResponse->assertRedirect('/rule-detail/simplify-array-search-rector');
}
}