public function testGetServiceOrder() { $order = new \Model_ClientOrder(); $order->loadBean(new \RedBeanPHP\OODBBean()); $dbMock = $this->getMockBuilder('\\Box_Database')->disableOriginalConstructor()->getMock(); $dbMock->expects($this->atLeastOnce())->method('findOne')->will($this->returnValue($order)); $toolsMock = $this->getMockBuilder('\\Box_Tools')->getMock(); $toolsMock->expects($this->atLeastOnce())->method('from_camel_case')->will($this->returnValue('servicecustom')); $di = new \Box_Di(); $di['db'] = $dbMock; $di['tools'] = $toolsMock; $this->service->setDi($di); $service = new \Model_ServiceCustom(); $service->loadBean(new \RedBeanPHP\OODBBean()); $service->id = rand(1, 100); $result = $this->service->getServiceOrder($service); $this->assertInstanceOf('Model_ClientOrder', $result); }
/** * @expectedException \Box_Exception */ public function testUpdateConfigNotArrayException() { $model = new \Model_ServiceCustom(); $model->loadBean(new \RedBeanPHP\OODBBean()); $model->id = rand(1, 100); $serviceMock = $this->getMockBuilder('Box\\Mod\\Servicecustom\\Service')->setMethods(array('getServiceCustomByOrderId'))->getMock(); $serviceMock->expects($this->never())->method('getServiceCustomByOrderId')->will($this->returnValue($model)); $dbMock = $this->getMockBuilder('\\Box_Database')->getMock(); $dbMock->expects($this->never())->method('store')->will($this->returnValue(rand(1, 100))); $di = new \Box_Di(); $di['db'] = $dbMock; $di['logger'] = $di['logger'] = $this->getMockBuilder('Box_Log')->getMock(); $serviceMock->setDi($di); $config = ''; $serviceMock->updateConfig(rand(1, 100), $config); }