-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathSidebarBrandViewTest.php
71 lines (52 loc) · 2.08 KB
/
SidebarBrandViewTest.php
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
declare(strict_types=1);
namespace Hyde\Framework\Testing\Feature\Views;
use Hyde\Hyde;
use Hyde\Testing\TestCase;
use Hyde\Foundation\HydeKernel;
use Hyde\Testing\TestsBladeViews;
use Hyde\Pages\DocumentationPage;
class SidebarBrandViewTest extends TestCase
{
use TestsBladeViews;
public function testSidebarBrandView()
{
$view = $this->test(view('hyde::components.docs.sidebar-brand'));
$view->assertSee('HydePHP Docs');
$view->assertSee('theme-toggle-button');
$view->assertDontSee('href');
}
public function testSidebarBrandViewWithHomeRoute()
{
Hyde::routes()->addRoute((new DocumentationPage('index'))->getRoute());
$view = $this->test(view('hyde::components.docs.sidebar-brand'));
$view->assertSee('HydePHP Docs');
$view->assertSee('theme-toggle-button');
$view->assertSeeHtml('<a href="docs/index.html">HydePHP Docs</a>', true);
}
public function testSidebarBrandViewWithDefaultHeaderText()
{
config(['docs.sidebar' => []]);
$view = $this->test(view('hyde::components.docs.sidebar-brand'));
$view->assertSee('Documentation');
$view->assertDontSee('HydePHP Docs');
}
public function testSidebarBrandViewWithDefaultHeaderTextAndHomeRoute()
{
Hyde::routes()->addRoute((new DocumentationPage('index'))->getRoute());
config(['docs.sidebar' => []]);
$view = $this->test(view('hyde::components.docs.sidebar-brand'));
$view->assertSee('Documentation');
$view->assertSeeHtml('<a href="docs/index.html">Documentation</a>', true);
$view->assertDontSee('HydePHP Docs');
}
public function testSidebarBrandViewWithoutDarkmodeFeature()
{
$mock = $this->mock(HydeKernel::class)->makePartial();
$mock->shouldReceive('hasFeature')->with('darkmode')->andReturn(false);
HydeKernel::setInstance($mock);
$view = $this->test(view('hyde::components.docs.sidebar-brand'));
$view->assertSee('HydePHP Docs');
$view->assertDontSee('theme-toggle-button');
}
}