Skip to content

Commit fbb6b95

Browse files
Merge branch 'martinssipenko-master'
2 parents 8ec83fc + 0728be1 commit fbb6b95

File tree

10 files changed

+25
-27
lines changed

10 files changed

+25
-27
lines changed

.gitignore

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

56
/.idea/

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ sudo: false
33
php:
44
- 7.3
55
- 7.2
6-
- 7.1
76
install:
87
- composer install --optimize-autoloader --prefer-dist --no-interaction
98
before_script:

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +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 |
27-
| ------------------------ | --------- | --------- | --------- | --------- |
28-
| v1 (branch `v1`), **unsupported** | :white_check_mark: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: |
29-
| v2 (branch `master`) | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :white_check_mark: |
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: |
3031

3132
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.
3233

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
}
1010
],
1111
"require": {
12-
"php": ">=7.0",
12+
"php": "^7.2",
1313
"flow/jsonpath": "^0.4.0",
1414
"justinrainbow/json-schema": "^5.0"
1515
},
1616
"conflict": {
17-
"phpunit/phpunit": "<6.0 || >= 8.0"
17+
"phpunit/phpunit": "<8.0 || >= 9.0"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "^6.0 | ^7.0"
20+
"phpunit/phpunit": "^8.0"
2121
},
2222
"autoload": {
2323
"psr-4": {

src/Constraint/JsonValueMatches.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ class JsonValueMatches extends Constraint
4141
*/
4242
public function __construct(string $jsonPath, Constraint $constraint, bool $matchAll = false)
4343
{
44-
parent::__construct();
45-
4644
$this->jsonPath = $jsonPath;
4745
$this->constraint = $constraint;
4846
$this->matchAll = $matchAll;

src/Constraint/JsonValueMatchesMany.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class JsonValueMatchesMany extends Constraint
2727
*/
2828
public function __construct(array $constraints)
2929
{
30-
parent::__construct();
31-
3230
foreach ($constraints as $key => $constraint) {
3331
if (!$constraint instanceof Constraint) {
3432
$constraint = new IsEqual($constraint);

src/Constraint/JsonValueMatchesSchema.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class JsonValueMatchesSchema extends Constraint
2525
*/
2626
public function __construct($schema)
2727
{
28-
parent::__construct();
2928
$this->schema = $this->forceToObject($schema);
3029
}
3130

tests/Functional/JsonValueMatchesSchemaFluentTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace Helmich\JsonAssert\Tests\Functional;
33

44
use Helmich\JsonAssert\JsonAssertions;
5+
use PHPUnit\Framework\AssertionFailedError;
56
use PHPUnit\Framework\TestCase;
67

78
class JsonValueMatchesSchemaFluentTest extends TestCase
@@ -59,11 +60,10 @@ public function testJsonDocumentMatchesSchema()
5960
]));
6061
}
6162

62-
/**
63-
* @expectedException \PHPUnit\Framework\AssertionFailedError
64-
*/
6563
public function testJsonDocumentDoesNotMatchSchema()
6664
{
65+
$this->expectException(AssertionFailedError::class);
66+
6767
assertThat(static::$exampleDocument, matchesJsonSchema([
6868
'type' => 'object',
6969
'required' => ['foobar'],
@@ -72,4 +72,4 @@ public function testJsonDocumentDoesNotMatchSchema()
7272
]
7373
]));
7474
}
75-
}
75+
}

tests/Functional/JsonValueMatchesSchemaTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace Helmich\JsonAssert\Tests\Functional;
33

44
use Helmich\JsonAssert\JsonAssertions;
5+
use PHPUnit\Framework\AssertionFailedError;
56
use PHPUnit\Framework\TestCase;
67

78
class JsonValueMatchesSchemaTest extends TestCase
@@ -59,11 +60,10 @@ public function testJsonDocumentMatchesSchema()
5960
]);
6061
}
6162

62-
/**
63-
* @expectedException \PHPUnit\Framework\AssertionFailedError
64-
*/
6563
public function testJsonDocumentDoesNotMatchSchema()
6664
{
65+
$this->expectException(AssertionFailedError::class);
66+
6767
$this->assertJsonDocumentMatchesSchema(static::$exampleDocument, [
6868
'type' => 'object',
6969
'required' => ['foobar'],
@@ -83,4 +83,4 @@ public function testStringsAreInterpretedAsJsonString()
8383
]
8484
]);
8585
}
86-
}
86+
}

tests/Functional/JsonValueMatchesTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace Helmich\JsonAssert\Tests\Functional;
33

44
use Helmich\JsonAssert\JsonAssertions;
5+
use PHPUnit\Framework\AssertionFailedError;
56
use PHPUnit\Framework\Constraint\Count;
67
use PHPUnit\Framework\Constraint\IsEqual;
78
use PHPUnit\Framework\Constraint\IsType;
@@ -82,10 +83,11 @@ public function testJsonValueEqualsCanSucceed($jsonDocument, $jsonPath, $expecte
8283
* @param $jsonPath
8384
* @param $expectedValue
8485
* @dataProvider dataForJsonValueEqualsCanFail
85-
* @expectedException \PHPUnit\Framework\AssertionFailedError
8686
*/
8787
public function testJsonValueEqualsCanFail($jsonDocument, $jsonPath, $expectedValue)
8888
{
89+
$this->expectException(AssertionFailedError::class);
90+
8991
$this->assertJsonValueEquals($jsonDocument, $jsonPath, $expectedValue);
9092
}
9193

@@ -118,10 +120,11 @@ public function testJsonValueMatchesSucceedsWithAnyConstraint()
118120
* @param $jsonPath
119121
* @param $expectedValue
120122
* @dataProvider dataForJsonValueEqualsCanFail
121-
* @expectedException \PHPUnit\Framework\AssertionFailedError
122123
*/
123124
public function testJsonValueMatchesCanFail($jsonDocument, $jsonPath, $expectedValue)
124125
{
126+
$this->expectException(AssertionFailedError::class);
127+
125128
$this->assertJsonValueMatches(
126129
$jsonDocument,
127130
$jsonPath,
@@ -146,11 +149,10 @@ public function testAssertManyCanSucceed()
146149
);
147150
}
148151

149-
/**
150-
* @expectedException \PHPUnit\Framework\AssertionFailedError
151-
*/
152152
public function testAssertManyCanFail()
153153
{
154+
$this->expectException(AssertionFailedError::class);
155+
154156
$this->assertJsonDocumentMatches(
155157
static::$exampleDocument,
156158
[
@@ -160,4 +162,4 @@ public function testAssertManyCanFail()
160162
]
161163
);
162164
}
163-
}
165+
}

0 commit comments

Comments
 (0)