public function test_numbers() { $a = new Calculator(); $this->assertEquals(0, $a->Add("")); $this->assertEquals(2, $a->Add("2")); $this->assertEquals(5, $a->Add("2,3")); $this->assertEquals(30, $a->Add("10,2,3,15")); $this->assertEquals(30, $a->Add("10,2\n3,15")); $this->assertEquals(30, $a->Add("//[;;;]\n10;;;20")); }
public function testLoggingSimpleAdd() { $a = new Calculator(); $mockedLogger = $this->getMockBuilder('Demo\\ILogger')->getMock(); $mockedLogger->expects($this->once())->method('write')->with($this->equalTo('6')); Calculator::setLogger($mockedLogger); $a->Add("2,4"); }