Skip to content

Commit 36b16e6

Browse files
committed
update test
1 parent 7438bd6 commit 36b16e6

4 files changed

Lines changed: 42 additions & 1 deletion

File tree

php-unit/tests/ArrayTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,11 @@ public function testIfEmpty()
5858
// This success
5959
$this->assertEmpty([]);
6060
}
61+
62+
public function testIfIsArray()
63+
{
64+
// Failure if is not array
65+
$array = [1,2,3,4,5];
66+
$this->assertIsArray($array);
67+
}
6168
}

php-unit/tests/ClassTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,10 @@ public function testIfObjectEqualsWithAnotherObject()
5959
// This success
6060
$this->assertObjectEquals($user1, $user2);
6161
}
62+
63+
public function testIfInstanceOf()
64+
{
65+
// Success if class instance of parent class
66+
$this->assertInstanceOf(Exception::class, new RedisException);
67+
}
6268
}

php-unit/tests/MiscellaneousTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,20 @@ public function testIfFalse()
1414
// Success
1515
$this->assertFalse(false);
1616
}
17+
18+
public function testIfIsBoolean()
19+
{
20+
// Failure if is not boolean
21+
$this->assertIsBool(true);
22+
}
23+
24+
public function testIfIsCallable()
25+
{
26+
// Failure if is not callable
27+
$func = function () {
28+
return "Hello World";
29+
};
30+
31+
$this->assertIsCallable($func);
32+
}
1733
}
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use PHPUnit\Framework\TestCase;
66

7-
class IntegerTest extends TestCase
7+
class NumberTest extends TestCase
88
{
99
public function testIfGreaterThan()
1010
{
@@ -24,4 +24,16 @@ public function testIfNumberGreaterThanOrEqual()
2424
$this->assertGreaterThanOrEqual(10, 10);
2525
$this->assertGreaterThanOrEqual(100, 1000);
2626
}
27+
28+
public function testIfIsFloatingNumber()
29+
{
30+
// Failure if is not float
31+
$this->assertIsFloat(1.5);
32+
}
33+
34+
public function testIfIsIntegerNumber()
35+
{
36+
// Failure if is not integer
37+
$this->assertIsInt(100);
38+
}
2739
}

0 commit comments

Comments
 (0)