Skip to content

Commit 6dafaa5

Browse files
authored
Merge pull request #143 from stof/gha
Migrate the CI to GitHub Actions
2 parents 2492720 + a62755f commit 6dafaa5

File tree

8 files changed

+92
-22
lines changed

8 files changed

+92
-22
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/tests export-ignore
2+
/.github export-ignore
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
5+
/phpunit.xml.dist export-ignore

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
check_composer:
9+
name: Check composer.json
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: shivammathur/setup-php@v2
14+
with:
15+
coverage: none
16+
php-version: '8.2'
17+
- run: composer validate --strict --no-check-lock
18+
19+
coding_standards:
20+
name: Coding standards
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v3
24+
- uses: shivammathur/setup-php@v2
25+
with:
26+
coverage: none
27+
php-version: '8.2'
28+
- name: Install dependencies
29+
run: composer update --ansi --no-progress --prefer-dist --no-interaction
30+
- run: composer phpcs
31+
32+
tests:
33+
name: "Tests on PHP ${{ matrix.php }}${{ matrix.name_suffix }}"
34+
runs-on: ubuntu-latest
35+
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
php: [ '5.6', '7.0', '7.1', '7.4', '8.0', '8.1', '8.2' ]
40+
min_stability: [ '' ]
41+
name_suffix: [ '' ]
42+
composer_flags: [ '' ]
43+
include:
44+
- php: '8.2'
45+
min_stability: 'dev'
46+
name_suffix: ' (dev deps)'
47+
- php: '5.6'
48+
min_stability: ''
49+
name_suffix: ' (lowest deps)'
50+
composer_flags: '--prefer-lowest'
51+
52+
steps:
53+
- uses: actions/checkout@v3
54+
- uses: shivammathur/setup-php@v2
55+
with:
56+
coverage: none
57+
php-version: "${{ matrix.php }}"
58+
59+
- name: Configure stability
60+
if: "matrix.min_stability != ''"
61+
run: composer config minimum-stability "${{ matrix.min_stability }}"
62+
63+
- name: Install dependencies
64+
run: composer update --ansi --no-progress --prefer-dist --no-interaction ${{ matrix.composer_flags }}
65+
66+
- name: Run tests
67+
run: vendor/bin/phpunit -v --colors=always

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
composer.phar
22
composer.lock
33
vendor
4+
.phpunit.result.cache

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"paragonie/random_compat": "^1.4 || ^2.0"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "5.3.*"
22+
"phpunit/phpunit": "^5.7.27 || ^8.5.32 || ^9.6.3",
23+
"yoast/phpunit-polyfills": "^1.0"
2324
},
2425
"homepage": "http://keen.io",
2526
"autoload": {

phpunit.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
convertWarningsToExceptions="true"
88
processIsolation="false"
99
stopOnFailure="false"
10-
syntaxCheck="false"
1110
bootstrap="tests/bootstrap.php"
1211
>
1312
<php>

tests/Tests/Client/KeenIOClientTest.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22

33
namespace KeenIO\Tests\Client;
44

5+
use GuzzleHttp\Command\Exception\CommandClientException;
56
use KeenIO\Client\KeenIOClient;
6-
use GuzzleHttp\Subscriber\Mock;
77
use GuzzleHttp\Handler\MockHandler;
88
use GuzzleHttp\HandlerStack;
99
use GuzzleHttp\Psr7\Response;
10-
use GuzzleHttp\Psr7\Request;
1110
use GuzzleHttp\Command\Guzzle\GuzzleClient;
11+
use PHPUnit\Framework\TestCase;
12+
use Yoast\PHPUnitPolyfills\Polyfills\AssertIsType;
13+
use Yoast\PHPUnitPolyfills\Polyfills\ExpectException;
1214

13-
class KeenIOClientTest extends \PHPUnit_Framework_TestCase
15+
class KeenIOClientTest extends TestCase
1416
{
17+
use AssertIsType;
18+
use ExpectException;
19+
1520
/**
1621
* Check that a Keen IO Client is instantiated properly
1722
*/
@@ -299,7 +304,7 @@ public function testServiceCommands($method, $params)
299304
}
300305

301306
// Make sure that the response is a PHP array, according to the documented return type
302-
$this->assertInternalType('array', $result);
307+
$this->assertIsArray($result);
303308
}
304309

305310
/**
@@ -336,7 +341,6 @@ public function providerServiceCommands()
336341

337342
/**
338343
* @dataProvider providerServiceCommands
339-
* @expectedException GuzzleHttp\Command\Exception\CommandClientException
340344
*/
341345
public function testServiceCommandsReturnExceptionOnInvalidAuth($method, $params)
342346
{
@@ -345,12 +349,14 @@ public function testServiceCommandsReturnExceptionOnInvalidAuth($method, $params
345349
])));
346350

347351
$command = $client->getCommand($method, $params);
352+
353+
$this->expectException(CommandClientException::class);
354+
348355
$client->execute($command);
349356
}
350357

351358
/**
352359
* @dataProvider providerServiceCommands
353-
* @expectedException GuzzleHttp\Command\Exception\CommandClientException
354360
*/
355361
public function testServiceCommandsReturnExceptionOnInvalidProjectId($method, $params)
356362
{
@@ -359,6 +365,9 @@ public function testServiceCommandsReturnExceptionOnInvalidProjectId($method, $p
359365
])));
360366

361367
$command = $client->getCommand($method, $params);
368+
369+
$this->expectException(CommandClientException::class);
370+
362371
$client->execute($command);
363372
}
364373

tests/Tests/Filter/MultiTypeFilteringTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
namespace KeenIO\Tests\Filter;
2020

2121
use KeenIO\Client\Filter\MultiTypeFiltering;
22+
use PHPUnit\Framework\TestCase;
2223

23-
class MultiTypeFilteringTest extends \PHPUnit_Framework_TestCase
24+
class MultiTypeFilteringTest extends TestCase
2425
{
2526
public function testCanEncode()
2627
{

0 commit comments

Comments
 (0)