/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { //set up test object $this->object = new CurrentAccount('1234567890'); $this->mockOverdraftObject = $this->getMock('\\Cilex\\Bank\\OverdraftService', array('setLimit', 'getLimit', 'isEnabled'), array($this->object)); switch ($this->getName()) { case 'testWithdrawFundsGreaterThanBalanceWithOverdraft': case 'testHasNoFundsButOverdraft': case 'testhasOverdraft': $this->mockOverdraftObject->expects($this->once())->method('setLimit')->will($this->returnValue(true)); $this->mockOverdraftObject->expects($this->any())->method('getLimit')->will($this->returnValue(10.0)); $this->mockOverdraftObject->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); $this->object->setOverdraft($this->mockOverdraftObject, 10.0); break; case 'testSetOverdraftLimit': $this->mockOverdraftObject->expects($this->once())->method('setLimit')->will($this->returnValue(true)); break; case 'testSetBadOverdraftLimit': $this->mockOverdraftObject->expects($this->once())->method('setLimit')->will($this->returnValue(false)); break; } }
/** * @covers Cilex\Store\Receipt::display */ public function testDisplayWithDiscount() { $this->mockObject->expects($this->exactly(2))->method('getProperties')->will($this->returnValue(array('test' => 1.0))); $result = \Cilex\Store\Receipt::display($this->mockObject, 1.0, 1.0, 1.0); $this->assertEquals(9, count($result)); }