/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->object = new Acl($this->user); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1, 'active' => true)); $this->user->setPassword('test'); $this->user->save(); $auth = new AuthenticationService(new Storage\Session(UserModel::BACKEND_AUTH_NAMESPACE)); $this->object = new Admin($auth); }
/** * Initialize test * * @return void */ public function init() { parent::setUp(); $this->user = UserModel::fromArray(array('lastname' => 'Test', 'firstname' => 'Test', 'email' => '*****@*****.**', 'login' => 'test-user-model', 'user_acl_role_id' => 1, 'active' => true)); $this->user->setPassword('test-user-model-password'); $this->user->save(); $this->user->authenticate('test-user-model', 'test-user-model-password'); $configuration = (include GC_APPLICATION_PATH . '/config/application.config.php'); $configuration['module_listener_options']['config_glob_paths'] = array('tests/config/local.php'); $this->setApplicationConfig($configuration); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content')); $this->layout->save(); $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->documentType = Model::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->object = new Collection(); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content')); $this->layout->save(); $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->document = DocumentModel::fromArray(array('name' => 'Document name', 'url_key' => 'url-key', 'status' => DocumentModel::STATUS_ENABLE, 'show_in_nav' => true, 'user_id' => $this->user->getId(), 'document_type_id' => $this->documentType->getId(), 'view_id' => $this->view->getId(), 'layout_id' => $this->layout->getId(), 'parent_id' => null)); $this->document->save(); $this->object = new Sitemap(); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content')); $this->layout->save(); $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->datatype = DatatypeModel::fromArray(array('name' => 'CheckboxListTest', 'prevalue_value' => '', 'model' => 'CheckboxList')); $this->datatype->save(); $this->tab = TabModel::fromArray(array('name' => 'TabTest', 'description' => 'TabTest', 'sort_order' => 1, 'document_type_id' => $this->documentType->getId())); $this->tab->save(); $this->property = PropertyModel::fromArray(array('name' => 'DatatypeTest', 'identifier' => 'DatatypeTest', 'description' => 'DatatypeTest', 'required' => false, 'sort_order' => 1, 'tab_id' => $this->tab->getId(), 'datatype_id' => $this->datatype->getId())); $this->property->save(); $datatype = new Datatype(); $application = Registry::get('Application'); $datatype->setRequest($application->getServiceManager()->get('Request')); $datatype->setRouter($application->getServiceManager()->get('Router')); $datatype->setHelperManager($application->getServiceManager()->get('viewhelpermanager')); $datatype->load($this->datatype); $this->object = $datatype->getEditor($this->property); }
protected function createUser() { $this->user = UserModel::fromArray(array('lastname' => 'Test', 'firstname' => 'Test', 'email' => '*****@*****.**', 'login' => 'test-user-login', 'user_acl_role_id' => 1, 'active' => true)); $this->user->setPassword('test-user-model-password'); $this->user->save(); $this->user->authenticate('test-user-login', 'test-user-model-password'); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content')); $this->layout->save(); $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->datatype = DatatypeModel::fromArray(array('name' => 'TextrichTest', 'prevalue_value' => 'a:1:{s:13:"toolbar-items";a:67:{s:6:"Source";s:1:"1";s:4:"Save";' . 's:1:"1";s:7:"NewPage";s:1:"1";s:8:"DocProps";s:1:"1";s:7:"Preview";s:1:"1";s:5:"Print";' . 's:1:"1";s:9:"Templates";s:1:"1";s:3:"Cut";s:1:"1";s:4:"Copy";s:1:"1";s:5:"Paste";s:1:"1";' . 's:9:"PasteText";s:1:"1";s:13:"PasteFromWord";s:1:"1";s:4:"Undo";s:1:"1";s:4:"Redo";s:1:"1";' . 's:4:"Find";s:1:"1";s:7:"Replace";s:1:"1";s:9:"SelectAll";s:1:"1";s:12:"SpellChecker";s:1:"1";' . 's:5:"Scayt";s:1:"1";s:4:"Form";s:1:"1";s:8:"Checkbox";s:1:"1";s:5:"Radio";s:1:"1";' . 's:9:"TextField";s:1:"1";s:8:"Textarea";s:1:"1";s:6:"Select";s:1:"1";s:6:"Button";s:1:"1";' . 's:11:"ImageButton";s:1:"1";s:11:"HiddenField";s:1:"1";s:4:"Bold";s:1:"1";s:6:"Italic";' . 's:1:"1";s:9:"Underline";s:1:"1";s:6:"Strike";s:1:"1";s:9:"Subscript";s:1:"1";' . 's:11:"Superscript";s:1:"1";s:12:"RemoveFormat";s:1:"1";s:12:"NumberedList";s:1:"1";' . 's:12:"BulletedList";s:1:"1";s:7:"Outdent";s:1:"1";s:6:"Indent";' . 's:1:"1";s:10:"Blockquote";s:1:"1";s:9:"CreateDiv";s:1:"1";s:11:"JustifyLeft";s:1:"1";' . 's:13:"JustifyCenter";s:1:"1";s:12:"JustifyRight";s:1:"1";s:12:"JustifyBlock";s:1:"1";' . 's:7:"BidiLtr";s:1:"1";s:7:"BidiRtl";s:1:"1";s:4:"Link";s:1:"1";s:6:"Unlink";s:1:"1";' . 's:6:"Anchor";s:1:"1";s:5:"Image";s:1:"1";s:5:"Flash";' . 's:1:"1";s:5:"Table";s:1:"1";s:14:"HorizontalRule";s:1:"1";s:6:"Smiley";' . 's:1:"1";s:11:"SpecialChar";s:1:"1";' . 's:9:"PageBreak";s:1:"1";s:6:"Iframe";s:1:"1";s:6:"Styles";s:1:"1";s:6:"Format";' . 's:1:"1";s:4:"Font";' . 's:1:"1";s:8:"FontSize";s:1:"1";s:9:"TextColor";s:1:"1";s:7:"BGColor";s:1:"1";' . 's:8:"Maximize";s:1:"1";' . 's:10:"ShowBlocks";s:1:"1";s:5:"About";s:1:"1";}}', 'model' => 'Textrich')); $this->datatype->save(); $this->tab = TabModel::fromArray(array('name' => 'TabTest', 'description' => 'TabTest', 'sort_order' => 1, 'document_type_id' => $this->documentType->getId())); $this->tab->save(); $this->property = PropertyModel::fromArray(array('name' => 'DatatypeTest', 'identifier' => 'DatatypeTest', 'description' => 'DatatypeTest', 'required' => false, 'sort_order' => 1, 'tab_id' => $this->tab->getId(), 'datatype_id' => $this->datatype->getId())); $this->property->save(); $datatype = new Datatype(); $application = Registry::get('Application'); $datatype->setRequest($application->getServiceManager()->get('Request')); $datatype->setRouter($application->getServiceManager()->get('Router')); $datatype->setHelperManager($application->getServiceManager()->get('viewhelpermanager')); $datatype->load($this->datatype); $this->object = $datatype->getEditor($this->property); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content')); $this->layout->save(); $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->document = DocumentModel::fromArray(array('name' => 'Document name', 'url_key' => 'url-key', 'status' => DocumentModel::STATUS_ENABLE, 'show_in_nav' => true, 'user_id' => $this->user->getId(), 'document_type_id' => $this->documentType->getId(), 'view_id' => $this->view->getId(), 'layout_id' => $this->layout->getId(), 'parent_id' => null)); $this->document->save(); $serviceManager = Registry::get('Application')->getServiceManager(); $this->renderer = new PhpRenderer(); $renderer = $serviceManager->get('Zend\\View\\Renderer\\PhpRenderer'); $this->renderer->setHelperPluginManager($renderer->getHelperPluginManager()); $serviceManager->setAllowOverride(true); $serviceManager->setService('currentDocument', $this->document); $serviceManager->setAllowOverride(false); $this->object = new CommentForm(); $this->module = ModuleModel::fromArray(array('name' => 'Blog')); $this->module->save(); $this->boostrap = new Module(); $this->boostrap->install(); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content')); $this->layout->save(); $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->datatype = DatatypeModel::fromArray(array('name' => 'ImageCropperTest', 'prevalue_value' => '', 'model' => 'ImageCropper')); $this->datatype->save(); $this->tab = TabModel::fromArray(array('name' => 'TabTest', 'description' => 'TabTest', 'sort_order' => 1, 'document_type_id' => $this->documentType->getId())); $this->tab->save(); $this->property = PropertyModel::fromArray(array('name' => 'DatatypeTest', 'identifier' => 'DatatypeTest', 'description' => 'DatatypeTest', 'required' => false, 'sort_order' => 1, 'tab_id' => $this->tab->getId(), 'datatype_id' => $this->datatype->getId())); $this->property->save(); $this->document = DocumentModel::fromArray(array('name' => 'jQueryFileUploadTest', 'url_key' => '/jqueryfileupload-test', 'status' => DocumentModel::STATUS_ENABLE, 'sort_order' => 1, 'show_in_nav' => false, 'user_id' => $this->user->getId(), 'document_type_id' => $this->documentType->getId(), 'view_id' => $this->view->getId(), 'layout_id' => $this->layout->getId(), 'parent_id' => 0)); $this->document->save(); $datatype = new Datatype(); $application = Registry::get('Application'); $datatype->setRequest($application->getServiceManager()->get('Request')); $datatype->setRouter($application->getServiceManager()->get('Router')); $datatype->setHelperManager($application->getServiceManager()->get('viewhelpermanager')); $datatype->load($this->datatype, $this->document->getId()); $this->object = $datatype->getEditor($this->property); $this->object->setConfig(array('background' => '#FFFFFF', 'resize_option' => 'auto', 'mime_list' => array('image/gif', 'image/jpeg', 'image/png'), 'size' => array(array('name' => '223x112', 'width' => '223', 'height' => '112'), array('name' => '600x300', 'width' => '600', 'height' => '300')))); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content')); $this->layout->save(); $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->datatype = DatatypeModel::fromArray(array('name' => 'UploadTest', 'prevalue_value' => 'a:1:{s:6:"length";i:10;}', 'model' => 'Upload')); $this->datatype->save(); $this->tab = TabModel::fromArray(array('name' => 'TabTest', 'description' => 'TabTest', 'sort_order' => 1, 'document_type_id' => $this->documentType->getId())); $this->tab->save(); $this->property = PropertyModel::fromArray(array('name' => 'DatatypeTest', 'identifier' => 'DatatypeTest', 'description' => 'DatatypeTest', 'required' => false, 'sort_order' => 1, 'tab_id' => $this->tab->getId(), 'datatype_id' => $this->datatype->getId())); $this->property->save(); $this->document = DocumentModel::fromArray(array('name' => 'jQueryFileUploadTest', 'url_key' => '/jqueryfileupload-test', 'status' => DocumentModel::STATUS_ENABLE, 'sort_order' => 1, 'show_in_nav' => false, 'user_id' => $this->user->getId(), 'document_type_id' => $this->documentType->getId(), 'view_id' => $this->view->getId(), 'layout_id' => $this->layout->getId(), 'parent_id' => 0)); $this->document->save(); $datatype = new Datatype(); $application = Registry::get('Application'); $datatype->setRequest($application->getServiceManager()->get('Request')); $datatype->setRouter($application->getServiceManager()->get('Router')); $datatype->setHelperManager($application->getServiceManager()->get('viewhelpermanager')); $datatype->load($this->datatype, $this->document->getId()); $this->object = $datatype->getEditor($this->property); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content')); $this->layout->save(); $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->document = DocumentModel::fromArray(array('name' => 'Document name', 'url_key' => 'url-key', 'status' => DocumentModel::STATUS_ENABLE, 'show_in_nav' => true, 'user_id' => $this->user->getId(), 'document_type_id' => $this->documentType->getId(), 'view_id' => $this->view->getId(), 'layout_id' => $this->layout->getId(), 'parent_id' => 0)); $this->document->save(); $this->object = new Documents(); $view = new View(); $view->resolver()->addPath(__DIR__ . '/_files/views'); $view->setHelperPluginManager(Registry::get('Application')->getServiceManager()->get('viewhelpermanager')); $this->object->setView($view); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content')); $this->layout->save(); $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->object = Model::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->object->save(); $this->documentTypeChildren = Model::fromArray(array('name' => 'Document Type children Name', 'description' => 'Document Type children description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentTypeChildren->save(); $insert = new Insert(); $insert->into('document_type_dependency')->values(array('parent_id' => $this->object->getId(), 'children_id' => $this->documentTypeChildren->getId())); $this->object->execute($insert); $insert = new Insert(); $insert->into('document_type_view')->values(array('view_id' => $this->view->getId(), 'document_type_id' => $this->object->getId())); $this->object->execute($insert); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content')); $this->layout->save(); $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => '*****@*****.**', 'login' => 'test', 'user_acl_role_id' => 1)); $this->user->setPassword('test'); $this->user->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->tab = TabModel::fromArray(array('name' => 'TabTest', 'description' => 'TabTest', 'sort_order' => 1, 'document_type_id' => $this->documentType->getId())); $this->tab->save(); $this->datatype = DatatypeModel::fromArray(array('name' => 'BooleanTest', 'prevalue_value' => '', 'model' => 'Boolean')); $this->datatype->save(); $this->object = Model::fromArray(array('name' => 'DatatypeTest', 'identifier' => 'DatatypeTest', 'description' => 'DatatypeTest', 'required' => false, 'sort_order' => 1, 'tab_id' => $this->tab->getId(), 'datatype_id' => $this->datatype->getId())); $this->object->save(); }
/** * Test * * @return void */ public function testSetEncryptedPassword() { $password = sha1('test'); $this->object->setPassword('test'); $this->assertEquals($password, $this->object->getPassword()); }
/** * Create user * * @return \Zend\View\Model\ViewModel|array */ public function createAction() { $form = new UserForm(); $form->setAttribute('action', $this->url()->fromRoute('config/user/create')); $form->passwordRequired(); $post = $this->getRequest()->getPost()->toArray(); if ($this->getRequest()->isPost()) { $form->setData($post); $form->getInputFilter()->get('password_confirm')->getValidatorChain()->addValidator(new Identical(empty($post['password']) ? null : $post['password'])); if ($form->isValid()) { $userModel = new User\Model(); $userModel->setData($post); $userModel->setPassword($post['password']); $userModel->save(); $this->flashMessenger()->addSuccessMessage('User saved!'); return $this->redirect()->toRoute('config/user/edit', array('id' => $userModel->getId())); } $this->useFlashMessenger(); $this->flashMessenger()->addErrorMessage('User can not be saved'); } return array('form' => $form); }