-
Notifications
You must be signed in to change notification settings - Fork 2
/
MathTest.php
57 lines (44 loc) · 902 Bytes
/
MathTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
use PHPUnit\Framework\TestCase;
Class Math
{
public function add($x, $y)
{
return $x + $y;
}
public function substract($x, $y)
{
return $x - $y;
}
public function multiply($x, $y)
{
return $x * $y;
}
public function divide($x, $y)
{
return $x / $y;
}
}
Class MathTest extends TestCase
{
public function setUp()
{
$this->instance = new Math();
}
public function testAdd()
{
$this->assertEquals(3, $this->instance->add(1, 2));
}
public function testSubstract()
{
$this->assertEquals(2, $this->instance->substract(7, 5));
}
public function testMultiply()
{
$this->assertEquals(9, $this->instance->multiply(3, 3));
}
public function testDivide()
{
$this->assertEquals(4, $this->instance->divide(8, 2));
}
}