1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- /**
- * Created by PhpStorm.
- * User: yguern
- * Date: 29/09/2017
- * Time: 09:01
- */
- namespace Cloud\RDexp\Calculator;
- class CalculatorTest extends \PHPUnit_Framework_TestCase
- {
- /**
- * What : try to add non real number 10 + 'test'
- * Expected : An exception must be thrown
- */
- public function testAddNonRealNumber() {
- $calculator = new Calculator();
- try {
- $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());
- }
- }
- }
|