calculator = new Calculator(); } /** * What : try to add non real number 10 + 'test' * Expected : An exception must be thrown */ public function testAddNonRealNumber() { $this->calculator = new Calculator(); try { $this->calculator->add(10, 'test'); $this->assertFalse(true, "An exception must be thrown"); } catch (\Exception $e) { $this->assertInstanceOf(CalculatorException::class, $e); $this->assertEquals("Adding not real numbers", $e->getMessage()); } } /** * What : add to real numbers (10.1 + 42) * Expected : Returns 52.1 */ public function testAddRealNumber() { $result = $this->calculator->add(10.1, 42); $this->assertEquals(52.1, $result); } }