Skip to content

Commit b420c04

Browse files
Added unit test and code coverage over 90 percent
1 parent 1751d47 commit b420c04

File tree

104 files changed

+36944
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+36944
-112
lines changed

.env

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
DOCKER_HOST_APP_PORT=8000
2+
DOCKER_HOST_NEO4J_HTTP_PORT=7474
3+
DOCKER_HOST_NEO4J_BOLT_PORT=7687
4+
5+
NEO4J_HOST=neo4j+s://bb79fe35.databases.neo4j.io
6+
NEO4J_DATABASE=neo4j
7+
NEO4J_PORT=7687
8+
NEO4J_USER=neo4j
9+
NEO4J_PASSWORD=your_secure_password

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ composer.lock
66
.php-cs-fixer.cache
77

88
composer.origin.json
9+
10+
coverage
11+
phpunitCoverage.xml

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"psalm": "APP_ENV=dev php bin/console.php cache:warmup && vendor/bin/psalm --show-info=true",
5858
"fix-cs": "vendor/bin/php-cs-fixer fix",
5959
"check-cs": "vendor/bin/php-cs-fixer fix --dry-run",
60-
"ci-symfony-install-version": "./.github/scripts/setup-symfony-env.bash"
60+
"ci-symfony-install-version": "./.github/scripts/setup-symfony-env.bash",
61+
"phpunit-with-coverage" : "XDEBUG_MODE=coverage php -d memory_limit=-1 vendor/bin/phpunit --configuration=phpunitCoverage.xml --testsuite=All --coverage-filter=src tests"
6162
}
6263
}

coverage/clover.xml

Lines changed: 946 additions & 0 deletions
Large diffs are not rendered by default.

coverage/cobertura.xml

Lines changed: 2063 additions & 0 deletions
Large diffs are not rendered by default.

coverage/coverage.php

372 KB
Binary file not shown.

coverage/coverage.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
Code Coverage Report Summary:
4+
Classes: 63.64% (14/22)
5+
Methods: 75.00% (81/108)
6+
Lines: 92.30% (647/701)
7+

coverage/crap4j.xml

Lines changed: 1203 additions & 0 deletions
Large diffs are not rendered by default.

coverage/html/Builders/ClientBuilder.php.html

Lines changed: 406 additions & 0 deletions
Large diffs are not rendered by default.

coverage/html/Builders/dashboard.html

Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Dashboard for /opt/project/src/Builders</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link href="../_css/bootstrap.min.css?v=9.2.32" rel="stylesheet" type="text/css">
8+
<link href="../_css/nv.d3.min.css?v=9.2.32" rel="stylesheet" type="text/css">
9+
<link href="../_css/style.css?v=9.2.32" rel="stylesheet" type="text/css">
10+
<link href="../_css/custom.css" rel="stylesheet" type="text/css">
11+
</head>
12+
<body>
13+
<header>
14+
<div class="container-fluid">
15+
<div class="row">
16+
<div class="col-md-12">
17+
<nav aria-label="breadcrumb">
18+
<ol class="breadcrumb">
19+
<li class="breadcrumb-item"><a href="../index.html">/opt/project/src</a></li>
20+
<li class="breadcrumb-item"><a href="index.html">Builders</a></li>
21+
<li class="breadcrumb-item active">(Dashboard)</li>
22+
23+
</ol>
24+
</nav>
25+
</div>
26+
</div>
27+
</div>
28+
</header>
29+
<div class="container-fluid">
30+
<div class="row">
31+
<div class="col-md-12">
32+
<h2>Classes</h2>
33+
</div>
34+
</div>
35+
<div class="row">
36+
<div class="col-md-6">
37+
<h3>Coverage Distribution</h3>
38+
<div id="classCoverageDistribution" style="height: 300px;">
39+
<svg></svg>
40+
</div>
41+
</div>
42+
<div class="col-md-6">
43+
<h3>Complexity</h3>
44+
<div id="classComplexity" style="height: 300px;">
45+
<svg></svg>
46+
</div>
47+
</div>
48+
</div>
49+
<div class="row">
50+
<div class="col-md-6">
51+
<h3>Insufficient Coverage</h3>
52+
<div class="scrollbox">
53+
<table class="table">
54+
<thead>
55+
<tr>
56+
<th>Class</th>
57+
<th class="text-right">Coverage</th>
58+
</tr>
59+
</thead>
60+
<tbody>
61+
62+
</tbody>
63+
</table>
64+
</div>
65+
</div>
66+
<div class="col-md-6">
67+
<h3>Project Risks</h3>
68+
<div class="scrollbox">
69+
<table class="table">
70+
<thead>
71+
<tr>
72+
<th>Class</th>
73+
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
74+
</tr>
75+
</thead>
76+
<tbody>
77+
78+
</tbody>
79+
</table>
80+
</div>
81+
</div>
82+
</div>
83+
<div class="row">
84+
<div class="col-md-12">
85+
<h2>Methods</h2>
86+
</div>
87+
</div>
88+
<div class="row">
89+
<div class="col-md-6">
90+
<h3>Coverage Distribution</h3>
91+
<div id="methodCoverageDistribution" style="height: 300px;">
92+
<svg></svg>
93+
</div>
94+
</div>
95+
<div class="col-md-6">
96+
<h3>Complexity</h3>
97+
<div id="methodComplexity" style="height: 300px;">
98+
<svg></svg>
99+
</div>
100+
</div>
101+
</div>
102+
<div class="row">
103+
<div class="col-md-6">
104+
<h3>Insufficient Coverage</h3>
105+
<div class="scrollbox">
106+
<table class="table">
107+
<thead>
108+
<tr>
109+
<th>Method</th>
110+
<th class="text-right">Coverage</th>
111+
</tr>
112+
</thead>
113+
<tbody>
114+
115+
</tbody>
116+
</table>
117+
</div>
118+
</div>
119+
<div class="col-md-6">
120+
<h3>Project Risks</h3>
121+
<div class="scrollbox">
122+
<table class="table">
123+
<thead>
124+
<tr>
125+
<th>Method</th>
126+
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
127+
</tr>
128+
</thead>
129+
<tbody>
130+
131+
</tbody>
132+
</table>
133+
</div>
134+
</div>
135+
</div>
136+
<footer>
137+
<hr/>
138+
<p>
139+
<small>Generated by <a href="https://github.com/sebastianbergmann/php-code-coverage" target="_top">php-code-coverage 9.2.32</a> using <a href="https://secure.php.net/" target="_top">PHP 8.1.31</a> and <a href="https://phpunit.de/">PHPUnit 9.6.22</a> at Wed Mar 12 10:22:45 UTC 2025.</small>
140+
</p>
141+
</footer>
142+
</div>
143+
<script src="../_js/jquery.min.js?v=9.2.32" type="text/javascript"></script>
144+
<script src="../_js/d3.min.js?v=9.2.32" type="text/javascript"></script>
145+
<script src="../_js/nv.d3.min.js?v=9.2.32" type="text/javascript"></script>
146+
<script type="text/javascript">
147+
$(document).ready(function() {
148+
nv.addGraph(function() {
149+
var chart = nv.models.multiBarChart();
150+
chart.tooltips(false)
151+
.showControls(false)
152+
.showLegend(false)
153+
.reduceXTicks(false)
154+
.staggerLabels(true)
155+
.yAxis.tickFormat(d3.format('d'));
156+
157+
d3.select('#classCoverageDistribution svg')
158+
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,1,0], "Class Coverage"))
159+
.transition().duration(500).call(chart);
160+
161+
nv.utils.windowResize(chart.update);
162+
163+
return chart;
164+
});
165+
166+
nv.addGraph(function() {
167+
var chart = nv.models.multiBarChart();
168+
chart.tooltips(false)
169+
.showControls(false)
170+
.showLegend(false)
171+
.reduceXTicks(false)
172+
.staggerLabels(true)
173+
.yAxis.tickFormat(d3.format('d'));
174+
175+
d3.select('#methodCoverageDistribution svg')
176+
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,1,0,7], "Method Coverage"))
177+
.transition().duration(500).call(chart);
178+
179+
nv.utils.windowResize(chart.update);
180+
181+
return chart;
182+
});
183+
184+
function getCoverageDistributionData(data, label) {
185+
var labels = [
186+
'0%',
187+
'0-10%',
188+
'10-20%',
189+
'20-30%',
190+
'30-40%',
191+
'40-50%',
192+
'50-60%',
193+
'60-70%',
194+
'70-80%',
195+
'80-90%',
196+
'90-100%',
197+
'100%'
198+
];
199+
var values = [];
200+
$.each(labels, function(key) {
201+
values.push({x: labels[key], y: data[key]});
202+
});
203+
204+
return [
205+
{
206+
key: label,
207+
values: values,
208+
color: "#4572A7"
209+
}
210+
];
211+
}
212+
nv.addGraph(function() {
213+
var chart = nv.models.scatterChart()
214+
.showDistX(true)
215+
.showDistY(true)
216+
.showLegend(false)
217+
.forceX([0, 100]);
218+
chart.tooltipContent(function(graph) {
219+
return '<p>' + graph.point.class + '</p>';
220+
});
221+
222+
chart.xAxis.axisLabel('Code Coverage (in percent)');
223+
chart.yAxis.axisLabel('Cyclomatic Complexity');
224+
225+
d3.select('#classComplexity svg')
226+
.datum(getComplexityData([[96.42857142857143,9,"<a href=\"ClientBuilder.php.html#17\">Neo4j\\Neo4jBundle\\Builders\\ClientBuilder<\/a>"]], 'Class Complexity'))
227+
.transition()
228+
.duration(500)
229+
.call(chart);
230+
231+
nv.utils.windowResize(chart.update);
232+
233+
return chart;
234+
});
235+
236+
nv.addGraph(function() {
237+
var chart = nv.models.scatterChart()
238+
.showDistX(true)
239+
.showDistY(true)
240+
.showLegend(false)
241+
.forceX([0, 100]);
242+
chart.tooltipContent(function(graph) {
243+
return '<p>' + graph.point.class + '</p>';
244+
});
245+
246+
chart.xAxis.axisLabel('Code Coverage (in percent)');
247+
chart.yAxis.axisLabel('Method Complexity');
248+
249+
d3.select('#methodComplexity svg')
250+
.datum(getComplexityData([[100,1,"<a href=\"ClientBuilder.php.html#26\">Neo4j\\Neo4jBundle\\Builders\\ClientBuilder::__construct<\/a>"],[100,1,"<a href=\"ClientBuilder.php.html#34\">Neo4j\\Neo4jBundle\\Builders\\ClientBuilder::withDriver<\/a>"],[83.33333333333334,2,"<a href=\"ClientBuilder.php.html#43\">Neo4j\\Neo4jBundle\\Builders\\ClientBuilder::withParsedUrl<\/a>"],[100,1,"<a href=\"ClientBuilder.php.html#57\">Neo4j\\Neo4jBundle\\Builders\\ClientBuilder::withDefaultDriver<\/a>"],[100,1,"<a href=\"ClientBuilder.php.html#65\">Neo4j\\Neo4jBundle\\Builders\\ClientBuilder::build<\/a>"],[100,1,"<a href=\"ClientBuilder.php.html#75\">Neo4j\\Neo4jBundle\\Builders\\ClientBuilder::withDefaultDriverConfiguration<\/a>"],[100,1,"<a href=\"ClientBuilder.php.html#84\">Neo4j\\Neo4jBundle\\Builders\\ClientBuilder::withDefaultSessionConfiguration<\/a>"],[100,1,"<a href=\"ClientBuilder.php.html#92\">Neo4j\\Neo4jBundle\\Builders\\ClientBuilder::withDefaultTransactionConfiguration<\/a>"]], 'Method Complexity'))
251+
.transition()
252+
.duration(500)
253+
.call(chart);
254+
255+
nv.utils.windowResize(chart.update);
256+
257+
return chart;
258+
});
259+
260+
function getComplexityData(data, label) {
261+
var values = [];
262+
$.each(data, function(key) {
263+
var value = Math.round(data[key][0]*100) / 100;
264+
values.push({
265+
x: value,
266+
y: data[key][1],
267+
class: data[key][2],
268+
size: 0.05,
269+
shape: 'diamond'
270+
});
271+
});
272+
273+
return [
274+
{
275+
key: label,
276+
values: values,
277+
color: "#4572A7"
278+
}
279+
];
280+
}
281+
});
282+
</script>
283+
</body>
284+
</html>

0 commit comments

Comments
 (0)