From b971beecbe015dcadad8497e0a2e658207dfaa52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Mon, 18 Oct 2021 16:36:19 +0200 Subject: [PATCH] Add PHPUnit and use GitHub actions for continuous integration (CI) --- .github/workflows/ci.yml | 29 +++++++++++++ .gitignore | 3 +- .travis.yml | 12 ------ README.md | 15 +++++-- composer.json | 1 + composer.lock | 64 ---------------------------- tests/React/Tests/Async/TestCase.php | 2 +- 7 files changed, 45 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml delete mode 100644 composer.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..559f37d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + pull_request: + +jobs: + PHPUnit: + name: PHPUnit (PHP ${{ matrix.php }}) + runs-on: ubuntu-20.04 + strategy: + matrix: + php: + - 7.4 + - 7.3 + - 7.2 + - 7.1 + - 5.6 + - 5.5 + - 5.4 + - 5.3 + steps: + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: xdebug + - run: composer install + - run: vendor/bin/phpunit --coverage-text diff --git a/.gitignore b/.gitignore index 22d0d82..c8153b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -vendor +/composer.lock +/vendor/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 077c106..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: php - -php: - - 5.3 - - 5.4 - - 5.5 - -before_script: - - curl -s http://getcomposer.org/installer | php - - php composer.phar install --dev - -script: phpunit --coverage-text diff --git a/README.md b/README.md index fb8be9b..1e46bd9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Async utilities for React. It is heavily influenced by [async.js](https://github.com/caolan/async). -[![Build Status](https://secure.travis-ci.org/reactphp/async.png?branch=master)](http://travis-ci.org/reactphp/async) +[![CI status](https://github.com/reactphp/async/workflows/CI/badge.svg)](https://github.com/reactphp/async/actions) ## About @@ -118,9 +118,18 @@ $loop->run(); ## Tests -To run the test suite, you need PHPUnit. +To run the test suite, you first need to clone this repo and then install all +dependencies [through Composer](https://getcomposer.org/): - $ phpunit +```bash +$ composer install +``` + +To run the test suite, go to the project root and run: + +```bash +$ php vendor/bin/phpunit +``` ## License diff --git a/composer.json b/composer.json index 6e98d55..3977ee7 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "php": ">=5.3.2" }, "require-dev": { + "phpunit/phpunit": "^5.7 || ^4.8.35", "react/event-loop": "0.2.*" }, "suggest": { diff --git a/composer.lock b/composer.lock deleted file mode 100644 index d7a52c6..0000000 --- a/composer.lock +++ /dev/null @@ -1,64 +0,0 @@ -{ - "hash": "b960de93e5fdde7636532a3c5c3bf373", - "packages": [ - - ], - "packages-dev": [ - { - "name": "react/event-loop", - "version": "v0.2.7", - "target-dir": "React/EventLoop", - "source": { - "type": "git", - "url": "https://github.com/reactphp/event-loop", - "reference": "v0.2.7" - }, - "dist": { - "type": "zip", - "url": "https://github.com/reactphp/event-loop/archive/v0.2.7.zip", - "reference": "v0.2.7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-libev": "*", - "ext-libevent": ">=0.0.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.2-dev" - } - }, - "autoload": { - "psr-0": { - "React\\EventLoop": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Event loop abstraction layer that libraries can use for evented I/O.", - "keywords": [ - "event-loop" - ], - "time": "2013-01-05 11:41:26" - } - ], - "aliases": [ - - ], - "minimum-stability": "stable", - "stability-flags": [ - - ], - "platform": { - "php": ">=5.3.2" - }, - "platform-dev": [ - - ] -} diff --git a/tests/React/Tests/Async/TestCase.php b/tests/React/Tests/Async/TestCase.php index e7f210a..43a68e4 100644 --- a/tests/React/Tests/Async/TestCase.php +++ b/tests/React/Tests/Async/TestCase.php @@ -6,7 +6,7 @@ class TestCase extends \PHPUnit_Framework_TestCase { protected function createCallableMock($expects, $with = null) { - $callable = $this->getMock('React\Tests\Async\CallableStub'); + $callable = $this->getMockBuilder('React\Tests\Async\CallableStub')->getMock(); $method = $callable ->expects($expects)