From 0521b1c90401cab5b9060db3eb436fdde0397da1 Mon Sep 17 00:00:00 2001 From: peter279k Date: Wed, 27 Feb 2019 16:24:51 +0800 Subject: [PATCH] Enhance tests --- .travis.yml | 1 + README.md | 2 +- tests/AssertsTest.php | 52 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/AssertsTest.php diff --git a/.travis.yml b/.travis.yml index a2a8807..3fd91ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ php: - 7.0 - 7.1 - 7.2 + - 7.3 - nightly matrix: diff --git a/README.md b/README.md index badd7e0..2e16fb4 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ composer require --dev adhocore/asserts ## Usage ```php -use Ahc\Asserts; +use Ahc\Asserts\Asserts; class MyTest extends PHPUnit\Framework\Testcase { diff --git a/tests/AssertsTest.php b/tests/AssertsTest.php new file mode 100644 index 0000000..2e840e6 --- /dev/null +++ b/tests/AssertsTest.php @@ -0,0 +1,52 @@ + + * + * + * Licensed under MIT license. + */ + +namespace Ahc\Asserts\Test; + +use Ahc\Asserts\Asserts; +use PHPUnit\Framework\TestCase; + +class AssertsTest extends TestCase +{ + use Asserts; + + public function testAssertJsonSubset() + { + $expected = [ + 'key1' => 'value1', + ]; + + $actual = [ + 'key1' => 'value1', + 'key2' => 'value2', + ]; + + $this->assertJsonSubset($expected, $actual); + } + + public function testAssertJsonSubsets() + { + $expected = [ + 'key1' => 'value1', + ]; + + $expected2 = [ + 'key2' => 'value2', + ]; + + $actual = [ + 'key1' => 'value1', + 'key2' => 'value2', + ]; + + $this->assertJsonSubsets($expected, $expected2, $actual); + } +}