Skip to content

Commit 96317ac

Browse files
committedOct 13, 2014
Added visualisation of PHPUnit Enricher input
1 parent fc6dd38 commit 96317ac

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed
 

‎templates/html/source.xsl

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
22
xmlns:token="http://xml.phpdox.net/token"
33
xmlns:src="http://xml.phpdox.net/src"
4+
xmlns:pu="http://schema.phpunit.de/coverage/1.0"
45
xmlns="http://www.w3.org/1999/xhtml"
56
exclude-result-prefixes="token src">
67

@@ -48,7 +49,7 @@
4849
<li><a href="{$base}index.{$extension}">Overview</a></li>
4950
<li class="separator"><a href="{$base}source/index.{$extension}">Source</a></li>
5051

51-
52+
5253
</ul>
5354
</div>
5455
</xsl:template>
@@ -60,7 +61,24 @@
6061
<tr>
6162
<td class="no">
6263
<xsl:for-each select="//token:line">
63-
<a class="anker" href="#line{@no}"><xsl:value-of select="@no" /></a>
64+
<xsl:variable name="no" select="@no" />
65+
<xsl:variable name="ctx" select="//src:enrichment[@type='phpunit']//pu:line[@nr = $no]" />
66+
<xsl:variable name="coverage">
67+
<xsl:if test="count($ctx/pu:covered) &gt; 0"> covered</xsl:if>
68+
</xsl:variable>
69+
<a class="anker{$coverage}" href="#line{@no}"><xsl:value-of select="@no" /></a>
70+
<xsl:if test="count($ctx/pu:covered) &gt; 0">
71+
<div class="coverage_details">
72+
<span>
73+
Covered by <xsl:value-of select="count($ctx/pu:covered)" /> test(s):
74+
</span>
75+
<ul>
76+
<xsl:for-each select="$ctx/pu:covered">
77+
<li><xsl:value-of select="@by" /></li>
78+
</xsl:for-each>
79+
</ul>
80+
</div>
81+
</xsl:if>
6482
</xsl:for-each>
6583
</td>
6684
<td class="line">

‎templates/html/static/css/source.css

+40
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,43 @@ table.source td.line div:target pre {
142142
.T_CONSTANT_ENCAPSED_STRING, .T_ENCAPSED_AND_WHITESPACE {
143143
color: #DD0000;
144144
}
145+
146+
.covered {
147+
background-color: rgba(5, 238, 25, 0.13);
148+
}
149+
150+
a.covered:hover + div {
151+
left:90px;
152+
}
153+
154+
.coverage_details {
155+
position: absolute;
156+
left:-10000px;
157+
margin:-1.4em 0 0 0;
158+
background-color: #eee;
159+
box-shadow: 5px 5px 10px #888;
160+
z-index: 1;
161+
padding:1em;
162+
}
163+
164+
.coverage_details span {
165+
font-weight: bold;
166+
}
167+
168+
.coverage_details ul {
169+
margin:0;
170+
padding:1em;
171+
}
172+
173+
.coverage_details:before {
174+
position: absolute;
175+
content:"";
176+
width: 12px;
177+
height: 12px;
178+
top: 3px;
179+
left: -6px;
180+
border:0;
181+
background-color: #eee;
182+
transform: rotate(45deg);
183+
z-index: -1;
184+
}

0 commit comments

Comments
 (0)
Please sign in to comment.