Skip to content

Commit 20d38b8

Browse files
rpkampsebastianbergmann
authored andcommitted
Update bootstrap for HTML coverage to version 4
1 parent daeb271 commit 20d38b8

36 files changed

+621
-1262
lines changed

src/Report/Html/Facade.php

+6-19
Original file line numberDiff line numberDiff line change
@@ -120,35 +120,22 @@ private function copyFiles(string $target): void
120120
{
121121
$dir = $this->getDirectory($target . '.css');
122122

123-
\file_put_contents(
124-
$dir . 'bootstrap.min.css',
125-
\str_replace(
126-
'url(../fonts/',
127-
'url(../.fonts/',
128-
\file_get_contents($this->templatePath . 'css/bootstrap.min.css')
129-
)
130-
131-
);
132-
123+
\copy($this->templatePath . 'css/bootstrap.min.css', $dir . 'bootstrap.min.css');
133124
\copy($this->templatePath . 'css/nv.d3.min.css', $dir . 'nv.d3.min.css');
134125
\copy($this->templatePath . 'css/style.css', $dir . 'style.css');
135126
\copy($this->templatePath . 'css/custom.css', $dir . 'custom.css');
127+
\copy($this->templatePath . 'css/octicons.css', $dir . 'octicons.css');
136128

137-
$dir = $this->getDirectory($target . '.fonts');
138-
\copy($this->templatePath . 'fonts/glyphicons-halflings-regular.eot', $dir . 'glyphicons-halflings-regular.eot');
139-
\copy($this->templatePath . 'fonts/glyphicons-halflings-regular.svg', $dir . 'glyphicons-halflings-regular.svg');
140-
\copy($this->templatePath . 'fonts/glyphicons-halflings-regular.ttf', $dir . 'glyphicons-halflings-regular.ttf');
141-
\copy($this->templatePath . 'fonts/glyphicons-halflings-regular.woff', $dir . 'glyphicons-halflings-regular.woff');
142-
\copy($this->templatePath . 'fonts/glyphicons-halflings-regular.woff2', $dir . 'glyphicons-halflings-regular.woff2');
129+
$dir = $this->getDirectory($target . '.icons');
130+
\copy($this->templatePath . 'icons/file-code.svg', $dir . 'file-code.svg');
131+
\copy($this->templatePath . 'icons/file-directory.svg', $dir . 'file-directory.svg');
143132

144133
$dir = $this->getDirectory($target . '.js');
145134
\copy($this->templatePath . 'js/bootstrap.min.js', $dir . 'bootstrap.min.js');
135+
\copy($this->templatePath . 'js/popper.min.js', $dir . 'popper.min.js');
146136
\copy($this->templatePath . 'js/d3.min.js', $dir . 'd3.min.js');
147-
\copy($this->templatePath . 'js/holder.min.js', $dir . 'holder.min.js');
148-
\copy($this->templatePath . 'js/html5shiv.min.js', $dir . 'html5shiv.min.js');
149137
\copy($this->templatePath . 'js/jquery.min.js', $dir . 'jquery.min.js');
150138
\copy($this->templatePath . 'js/nv.d3.min.js', $dir . 'nv.d3.min.js');
151-
\copy($this->templatePath . 'js/respond.min.js', $dir . 'respond.min.js');
152139
\copy($this->templatePath . 'js/file.js', $dir . 'file.js');
153140
}
154141

src/Report/Html/Renderer.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ protected function getBreadcrumbs(AbstractNode $node): string
185185
protected function getActiveBreadcrumb(AbstractNode $node): string
186186
{
187187
$buffer = \sprintf(
188-
' <li class="active">%s</li>' . "\n",
188+
' <li class="breadcrumb-item active">%s</li>' . "\n",
189189
$node->getName()
190190
);
191191

192192
if ($node instanceof DirectoryNode) {
193-
$buffer .= ' <li>(<a href="dashboard.html">Dashboard</a>)</li>' . "\n";
193+
$buffer .= ' <li class="breadcrumb-item">(<a href="dashboard.html">Dashboard</a>)</li>' . "\n";
194194
}
195195

196196
return $buffer;
@@ -199,7 +199,7 @@ protected function getActiveBreadcrumb(AbstractNode $node): string
199199
protected function getInactiveBreadcrumb(AbstractNode $node, string $pathToRoot): string
200200
{
201201
return \sprintf(
202-
' <li><a href="%sindex.html">%s</a></li>' . "\n",
202+
' <li class="breadcrumb-item"><a href="%sindex.html">%s</a></li>' . "\n",
203203
$pathToRoot,
204204
$node->getName()
205205
);

src/Report/Html/Renderer/Dashboard.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ protected function projectRisks(array $classes, string $baseLink): array
273273
protected function getActiveBreadcrumb(AbstractNode $node): string
274274
{
275275
return \sprintf(
276-
' <li><a href="index.html">%s</a></li>' . "\n" .
277-
' <li class="active">(Dashboard)</li>' . "\n",
276+
' <li class="breadcrumb-item"><a href="index.html">%s</a></li>' . "\n" .
277+
' <li class="breadcrumb-item active">(Dashboard)</li>' . "\n",
278278
$node->getName()
279279
);
280280
}

src/Report/Html/Renderer/Directory.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,19 @@ protected function renderItem(Node $node, bool $total = false): string
7474
$node->getName()
7575
);
7676

77-
$data['icon'] = '<span class="glyphicon glyphicon-folder-open"></span> ';
77+
$up = \str_repeat('../', \count($node->getPathAsArray()) - 2);
78+
79+
$data['icon'] = \sprintf('<img src="%s.icons/file-directory.svg" class="octicon" />', $up);
7880
} else {
7981
$data['name'] = \sprintf(
8082
'<a href="%s.html">%s</a>',
8183
$node->getName(),
8284
$node->getName()
8385
);
8486

85-
$data['icon'] = '<span class="glyphicon glyphicon-file"></span> ';
87+
$up = str_repeat('../', \count($node->getPathAsArray()) - 2);
88+
89+
$data['icon'] = \sprintf('<img src="%s.icons/file-code.svg" class="octicon" />', $up);
8690
}
8791
}
8892

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="progress">
2-
<div class="progress-bar progress-bar-{{level}}" role="progressbar" aria-valuenow="{{percent}}" aria-valuemin="0" aria-valuemax="100" style="width: {{percent}}%">
2+
<div class="progress-bar bg-{{level}}" role="progressbar" aria-valuenow="{{percent}}" aria-valuemin="0" aria-valuemax="100" style="width: {{percent}}%">
33
<span class="sr-only">{{percent}}% covered ({{level}})</span>
44
</div>
55
</div>

src/Report/Html/Renderer/Template/css/bootstrap.min.css

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.octicon {
2+
display: inline-block;
3+
vertical-align: text-top;
4+
fill: currentColor;
5+
}

src/Report/Html/Renderer/Template/css/style.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ body {
66
max-width: none;
77
}
88

9-
.glyphicon {
9+
.octicon {
1010
margin-right:.25em;
1111
}
1212

src/Report/Html/Renderer/Template/dashboard.html.dist

+6-10
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,21 @@
44
<meta charset="UTF-8">
55
<title>Dashboard for {{full_path}}</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<link href="{{path_to_root}}.css/bootstrap.min.css" rel="stylesheet" type="text/css">
7+
<link href="{{path_to_root}}.css/bootstrap.min.css?v=4.1.3" rel="stylesheet" type="text/css">
88
<link href="{{path_to_root}}.css/nv.d3.min.css" rel="stylesheet" type="text/css">
99
<link href="{{path_to_root}}.css/style.css" rel="stylesheet" type="text/css">
1010
<link href="{{path_to_root}}.css/custom.css" rel="stylesheet" type="text/css">
11-
<!--[if lt IE 9]>
12-
<script src="{{path_to_root}}.js/html5shiv.min.js"></script>
13-
<script src="{{path_to_root}}.js/respond.min.js"></script>
14-
<![endif]-->
1511
</head>
1612
<body>
1713
<header>
1814
<div class="container">
1915
<div class="row">
2016
<div class="col-md-12">
21-
<ol class="breadcrumb">
17+
<nav aria-label="breadcrumb">
18+
<ol class="breadcrumb">
2219
{{breadcrumbs}}
23-
</ol>
20+
</ol>
21+
</nav>
2422
</div>
2523
</div>
2624
</div>
@@ -139,9 +137,7 @@
139137
</p>
140138
</footer>
141139
</div>
142-
<script src="{{path_to_root}}.js/jquery.min.js" type="text/javascript"></script>
143-
<script src="{{path_to_root}}.js/bootstrap.min.js" type="text/javascript"></script>
144-
<script src="{{path_to_root}}.js/holder.min.js" type="text/javascript"></script>
140+
<script src="{{path_to_root}}.js/jquery.min.js?v=3.3.1" type="text/javascript"></script>
145141
<script src="{{path_to_root}}.js/d3.min.js" type="text/javascript"></script>
146142
<script src="{{path_to_root}}.js/nv.d3.min.js" type="text/javascript"></script>
147143
<script type="text/javascript">

src/Report/Html/Renderer/Template/directory.html.dist

+24-26
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,45 @@
44
<meta charset="UTF-8">
55
<title>Code Coverage for {{full_path}}</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<link href="{{path_to_root}}.css/bootstrap.min.css" rel="stylesheet" type="text/css">
7+
<link href="{{path_to_root}}.css/bootstrap.min.css?v=4.1.3" rel="stylesheet" type="text/css">
8+
<link href="{{path_to_root}}.css/octicons.css?v=8.1.0" rel="stylesheet" type="text/css">
89
<link href="{{path_to_root}}.css/style.css" rel="stylesheet" type="text/css">
910
<link href="{{path_to_root}}.css/custom.css" rel="stylesheet" type="text/css">
10-
<!--[if lt IE 9]>
11-
<script src="{{path_to_root}}.js/html5shiv.min.js"></script>
12-
<script src="{{path_to_root}}.js/respond.min.js"></script>
13-
<![endif]-->
1411
</head>
1512
<body>
1613
<header>
1714
<div class="container">
1815
<div class="row">
1916
<div class="col-md-12">
20-
<ol class="breadcrumb">
17+
<nav aria-label="breadcrumb">
18+
<ol class="breadcrumb">
2119
{{breadcrumbs}}
22-
</ol>
20+
</ol>
21+
</nav>
2322
</div>
2423
</div>
2524
</div>
2625
</header>
2726
<div class="container">
28-
<table class="table table-bordered">
29-
<thead>
30-
<tr>
31-
<td>&nbsp;</td>
32-
<td colspan="9"><div align="center"><strong>Code Coverage</strong></div></td>
33-
</tr>
34-
<tr>
35-
<td>&nbsp;</td>
36-
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
37-
<td colspan="3"><div align="center"><strong>Functions and Methods</strong></div></td>
38-
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
39-
</tr>
40-
</thead>
41-
<tbody>
27+
<div class="table-responsive-md">
28+
<table class="table table-bordered">
29+
<thead>
30+
<tr>
31+
<td>&nbsp;</td>
32+
<td colspan="9"><div align="center"><strong>Code Coverage</strong></div></td>
33+
</tr>
34+
<tr>
35+
<td>&nbsp;</td>
36+
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
37+
<td colspan="3"><div align="center"><strong>Functions and Methods</strong></div></td>
38+
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
39+
</tr>
40+
</thead>
41+
<tbody>
4242
{{items}}
43-
</tbody>
44-
</table>
43+
</tbody>
44+
</table>
45+
</div>
4546
<footer>
4647
<hr/>
4748
<h4>Legend</h4>
@@ -55,8 +56,5 @@
5556
</p>
5657
</footer>
5758
</div>
58-
<script src="{{path_to_root}}.js/jquery.min.js" type="text/javascript"></script>
59-
<script src="{{path_to_root}}.js/bootstrap.min.js" type="text/javascript"></script>
60-
<script src="{{path_to_root}}.js/holder.min.js" type="text/javascript"></script>
6159
</body>
6260
</html>
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<tr>
2-
<td class="{{lines_level}}">{{icon}}{{name}}</td>
3-
<td class="{{lines_level}} big">{{lines_bar}}</td>
4-
<td class="{{lines_level}} small"><div align="right">{{lines_executed_percent}}</div></td>
5-
<td class="{{lines_level}} small"><div align="right">{{lines_number}}</div></td>
6-
<td class="{{methods_level}} big">{{methods_bar}}</td>
7-
<td class="{{methods_level}} small"><div align="right">{{methods_tested_percent}}</div></td>
8-
<td class="{{methods_level}} small"><div align="right">{{methods_number}}</div></td>
9-
<td class="{{classes_level}} big">{{classes_bar}}</td>
10-
<td class="{{classes_level}} small"><div align="right">{{classes_tested_percent}}</div></td>
11-
<td class="{{classes_level}} small"><div align="right">{{classes_number}}</div></td>
12-
</tr>
1+
<tr>
2+
<td class="{{lines_level}}">{{icon}}{{name}}</td>
3+
<td class="{{lines_level}} big">{{lines_bar}}</td>
4+
<td class="{{lines_level}} small"><div align="right">{{lines_executed_percent}}</div></td>
5+
<td class="{{lines_level}} small"><div align="right">{{lines_number}}</div></td>
6+
<td class="{{methods_level}} big">{{methods_bar}}</td>
7+
<td class="{{methods_level}} small"><div align="right">{{methods_tested_percent}}</div></td>
8+
<td class="{{methods_level}} small"><div align="right">{{methods_number}}</div></td>
9+
<td class="{{classes_level}} big">{{classes_bar}}</td>
10+
<td class="{{classes_level}} small"><div align="right">{{classes_tested_percent}}</div></td>
11+
<td class="{{classes_level}} small"><div align="right">{{classes_number}}</div></td>
12+
</tr>
1313

src/Report/Html/Renderer/Template/file.html.dist

+30-27
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,45 @@
44
<meta charset="UTF-8">
55
<title>Code Coverage for {{full_path}}</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<link href="{{path_to_root}}.css/bootstrap.min.css" rel="stylesheet" type="text/css">
7+
<link href="{{path_to_root}}.css/bootstrap.min.css?v=4.1.3" rel="stylesheet" type="text/css">
8+
<link href="{{path_to_root}}.css/octicons.css?v=8.1.0" rel="stylesheet" type="text/css">
89
<link href="{{path_to_root}}.css/style.css" rel="stylesheet" type="text/css">
910
<link href="{{path_to_root}}.css/custom.css" rel="stylesheet" type="text/css">
10-
<!--[if lt IE 9]>
11-
<script src="{{path_to_root}}.js/html5shiv.min.js"></script>
12-
<script src="{{path_to_root}}.js/respond.min.js"></script>
13-
<![endif]-->
1411
</head>
1512
<body>
1613
<header>
1714
<div class="container">
1815
<div class="row">
1916
<div class="col-md-12">
20-
<ol class="breadcrumb">
17+
<nav aria-label="breadcrumb">
18+
<ol class="breadcrumb">
2119
{{breadcrumbs}}
22-
</ol>
20+
</ol>
21+
</nav>
2322
</div>
2423
</div>
2524
</div>
2625
</header>
2726
<div class="container">
28-
<table class="table table-bordered">
29-
<thead>
30-
<tr>
31-
<td>&nbsp;</td>
32-
<td colspan="10"><div align="center"><strong>Code Coverage</strong></div></td>
33-
</tr>
34-
<tr>
35-
<td>&nbsp;</td>
36-
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
37-
<td colspan="4"><div align="center"><strong>Functions and Methods</strong></div></td>
38-
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
39-
</tr>
40-
</thead>
41-
<tbody>
27+
<div class="table-responsive-md">
28+
<table class="table table-bordered">
29+
<thead>
30+
<tr>
31+
<td>&nbsp;</td>
32+
<td colspan="10"><div align="center"><strong>Code Coverage</strong></div></td>
33+
</tr>
34+
<tr>
35+
<td>&nbsp;</td>
36+
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
37+
<td colspan="4"><div align="center"><strong>Functions and Methods</strong></div></td>
38+
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
39+
</tr>
40+
</thead>
41+
<tbody>
4242
{{items}}
43-
</tbody>
44-
</table>
43+
</tbody>
44+
</table>
45+
</div>
4546
<table id="code" class="table table-borderless table-condensed">
4647
<tbody>
4748
{{lines}}
@@ -58,12 +59,14 @@
5859
<p>
5960
<small>Generated by <a href="https://github.com/sebastianbergmann/php-code-coverage" target="_top">php-code-coverage {{version}}</a> using {{runtime}}{{generator}} at {{date}}.</small>
6061
</p>
61-
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
62+
<a title="Back to the top" id="toplink" href="#">
63+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="16" viewBox="0 0 12 16"><path fill-rule="evenodd" d="M12 11L6 5l-6 6h12z"/></svg>
64+
</a>
6265
</footer>
6366
</div>
64-
<script src="{{path_to_root}}.js/jquery.min.js" type="text/javascript"></script>
65-
<script src="{{path_to_root}}.js/bootstrap.min.js" type="text/javascript"></script>
66-
<script src="{{path_to_root}}.js/holder.min.js" type="text/javascript"></script>
67+
<script src="{{path_to_root}}.js/jquery.min.js?v=3.3.1" type="text/javascript"></script>
68+
<script src="{{path_to_root}}.js/popper.min.js?v=1.14.3" type="text/javascript"></script>
69+
<script src="{{path_to_root}}.js/bootstrap.min.js?v=4.1.3" type="text/javascript"></script>
6770
<script src="{{path_to_root}}.js/file.js" type="text/javascript"></script>
6871
</body>
6972
</html>
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<tr>
2-
<td class="{{classes_level}}">{{name}}</td>
3-
<td class="{{classes_level}} big">{{classes_bar}}</td>
4-
<td class="{{classes_level}} small"><div align="right">{{classes_tested_percent}}</div></td>
5-
<td class="{{classes_level}} small"><div align="right">{{classes_number}}</div></td>
6-
<td class="{{methods_level}} big">{{methods_bar}}</td>
7-
<td class="{{methods_level}} small"><div align="right">{{methods_tested_percent}}</div></td>
8-
<td class="{{methods_level}} small"><div align="right">{{methods_number}}</div></td>
9-
<td class="{{methods_level}} small">{{crap}}</td>
10-
<td class="{{lines_level}} big">{{lines_bar}}</td>
11-
<td class="{{lines_level}} small"><div align="right">{{lines_executed_percent}}</div></td>
12-
<td class="{{lines_level}} small"><div align="right">{{lines_number}}</div></td>
13-
</tr>
1+
<tr>
2+
<td class="{{classes_level}}">{{name}}</td>
3+
<td class="{{classes_level}} big">{{classes_bar}}</td>
4+
<td class="{{classes_level}} small"><div align="right">{{classes_tested_percent}}</div></td>
5+
<td class="{{classes_level}} small"><div align="right">{{classes_number}}</div></td>
6+
<td class="{{methods_level}} big">{{methods_bar}}</td>
7+
<td class="{{methods_level}} small"><div align="right">{{methods_tested_percent}}</div></td>
8+
<td class="{{methods_level}} small"><div align="right">{{methods_number}}</div></td>
9+
<td class="{{methods_level}} small">{{crap}}</td>
10+
<td class="{{lines_level}} big">{{lines_bar}}</td>
11+
<td class="{{lines_level}} small"><div align="right">{{lines_executed_percent}}</div></td>
12+
<td class="{{lines_level}} small"><div align="right">{{lines_number}}</div></td>
13+
</tr>
1414

Binary file not shown.

0 commit comments

Comments
 (0)