public function testcanChangeEmail_CanntChangeEmail() { $clientModel = new \Model_Client(); $clientModel->loadBean(new \RedBeanPHP\OODBBean()); $email = '*****@*****.**'; $config = array('allow_change_email' => false); $di = new \Box_Di(); $di['mod_config'] = $di->protect(function ($modName) use($config) { return $config; }); $service = new \Box\Mod\Client\Service(); $service->setDi($di); $this->setExpectedException('Box_Exception', 'Email can not be changed'); $service->canChangeEmail($clientModel, $email); }