Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c56095a

Browse files
Merge pull request #20 from martin-helmich/chq81-phpunit9-support
Add support for PHPUnit 9 + migrate to Github Actions
2 parents d925056 + 90c76a3 commit c56095a

File tree

5 files changed

+56
-17
lines changed

5 files changed

+56
-17
lines changed

‎.github/workflows/php.yml‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: PHP type checking and unit testing
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
php: ['7.2', '7.3', '7.4']
10+
phpunit: ['8.0', '9.0']
11+
exclude:
12+
- php: '7.2'
13+
phpunit: '9.0'
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v1
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v1
21+
with:
22+
php-version: ${{ matrix.php }}
23+
extensions: mbstring, intl, json
24+
coverage: pcov
25+
26+
- name: Validate composer.json and composer.lock
27+
run: composer validate
28+
29+
- name: Declare required PHPUnit version
30+
run: |
31+
composer require --no-update --dev phpunit/phpunit ~${{ matrix.phpunit }}
32+
33+
- name: Install dependencies
34+
run: composer install --prefer-dist --no-progress --no-suggest
35+
36+
#- name: Run type checker
37+
# run: ./vendor/bin/psalm
38+
39+
- name: Run unit tests
40+
run: ./vendor/bin/phpunit --testdox

‎README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ This library is [MIT-licensed](LICENSE.txt).
2323

2424
There are several release branches of this library, each of these being compatible with different releases of PHPUnit and PHP. The following table should give an easy overview:
2525

26-
| "JSON assertion" version | PHPUnit 4 | PHPUnit 5 | PHPUnit 6 | PHPUnit 7 | PHPUnit 8 |
27-
| ------------------------ | --------- | --------- | --------- | --------- | --------- |
28-
| v1 (branch `v1`), **unsupported** | :white_check_mark: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: |
29-
| v2 (branch `v2`) | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :white_check_mark: | :no_entry_sign: |
30-
| v3 (branch `master`) | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :white_check_mark: |
26+
| "JSON assertion" version | PHPUnit 4 | PHPUnit 5 | PHPUnit 6 | PHPUnit 7 | PHPUnit 8 | PHPUnit 9 |
27+
| ------------------------ | --------- | --------- | --------- | --------- | --------- | --------- |
28+
| v1 (branch `v1`), **unsupported** | :white_check_mark: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: |:no_entry_sign:|
29+
| v2 (branch `v2`) | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :white_check_mark: | :no_entry_sign: |:no_entry_sign:|
30+
| v3 (branch `master`) | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :white_check_mark: |:white_check_mark:|
3131

3232
When you are using `composer require` and have already declared a dependency to `phpunit/phpunit` in your `composer.json` file, Composer should pick latest compatible version automatically.
3333

‎composer.json‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"justinrainbow/json-schema": "^5.0"
1515
},
1616
"conflict": {
17-
"phpunit/phpunit": "<8.0 || >= 9.0"
17+
"phpunit/phpunit": "<8.0 || >= 10.0"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "^8.0"
20+
"phpunit/phpunit": "^8.0 || ^9.0"
2121
},
2222
"autoload": {
2323
"psr-4": {
@@ -26,11 +26,10 @@
2626
},
2727
"autoload-dev": {
2828
"files": [
29-
"vendor/phpunit/phpunit/src/Framework/Assert/Functions.php",
3029
"src/Functions.php"
3130
]
3231
},
3332
"config": {
3433
"sort-packages": true
3534
}
36-
}
35+
}

‎tests/Functional/JsonValueMatchesFluentTest.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ class JsonValueMatchesFluentTest extends TestCase
2828

2929
public function testAssertThatJsonDocumentContainsJsonValue()
3030
{
31-
assertThat(self::$exampleDocument, containsJsonValue('$.identifier', 1234));
31+
$this->assertThat(self::$exampleDocument, containsJsonValue('$.identifier', 1234));
3232
}
3333

3434
public function testAssertThatJsonDocumentMatchesJsonConstraints()
3535
{
36-
assertThat(
36+
$this->assertThat(
3737
self::$exampleDocument,
3838
matchesJsonConstraints(
3939
[
40-
'$.owner.name' => equalTo('Max Mustermann'),
41-
'$.products[*].identifier' => greaterThanOrEqual(500),
42-
'$.products[*].name' => logicalNot(equalTo('Weißbrot'))
40+
'$.owner.name' => $this->equalTo('Max Mustermann'),
41+
'$.products[*].identifier' => $this->greaterThanOrEqual(500),
42+
'$.products[*].name' => $this->logicalNot($this->equalTo('Weißbrot'))
4343
]
4444
)
4545
);
4646
}
47-
}
47+
}

‎tests/Functional/JsonValueMatchesSchemaFluentTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class JsonValueMatchesSchemaFluentTest extends TestCase
3131

3232
public function testJsonDocumentMatchesSchema()
3333
{
34-
assertThat(static::$exampleDocument, matchesJsonSchema([
34+
$this->assertThat(static::$exampleDocument, matchesJsonSchema([
3535
'type' => 'object',
3636
'required' => ['identifier', 'owner', 'products'],
3737
'properties' => [
@@ -64,7 +64,7 @@ public function testJsonDocumentDoesNotMatchSchema()
6464
{
6565
$this->expectException(AssertionFailedError::class);
6666

67-
assertThat(static::$exampleDocument, matchesJsonSchema([
67+
$this->assertThat(static::$exampleDocument, matchesJsonSchema([
6868
'type' => 'object',
6969
'required' => ['foobar'],
7070
'properties' => [

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /