public function testAddsNumbers()
 {
     $addition = new Addition();
     $result = $addition->run(5, 5);
     $this->assertSame(10, $result);
 }
示例#2
0
 public function testCalculate()
 {
     $add = new Addition();
     $this->assertEquals(3, $add->calculate(2, 1));
     $this->assertEquals(-1, $add->calculate(4, -5));
 }
示例#3
0
 public function testNew()
 {
     $this->assertSame('new', $this->change->getNew());
 }
 public function testFindsTheSumOfNumbers()
 {
     $addition = new Addition();
     $sum = $addition->run(5, 0);
     $this->assertEquals(5, $sum);
 }
示例#5
0
        $this->name = 'This is a string';
        echo $this->name . '<br>';
    }
    /**
     * Addition Function
     * show below how to call
     * and use them
     * @param $a
     * @param $b
     */
    function add_function($a, $b)
    {
        $c = $a + $b;
        echo $c;
    }
}
?>

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <?php 
$add = new Addition();
$add->add_function(2, 3);
?>
</body>
</html>
示例#6
0
 public function additions()
 {
     return Addition::search()->filterBy('comment', $this)->find();
 }