Skip to content

Commit aa56581

Browse files
committed
Added function usage to support functional interface.
1 parent 9cebba9 commit aa56581

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

tests/Functional/JsonValueMatchesFluentTest.php

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

44
use PHPUnit\Framework\TestCase;
5+
use function PHPUnit\Framework\assertThat;
6+
use function PHPUnit\Framework\equalTo;
7+
use function PHPUnit\Framework\greaterThanOrEqual;
8+
use function PHPUnit\Framework\logicalNot;
59

610
class JsonValueMatchesFluentTest extends TestCase
711
{
@@ -28,18 +32,18 @@ class JsonValueMatchesFluentTest extends TestCase
2832

2933
public function testAssertThatJsonDocumentContainsJsonValue()
3034
{
31-
$this->assertThat(self::$exampleDocument, containsJsonValue('$.identifier', 1234));
35+
assertThat(self::$exampleDocument, containsJsonValue('$.identifier', 1234));
3236
}
3337

3438
public function testAssertThatJsonDocumentMatchesJsonConstraints()
3539
{
36-
$this->assertThat(
40+
assertThat(
3741
self::$exampleDocument,
3842
matchesJsonConstraints(
3943
[
40-
'$.owner.name' => $this->equalTo('Max Mustermann'),
41-
'$.products[*].identifier' => $this->greaterThanOrEqual(500),
42-
'$.products[*].name' => $this->logicalNot($this->equalTo('Weißbrot'))
44+
'$.owner.name' => equalTo('Max Mustermann'),
45+
'$.products[*].identifier' => greaterThanOrEqual(500),
46+
'$.products[*].name' => logicalNot(equalTo('Weißbrot'))
4347
]
4448
)
4549
);

tests/Functional/JsonValueMatchesSchemaFluentTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use Helmich\JsonAssert\JsonAssertions;
55
use PHPUnit\Framework\AssertionFailedError;
66
use PHPUnit\Framework\TestCase;
7+
use function PHPUnit\Framework\assertThat;
78

89
class JsonValueMatchesSchemaFluentTest extends TestCase
910
{
@@ -31,7 +32,7 @@ class JsonValueMatchesSchemaFluentTest extends TestCase
3132

3233
public function testJsonDocumentMatchesSchema()
3334
{
34-
$this->assertThat(static::$exampleDocument, matchesJsonSchema([
35+
assertThat(static::$exampleDocument, matchesJsonSchema([
3536
'type' => 'object',
3637
'required' => ['identifier', 'owner', 'products'],
3738
'properties' => [
@@ -64,7 +65,7 @@ public function testJsonDocumentDoesNotMatchSchema()
6465
{
6566
$this->expectException(AssertionFailedError::class);
6667

67-
$this->assertThat(static::$exampleDocument, matchesJsonSchema([
68+
assertThat(static::$exampleDocument, matchesJsonSchema([
6869
'type' => 'object',
6970
'required' => ['foobar'],
7071
'properties' => [

0 commit comments

Comments
 (0)