public function testEvents() { $params = array('id' => 1); $event = $this->_bb_event = new Box_Event(null, 'name', $params, $this->api_admin, $this->api_guest); $event->setDi($this->di); $service = new \Box\Mod\Staff\Service(); $bool = $service->onAfterClientSignUp($event); $this->assertTrue($bool); }
public function testauthorizeAdmin() { $email = '*****@*****.**'; $password = '******'; $model = new \Model_Admin(); $model->loadBean(new \RedBeanPHP\OODBBean()); $dbMock = $this->getMockBuilder('\\Box_Database')->getMock(); $dbMock->expects($this->atLeastOnce())->method('findOne')->with('Admin', 'email = ? AND status = ?')->willReturn($model); $authMock = $this->getMockBuilder('\\Box_Authorization')->disableOriginalConstructor()->getMock(); $authMock->expects($this->atLeastOnce())->method('authorizeUser')->with($model, $password)->willReturn($model); $di = new \Box_Di(); $di['db'] = $dbMock; $di['auth'] = $authMock; $service = new \Box\Mod\Staff\Service(); $service->setDi($di); $result = $service->authorizeAdmin($email, $password); $this->assertInstanceOf('\\Model_Admin', $result); }