Example #1
0
 public function testdeleteGroup_groupHasClients()
 {
     $clientModel = new \Model_Client();
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $dbMock->expects($this->atLeastOnce())->method('findOne')->will($this->returnValue($clientModel));
     $di = new \Box_Di();
     $di['db'] = $dbMock;
     $service = new \Box\Mod\Client\Service();
     $service->setDi($di);
     $model = new \Model_ClientGroup();
     $model->loadBean(new \RedBeanPHP\OODBBean());
     $this->setExpectedException('\\Box_Exception', 'Can not remove group with clients');
     $service->deleteGroup($model);
 }
Example #2
0
 public function testgroup_get()
 {
     $data['id'] = '2';
     $model = new \Model_ClientGroup();
     $model->loadBean(new \RedBeanPHP\OODBBean());
     $dbMock = $this->getMockBuilder('\\Box_Database')->getMock();
     $dbMock->expects($this->atLeastOnce())->method('getExistingModelById')->will($this->returnValue($model));
     $dbMock->expects($this->atLeastOnce())->method('toArray')->will($this->returnValue(array()));
     $di = new \Box_Di();
     $di['db'] = $dbMock;
     $validatorMock = $this->getMockBuilder('\\Box_Validate')->disableOriginalConstructor()->getMock();
     $validatorMock->expects($this->atLeastOnce())->method('checkRequiredParamsForArray')->will($this->returnValue(null));
     $di['validator'] = $validatorMock;
     $admin_Client = new \Box\Mod\Client\Api\Admin();
     $admin_Client->setDi($di);
     $result = $admin_Client->group_get($data);
     $this->assertInternalType('array', $result);
 }