Skip to content

Commit 5299745

Browse files
committed
Reintroduce code coverage report
1 parent 5b97c82 commit 5299745

37 files changed

+60
-62
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
composer.phar
22
/vendor/
3+
/var/
34
composer.lock
45
.DS_Store
56

@@ -13,5 +14,4 @@ composer.lock
1314
# PHP CS Fixer cache file
1415
.php-cs-fixer.cache
1516

16-
.phpunit.result.cache
17-
coverage/
17+
.phpunit.result.cache

.php-cs-fixer.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
->in(__DIR__ . '/tests')
4949
;
5050

51+
// see rules: https://mlocati.github.io/php-cs-fixer-configurator/#version:3.8
52+
5153
$config = new Config();
5254
$config
5355
->setRiskyAllowed(true)
@@ -62,8 +64,13 @@
6264
'single_quote' => true,
6365
'mb_str_functions' => true,
6466
'array_syntax' => ['syntax' => 'short'],
65-
'binary_operator_spaces' => ['operators' => ['=>' => 'align_single_space_minimal', '=' => 'align_single_space_minimal'],
67+
'binary_operator_spaces' => [
68+
'operators' => [
69+
'=>' => 'align_single_space_minimal',
70+
'=' => 'align_single_space_minimal',
71+
],
6672
],
73+
'php_unit_test_class_requires_covers' => false,
6774
])
6875
->setFinder($finder)
6976
;

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ For every implemented feature add unit tests and check all is green by running t
5757

5858
```bash
5959
# using an alias
60-
$ composer test
60+
$ composer code-test
6161

6262
# or the same w/o alias
6363
./vendor/bin/phpunit
@@ -67,11 +67,21 @@ To run a single test
6767

6868
```bash
6969
# using an alias
70-
$ composer test -- --filter BigBlueButtonTest::testApiVersion
70+
$ composer code-test -- --filter BigBlueButtonTest::testApiVersion
7171

7272
# or the same w/o alias
7373
./vendor/bin/phpunit --filter BigBlueButtonTest::testApiVersion
7474
```
75+
A code-coverage report will be created along with the tests. This report will be stored in:
76+
````
77+
./var/coverage/
78+
````
79+
In case of trouble with the creation of the code-coverage report (e.g. local environment does not fulfill requirements)
80+
the creation can be skipped with:
81+
```bash
82+
# using an alias
83+
$ composer code-test -- --no-coverage
84+
```
7585

7686
**Remark:**
7787

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"bbb",
88
"api"
99
],
10-
"homepage": "http://bigbluebutton.org/",
10+
"homepage": "https://bigbluebutton.org/",
1111
"license": "LGPL-3.0-or-later",
1212
"authors": [
1313
{
@@ -42,12 +42,12 @@
4242
"wapmorgan/php-deprecation-detector": "^2.0.33",
4343
"phpstan/phpstan": "^1.10",
4444
"tracy/tracy": "^2.10",
45-
"vlucas/phpdotenv": "^5.6"
45+
"vlucas/phpdotenv": "^5.6",
46+
"phpunit/php-code-coverage": "9.2.30"
4647
},
4748
"scripts": {
4849
"code-check": "./vendor/bin/phpstan analyse",
49-
"test": "./vendor/bin/phpunit",
50-
"test-cov": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html coverage",
50+
"code-test": "./vendor/bin/phpunit",
5151
"cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky yes",
5252
"sniffer": "./vendor/bin/phpcs src/",
5353
"phploc": "./vendor/bin/phploc src/",

phpunit.xml.dist

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="./tests/bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
bootstrap="./tests/bootstrap.php"
6+
backupGlobals="false"
7+
backupStaticAttributes="false"
8+
colors="true"
9+
convertErrorsToExceptions="true"
10+
convertNoticesToExceptions="true"
11+
convertWarningsToExceptions="true"
12+
convertDeprecationsToExceptions="true"
13+
processIsolation="false"
14+
stopOnFailure="false"
15+
verbose="true"
16+
>
317
<coverage processUncoveredFiles="true">
418
<include>
5-
<directory suffix=".php">./src/</directory>
19+
<directory suffix=".php">src</directory>
620
</include>
21+
<report>
22+
<html outputDirectory="./var/coverage/" />
23+
</report>
724
</coverage>
825
<php>
926
<env name="XDEBUG_MODE" value="coverage"/>
1027
</php>
1128
<testsuites>
1229
<testsuite name="BigBlueButton test suite">
13-
<directory>./tests/</directory>
30+
<directory>tests</directory>
1431
</testsuite>
1532
</testsuites>
1633
</phpunit>

src/Util/ParamsIterator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
/**
2626
* @internal
27-
*
28-
* @coversNothing
2927
*/
3028
class ParamsIterator extends TestCase
3129
{

tests/BigBlueButtonTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
* Class BigBlueButtonTest.
3636
*
3737
* @internal
38-
*
39-
* @coversNothing
4038
*/
4139
class BigBlueButtonTest extends TestCase
4240
{

tests/Parameters/CreateMeetingParametersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* @internal
2929
*
30-
* @coversNothing
30+
*
3131
*/
3232
class CreateMeetingParametersTest extends TestCase
3333
{

tests/Parameters/DeleteRecordingsParametersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/**
2626
* @internal
2727
*
28-
* @coversNothing
28+
*
2929
*/
3030
class DeleteRecordingsParametersTest extends TestCase
3131
{

tests/Parameters/EndMeetingParametersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/**
2626
* @internal
2727
*
28-
* @coversNothing
28+
*
2929
*/
3030
class EndMeetingParametersTest extends TestCase
3131
{

0 commit comments

Comments
 (0)