Skip to content

Commit

Permalink
Closes #451
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Mar 5, 2017
1 parent de2c121 commit 57aa564
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 104 deletions.
1 change: 1 addition & 0 deletions ChangeLog-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes of the PHP_CodeCoverage 5.0 release series are documented in

### Fixed

* Fixed [#451](https://github.com/sebastianbergmann/php-code-coverage/pull/451): Conflict between HTML report assets and directories named `css`, `fonts`, or `js`
* Fixed [#485](https://github.com/sebastianbergmann/php-code-coverage/issues/485): Large popover contents cannot be viewed

## [5.0.2] - 2017-03-01
Expand Down
18 changes: 14 additions & 4 deletions src/Report/Html/Facade.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,29 @@ public function process(CodeCoverage $coverage, $target)
*/
private function copyFiles($target)
{
$dir = $this->getDirectory($target . 'css');
copy($this->templatePath . 'css/bootstrap.min.css', $dir . 'bootstrap.min.css');
$dir = $this->getDirectory($target . '.css');

file_put_contents(
$dir . 'bootstrap.min.css',
str_replace(
'url(../fonts/',
'url(../.fonts/',
file_get_contents($this->templatePath . 'css/bootstrap.min.css')
)

);

copy($this->templatePath . 'css/nv.d3.min.css', $dir . 'nv.d3.min.css');
copy($this->templatePath . 'css/style.css', $dir . 'style.css');

$dir = $this->getDirectory($target . 'fonts');
$dir = $this->getDirectory($target . '.fonts');
copy($this->templatePath . 'fonts/glyphicons-halflings-regular.eot', $dir . 'glyphicons-halflings-regular.eot');
copy($this->templatePath . 'fonts/glyphicons-halflings-regular.svg', $dir . 'glyphicons-halflings-regular.svg');
copy($this->templatePath . 'fonts/glyphicons-halflings-regular.ttf', $dir . 'glyphicons-halflings-regular.ttf');
copy($this->templatePath . 'fonts/glyphicons-halflings-regular.woff', $dir . 'glyphicons-halflings-regular.woff');
copy($this->templatePath . 'fonts/glyphicons-halflings-regular.woff2', $dir . 'glyphicons-halflings-regular.woff2');

$dir = $this->getDirectory($target . 'js');
$dir = $this->getDirectory($target . '.js');
copy($this->templatePath . 'js/bootstrap.min.js', $dir . 'bootstrap.min.js');
copy($this->templatePath . 'js/d3.min.js', $dir . 'd3.min.js');
copy($this->templatePath . 'js/holder.min.js', $dir . 'holder.min.js');
Expand Down
20 changes: 10 additions & 10 deletions src/Report/Html/Renderer/Template/dashboard.html.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<meta charset="UTF-8">
<title>Dashboard for {{full_path}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{path_to_root}}css/bootstrap.min.css" rel="stylesheet">
<link href="{{path_to_root}}css/nv.d3.min.css" rel="stylesheet">
<link href="{{path_to_root}}css/style.css" rel="stylesheet">
<link href="{{path_to_root}}.css/bootstrap.min.css" rel="stylesheet">
<link href="{{path_to_root}}.css/nv.d3.min.css" rel="stylesheet">
<link href="{{path_to_root}}.css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="{{path_to_root}}js/html5shiv.min.js"></script>
<script src="{{path_to_root}}js/respond.min.js"></script>
<script src="{{path_to_root}}.js/html5shiv.min.js"></script>
<script src="{{path_to_root}}.js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -138,11 +138,11 @@
</p>
</footer>
</div>
<script src="{{path_to_root}}js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/holder.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/d3.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/nv.d3.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/holder.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/d3.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {
Expand Down
14 changes: 7 additions & 7 deletions src/Report/Html/Renderer/Template/directory.html.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="UTF-8">
<title>Code Coverage for {{full_path}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{path_to_root}}css/bootstrap.min.css" rel="stylesheet">
<link href="{{path_to_root}}css/style.css" rel="stylesheet">
<link href="{{path_to_root}}.css/bootstrap.min.css" rel="stylesheet">
<link href="{{path_to_root}}.css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="{{path_to_root}}js/html5shiv.min.js"></script>
<script src="{{path_to_root}}js/respond.min.js"></script>
<script src="{{path_to_root}}.js/html5shiv.min.js"></script>
<script src="{{path_to_root}}.js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -54,8 +54,8 @@
</p>
</footer>
</div>
<script src="{{path_to_root}}js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/holder.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/holder.min.js" type="text/javascript"></script>
</body>
</html>
16 changes: 8 additions & 8 deletions src/Report/Html/Renderer/Template/file.html.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="UTF-8">
<title>Code Coverage for {{full_path}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{path_to_root}}css/bootstrap.min.css" rel="stylesheet">
<link href="{{path_to_root}}css/style.css" rel="stylesheet">
<link href="{{path_to_root}}.css/bootstrap.min.css" rel="stylesheet">
<link href="{{path_to_root}}.css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="{{path_to_root}}js/html5shiv.min.js"></script>
<script src="{{path_to_root}}js/respond.min.js"></script>
<script src="{{path_to_root}}.js/html5shiv.min.js"></script>
<script src="{{path_to_root}}.js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -60,9 +60,9 @@
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
</footer>
</div>
<script src="{{path_to_root}}js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/holder.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}js/file.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/holder.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/file.js" type="text/javascript"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="UTF-8">
<title>Code Coverage for %s/BankAccount.php</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href=".css/bootstrap.min.css" rel="stylesheet">
<link href=".css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<script src=".js/html5shiv.min.js"></script>
<script src=".js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -237,9 +237,9 @@ <h4>Legend</h4>
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src="js/file.js" type="text/javascript"></script>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/holder.min.js" type="text/javascript"></script>
<script src=".js/file.js" type="text/javascript"></script>
</body>
</html>
20 changes: 10 additions & 10 deletions tests/_files/Report/HTML/CoverageForBankAccount/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<meta charset="UTF-8">
<title>Dashboard for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/nv.d3.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href=".css/bootstrap.min.css" rel="stylesheet">
<link href=".css/nv.d3.min.css" rel="stylesheet">
<link href=".css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<script src=".js/html5shiv.min.js"></script>
<script src=".js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -144,11 +144,11 @@ <h3>Project Risks</h3>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src="js/d3.min.js" type="text/javascript"></script>
<script src="js/nv.d3.min.js" type="text/javascript"></script>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/holder.min.js" type="text/javascript"></script>
<script src=".js/d3.min.js" type="text/javascript"></script>
<script src=".js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {
Expand Down
14 changes: 7 additions & 7 deletions tests/_files/Report/HTML/CoverageForBankAccount/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="UTF-8">
<title>Code Coverage for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href=".css/bootstrap.min.css" rel="stylesheet">
<link href=".css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<script src=".js/html5shiv.min.js"></script>
<script src=".js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -112,8 +112,8 @@ <h4>Legend</h4>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/holder.min.js" type="text/javascript"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<meta charset="UTF-8">
<title>Dashboard for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/nv.d3.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href=".css/bootstrap.min.css" rel="stylesheet">
<link href=".css/nv.d3.min.css" rel="stylesheet">
<link href=".css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<script src=".js/html5shiv.min.js"></script>
<script src=".js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -142,11 +142,11 @@ <h3>Project Risks</h3>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src="js/d3.min.js" type="text/javascript"></script>
<script src="js/nv.d3.min.js" type="text/javascript"></script>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/holder.min.js" type="text/javascript"></script>
<script src=".js/d3.min.js" type="text/javascript"></script>
<script src=".js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="UTF-8">
<title>Code Coverage for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href=".css/bootstrap.min.css" rel="stylesheet">
<link href=".css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<script src=".js/html5shiv.min.js"></script>
<script src=".js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -112,8 +112,8 @@ <h4>Legend</h4>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/holder.min.js" type="text/javascript"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="UTF-8">
<title>Code Coverage for %s/source_with_class_and_anonymous_function.php</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href=".css/bootstrap.min.css" rel="stylesheet">
<link href=".css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<script src=".js/html5shiv.min.js"></script>
<script src=".js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -181,9 +181,9 @@ <h4>Legend</h4>
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src="js/file.js" type="text/javascript"></script>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/holder.min.js" type="text/javascript"></script>
<script src=".js/file.js" type="text/javascript"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<meta charset="UTF-8">
<title>Dashboard for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/nv.d3.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href=".css/bootstrap.min.css" rel="stylesheet">
<link href=".css/nv.d3.min.css" rel="stylesheet">
<link href=".css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<script src=".js/html5shiv.min.js"></script>
<script src=".js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -140,11 +140,11 @@ <h3>Project Risks</h3>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src="js/d3.min.js" type="text/javascript"></script>
<script src="js/nv.d3.min.js" type="text/javascript"></script>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/holder.min.js" type="text/javascript"></script>
<script src=".js/d3.min.js" type="text/javascript"></script>
<script src=".js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="UTF-8">
<title>Code Coverage for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href=".css/bootstrap.min.css" rel="stylesheet">
<link href=".css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<script src=".js/html5shiv.min.js"></script>
<script src=".js/respond.min.js"></script>
<![endif]-->
</head>
<body>
Expand Down Expand Up @@ -92,8 +92,8 @@ <h4>Legend</h4>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/holder.min.js" type="text/javascript"></script>
</body>
</html>
Loading

0 comments on commit 57aa564

Please sign in to comment.