Skip to content

Commit a8b6127

Browse files
authored
Merge pull request #33 from unixslayer/show_only_summary
allow to show only summary in text output
2 parents 7f37d84 + dbda780 commit a8b6127

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ extensions:
112112
# Whilelist directories for which code generation should be done
113113
# Default: [src, lib]
114114
#
115+
# Should text output show only summary?
116+
# Default: false
117+
#show_only_summary: true
118+
#
115119
whitelist:
116120
- src
117121
- lib

spec/CodeCoverageExtensionSpec.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,31 @@ public function it_is_initializable(): void
1919
$this->shouldHaveType(CodeCoverageExtension::class);
2020
}
2121

22+
public function it_should_allow_to_set_show_only_summary_option(): void
23+
{
24+
$container = new IndexedServiceContainer();
25+
$container->setParam('code_coverage', ['show_only_summary' => true]);
26+
$this->load($container);
27+
28+
$options = $container->get('code_coverage.options');
29+
30+
if (true !== $options['show_only_summary']) {
31+
throw new Exception('show_only_summary was not set');
32+
}
33+
}
34+
35+
public function it_should_not_use_show_only_summary_option_by_default(): void
36+
{
37+
$container = new IndexedServiceContainer();
38+
$this->load($container, []);
39+
40+
$options = $container->get('code_coverage.options');
41+
42+
if (false !== $options['show_only_summary']) {
43+
throw new Exception('show_only_summary should be `false` by default');
44+
}
45+
}
46+
2247
public function it_should_transform_format_into_array(): void
2348
{
2449
$container = new IndexedServiceContainer();

src/CodeCoverageExtension.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ public function load(ServiceContainer $container, array $params = []): void
9191
$options['high_lower_bound'] = 70;
9292
}
9393

94+
if (!isset($options['show_only_summary'])) {
95+
$options['show_only_summary'] = false;
96+
}
97+
9498
return $options;
9599
});
96100

@@ -114,8 +118,7 @@ public function load(ServiceContainer $container, array $params = []): void
114118
$options['lower_upper_bound'],
115119
$options['high_lower_bound'],
116120
$options['show_uncovered_files'],
117-
/* $showOnlySummary */
118-
false
121+
$options['show_only_summary']
119122
);
120123

121124
break;

0 commit comments

Comments
 (0)