diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 1c0658b..c581be8 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -44,7 +44,7 @@ This project uses [the PSR-2 coding standards](http://www.php-fig.org/psr/psr-2/ [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: ```bash -$ ./vendor/bin/phpunit +$ composer test ``` #### Code coverage diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml new file mode 100644 index 0000000..0f2b1a5 --- /dev/null +++ b/.github/workflows/code-coverage.yml @@ -0,0 +1,30 @@ +name: Code Coverage + +on: [pull_request] + +jobs: + coverage: + name: Report code coverage + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + coverage: xdebug + + - name: Install Composer dependencies + uses: ramsey/composer-install@v2 + + - name: Run test suite + run: vendor/bin/simple-phpunit --coverage-text --coverage-clover=tests/coverage + + - name: Publish to Coveralls + uses: coverallsapp/github-action@v2 + with: + files: tests/coverage + format: clover + fail-on-error: false diff --git a/.gitignore b/.gitignore index 235ce45..29813da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ *.DS_Store -tests/coverage -vendor .phpunit.result.cache .vscode +tests/coverage +vendor # The composer.lock file is not needed, as this is a library whose dependencies # will depend on the version of PHP being used. diff --git a/composer.json b/composer.json index a280d4a..c704177 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "simple-phpunit --testdox" ], "test-coverage": [ - "phpdbg -qrr -d memory_limit=-1 ./vendor/bin/simple-phpunit --coverage-html=tests/coverage --colors=always" + "XDEBUG_MODE=coverage ./vendor/bin/simple-phpunit --coverage-html=tests/coverage --colors=always" ] }, "scripts-descriptions": { diff --git a/src/MarkupAssertionsTrait.php b/src/MarkupAssertionsTrait.php index 052cfe0..14b4906 100644 --- a/src/MarkupAssertionsTrait.php +++ b/src/MarkupAssertionsTrait.php @@ -128,7 +128,7 @@ public function assertElementContains($contents, $selector = '', $markup = '', $ { $method = method_exists($this, 'assertStringContainsString') ? 'assertStringContainsString' - : 'assertContains'; + : 'assertContains'; // @codeCoverageIgnore $this->$method( $contents, @@ -153,7 +153,7 @@ public function assertElementNotContains($contents, $selector = '', $markup = '' { $method = method_exists($this, 'assertStringNotContainsString') ? 'assertStringNotContainsString' - : 'assertNotContains'; + : 'assertNotContains'; // @codeCoverageIgnore $this->$method( $contents, @@ -178,7 +178,7 @@ public function assertElementRegExp($regexp, $selector = '', $markup = '', $mess { $method = method_exists($this, 'assertMatchesRegularExpression') ? 'assertMatchesRegularExpression' - : 'assertRegExp'; + : 'assertRegExp'; // @codeCoverageIgnore $this->$method( $regexp, @@ -203,7 +203,7 @@ public function assertElementNotRegExp($regexp, $selector = '', $markup = '', $m { $method = method_exists($this, 'assertDoesNotMatchRegularExpression') ? 'assertDoesNotMatchRegularExpression' - : 'assertNotRegExp'; + : 'assertNotRegExp'; // @codeCoverageIgnore $this->$method( $regexp,