Repository navigation
Expand file tree
/
Copy pathShellViewTest.php
More file actions
77 lines (66 loc) · 2.22 KB
/
Copy pathShellViewTest.php
File metadata and controls
77 lines (66 loc) · 2.22 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
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
72
73
74
75
76
77
<?php
declare(strict_types=1);
namespace PHPForge\Debug\Tests\View;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use function dirname;
use function ob_get_clean;
use function ob_start;
/**
* Verifies focus-target semantics in the shared debugger shell view.
*/
#[Group('view')]
final class ShellViewTest extends TestCase
{
public function testBareMainIsProgrammaticallyFocusable(): void
{
$html = self::renderShell(false);
self::assertMatchesRegularExpression(
'~<main\b(?=[^>]*\bid="yii-debug-main")(?=[^>]*\btabindex="-1")[^>]*>~',
$html,
'The bare skip-link target must accept programmatic focus.',
);
}
public function testShellSkipLinkTargetsProgrammaticallyFocusableMain(): void
{
$html = self::renderShell(true);
self::assertStringContainsString(
'href="#yii-debug-main"',
$html,
'The skip link must retain the shared main target.',
);
self::assertMatchesRegularExpression(
'~<main\b(?=[^>]*\bid="yii-debug-main")(?=[^>]*\btabindex="-1")[^>]*>~',
$html,
'The shell skip-link target must accept programmatic focus.',
);
self::assertStringContainsString('Copy link', $html, 'The shared link-copy action must remain available.');
self::assertStringNotContainsString(
'yii-debug-density-toggle',
$html,
'The shell must not render the removed density preference.',
);
}
private static function renderShell(bool $useShell): string
{
$actionIcon = '';
$actionLabel = 'Configuration';
$actionTitle = 'Open configuration';
$actionUrl = null;
$content = '<p>Panel content</p>';
$debugTheme = 'light';
$historyUrl = '/debug';
$mode = 'panel';
$peakMemory = null;
$phpIcon = '';
$phpVersion = '8.3';
$sidebar = '<nav>Panels</nav>';
$themeIconMoon = '';
$themeIconSun = '';
$yiiIcon = '';
$yiiVersion = '2.0';
ob_start();
require dirname(__DIR__, 2) . '/resources/views/_shell.php';
return (string) ob_get_clean();
}
}