Skip to content

Commit

Permalink
Merge pull request #151 from erikn69/patch-7
Browse files Browse the repository at this point in the history
Support PhpUnit on composer
  • Loading branch information
topclaudy authored Feb 3, 2023
2 parents f00428f + 10b6aca commit 191dcdc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ jobs:
composer config --no-plugins allow-plugins.kylekatarnls/update-helper true
composer require "illuminate/database:${{ matrix.laravel }}" --no-interaction --no-update
composer update --no-interaction
if [[ ${{ matrix.php }} == "7.0" ]] || [[ ${{ matrix.php }} == "7.1" ]]; then wget --no-check-certificate -O vendor/bin/phpunit https://phar.phpunit.de/phpunit-6.phar; fi
if [ ! -f "vendor/bin/phpunit" ]; then wget --no-check-certificate -O vendor/bin/phpunit https://phar.phpunit.de/phpunit-8.phar; fi
chmod +x vendor/bin/phpunit
- name: Execute tests
run: |
echo "Laravel ${{ matrix.laravel }}"
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ install:
- composer config --no-plugins allow-plugins.kylekatarnls/update-helper true
- composer require "illuminate/database:$ILLUMINATE_DATABASE" --no-interaction --no-update
- composer update --no-interaction
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]] || [[ ${TRAVIS_PHP_VERSION:0:3} == "7.1" ]]; then wget --no-check-certificate -O vendor/bin/phpunit https://phar.phpunit.de/phpunit-6.phar; fi
- if [ ! -f "vendor/bin/phpunit" ]; then wget --no-check-certificate -O vendor/bin/phpunit https://phar.phpunit.de/phpunit-8.phar; fi
- chmod +x vendor/bin/phpunit
before_script:
- wget -O cc-test-reporter https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
- chmod +x cc-test-reporter
Expand Down
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,18 @@ We use [SemVer](http://semver.org/) for versioning. For the versions available,

## Unit Tests

To run unit tests you have to obtain manually proper version of PHPUnit
To run unit tests you have to use PHPUnit

* if you have PHP version 7.1 please get [PHPUnit 7](https://phar.phpunit.de/phpunit-7.phar)
* if you have PHP version 7.2 please get [PHPUnit 8](https://phar.phpunit.de/phpunit-8.phar)
* if you have PHP version 7.3 and higher please get [PHPUnit 9](https://phar.phpunit.de/phpunit-9.phar)

Example
Install compoships repository
```bash
curl -L -O https://phar.phpunit.de/phpunit-9.phar
mv phpunit-9.phar phpunit
chmod +x phpunit
./phpunit
git clone https://github.com/topclaudy/compoships.git
cd compoships
composer install
```
Run PHPUnit
```bash
./vendor/bin/phpunit
```


## Authors

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"illuminate/database": ">=5.6 <=10.0"
},
"require-dev": {
"ext-sqlite3": "*"
"ext-sqlite3": "*",
"phpunit/phpunit": "^6.0|^8.0|^9.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/** @var \Composer\Autoload\ClassLoader $autoloader */
$autoloader = require_once dirname(__DIR__).'/vendor/autoload.php';
$autoloader = require dirname(__DIR__).'/vendor/autoload.php';

if (PHP_MAJOR_VERSION === 7 && in_array(PHP_MINOR_VERSION, [0, 1])) {
$mappedTestCaseFilename = __DIR__.'/TestCase/TestCase6.php';
Expand Down

0 comments on commit 191dcdc

Please sign in to comment.