From 8298ff839f9b8d62e2a8ddca083f82e7e3259123 Mon Sep 17 00:00:00 2001 From: peter279k Date: Tue, 5 Mar 2019 16:50:01 +0800 Subject: [PATCH] Add other assertion tests --- tests/AssertsTest.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/AssertsTest.php b/tests/AssertsTest.php index 2e840e6..adf5ca9 100644 --- a/tests/AssertsTest.php +++ b/tests/AssertsTest.php @@ -49,4 +49,38 @@ public function testAssertJsonSubsets() $this->assertJsonSubsets($expected, $expected2, $actual); } + + public function testAssertFloatEquals() + { + $expected = 5.6; + + $actual = 2.8 + 2.8; + + $this->assertFloatEquals($expected, $actual); + } + + public function testAssertArrayHasKeys() + { + $expectedKeys = ['key1', 'key2']; + + $array = [ + 'key1' => 'value1', + 'key2' => 'value2', + ]; + + $this->assertArrayHasKeys($expectedKeys, $array); + } + + public function testAssertAll() + { + $expectations = [ + 'equals' => 1, + 'lessThan' => 10, + 'greaterThan' => 0, + ]; + + $actual = 1; + + $this->assertAll($expectations, $actual); + } }