public function test_log_get_list_ItemUserClient() { $simpleResultArr = array('list' => array(array('id' => 1, 'client_id' => 1, 'client_name' => 'Joe', 'client_email' => '*****@*****.**'))); $paginatorMock = $this->getMockBuilder('\\Box_Pagination')->disableOriginalConstructor()->getMock(); $paginatorMock->expects($this->atLeastOnce())->method('getSimpleResultSet')->will($this->returnValue($simpleResultArr)); $service = $this->getMockBuilder('\\Box\\Mod\\Activity\\Service')->getMock(); $service->expects($this->atLeastOnce())->method('getSearchQuery')->will($this->returnValue('String')); $model = new \Model_ActivitySystem(); $model->loadBean(new \RedBeanPHP\OODBBean()); $di = new \Box_Di(); $di['pager'] = $paginatorMock; $di['mod_service'] = $di->protect(function () use($service) { return $service; }); $di['array_get'] = $di->protect(function (array $array, $key, $default = null) use($di) { return isset($array[$key]) ? $array[$key] : $default; }); $api = new \Api_Handler(new \Model_Admin()); $api->setDi($di); $di['api_admin'] = $api; $activity = new \Box\Mod\Activity\Api\Admin(); $activity->setDi($di); $activity->setService($service); $activity->log_get_list(array()); }
public function testrmByClient() { $clientModel = new \Model_Client(); $clientModel->loadBean(new \RedBeanPHP\OODBBean()); $clientModel->id = 1; $activitySystemModel = new \Model_ActivitySystem(); $activitySystemModel->loadBean(new \RedBeanPHP\OODBBean()); $dbMock = $this->getMockBuilder('\\Box_Database')->getMock(); $dbMock->expects($this->atLeastOnce())->method('find')->with('ActivitySystem', 'client_id = ?', array($clientModel->id))->willReturn(array($activitySystemModel)); $dbMock->expects($this->atLeastOnce())->method('trash')->with($activitySystemModel); $di = new \Box_Di(); $di['db'] = $dbMock; $service = new \Box\Mod\Activity\Service(); $service->setDi($di); $service->rmByClient($clientModel); }