Skip to content

Commit 43c10c7

Browse files
Merge pull request #43 from stevegrunwell/feature/restore-code-coverage
Re-enable code coverage reporting to Coveralls
2 parents c75b965 + 30ee855 commit 43c10c7

File tree

5 files changed

+38
-8
lines changed

5 files changed

+38
-8
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This project uses [the PSR-2 coding standards](http://www.php-fig.org/psr/psr-2/
4444
[PHPUnit](https://phpunit.de/) is included as a development dependency, and should be run regularly. When submitting changes, please be sure to add or update unit tests accordingly. You may run unit tests at any time by running:
4545

4646
```bash
47-
$ ./vendor/bin/phpunit
47+
$ composer test
4848
```
4949

5050
#### Code coverage

.github/workflows/code-coverage.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Code Coverage
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
coverage:
7+
name: Report code coverage
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '8.2'
17+
coverage: xdebug
18+
19+
- name: Install Composer dependencies
20+
uses: ramsey/composer-install@v2
21+
22+
- name: Run test suite
23+
run: vendor/bin/simple-phpunit --coverage-text --coverage-clover=tests/coverage
24+
25+
- name: Publish to Coveralls
26+
uses: coverallsapp/github-action@v2
27+
with:
28+
files: tests/coverage
29+
format: clover
30+
fail-on-error: false

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
*.DS_Store
2-
tests/coverage
3-
vendor
42
.phpunit.result.cache
53
.vscode
4+
tests/coverage
5+
vendor
66

77
# The composer.lock file is not needed, as this is a library whose dependencies
88
# will depend on the version of PHP being used.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"simple-phpunit --testdox"
3838
],
3939
"test-coverage": [
40-
"phpdbg -qrr -d memory_limit=-1 ./vendor/bin/simple-phpunit --coverage-html=tests/coverage --colors=always"
40+
"XDEBUG_MODE=coverage ./vendor/bin/simple-phpunit --coverage-html=tests/coverage --colors=always"
4141
]
4242
},
4343
"scripts-descriptions": {

src/MarkupAssertionsTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function assertElementContains($contents, $selector = '', $markup = '', $
128128
{
129129
$method = method_exists($this, 'assertStringContainsString')
130130
? 'assertStringContainsString'
131-
: 'assertContains';
131+
: 'assertContains'; // @codeCoverageIgnore
132132

133133
$this->$method(
134134
$contents,
@@ -153,7 +153,7 @@ public function assertElementNotContains($contents, $selector = '', $markup = ''
153153
{
154154
$method = method_exists($this, 'assertStringNotContainsString')
155155
? 'assertStringNotContainsString'
156-
: 'assertNotContains';
156+
: 'assertNotContains'; // @codeCoverageIgnore
157157

158158
$this->$method(
159159
$contents,
@@ -178,7 +178,7 @@ public function assertElementRegExp($regexp, $selector = '', $markup = '', $mess
178178
{
179179
$method = method_exists($this, 'assertMatchesRegularExpression')
180180
? 'assertMatchesRegularExpression'
181-
: 'assertRegExp';
181+
: 'assertRegExp'; // @codeCoverageIgnore
182182

183183
$this->$method(
184184
$regexp,
@@ -203,7 +203,7 @@ public function assertElementNotRegExp($regexp, $selector = '', $markup = '', $m
203203
{
204204
$method = method_exists($this, 'assertDoesNotMatchRegularExpression')
205205
? 'assertDoesNotMatchRegularExpression'
206-
: 'assertNotRegExp';
206+
: 'assertNotRegExp'; // @codeCoverageIgnore
207207

208208
$this->$method(
209209
$regexp,

0 commit comments

Comments
 (0)