/** * 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->datatype = DatatypeModel::fromArray(array('name' => 'AbstractDatatype', 'prevalue_value' => 's:16:"AbstractDatatype";', 'model' => 'AbstractDatatype')); $this->datatype->save(); $this->object = $this->getMockForAbstractClass('Gc\\Datatype\\AbstractDatatype'); $application = Registry::get('Application'); $this->object->setRequest($application->getServiceManager()->get('Request')); $this->object->setRouter($application->getServiceManager()->get('Router')); $this->object->setHelperManager($application->getServiceManager()->get('viewhelpermanager')); $this->object->load($this->datatype, 1); }
/** * 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->datatype = DatatypeModel::fromArray(array('name' => 'UploadTest', 'prevalue_value' => '', 'model' => 'Upload')); $this->datatype->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->getPrevalueEditor(); }
/** * Set datatype collection * * @return \Gc\Datatype\Collection */ protected function setDatatypes() { $rows = $this->fetchAll($this->select(function (Select $select) { $select->order('name'); })); $datatypes = array(); foreach ($rows as $row) { $datatypes[] = Model::fromArray((array) $row); } $this->datatypes = $datatypes; return $this; }
/** * 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->datatype = DatatypeModel::fromArray(array('name' => 'MixedTest', 'prevalue_value' => 'a:1:{s:9:"datatypes";a:1:{i:0;a:3:{s:4:"name";' . 's:10:"Textstring";s:5:"label";s:4:"Test";s:6:"config";' . 'a:1:{s:6:"length";s:0:"";}}}}', 'model' => 'Mixed')); $this->datatype->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->setDatatypesList($application->getServiceManager()->get('DatatypesList')); $datatype->load($this->datatype); $this->object = $datatype->getPrevalueEditor(); }
/** * 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->datatype = DatatypeModel::fromArray(array('name' => 'AbstractEditorTest', 'prevalue_value' => 's:18:"AbstractEditorTest";', 'model' => 'AbstractEditorTest')); $this->datatype->save(); $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->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->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(); $mockDatatype = $this->getMockForAbstractClass('Gc\\Datatype\\AbstractDatatype'); $application = Registry::get('Application'); $mockDatatype->setRequest($application->getServiceManager()->get('Request')); $mockDatatype->setRouter($application->getServiceManager()->get('Router')); $mockDatatype->setHelperManager($application->getServiceManager()->get('viewhelpermanager')); $mockDatatype->setProperty($this->property); $mockDatatype->load($this->datatype, 1); $this->object = $this->getMockForAbstractClass('Gc\\Datatype\\AbstractDatatype\\AbstractEditor', array($mockDatatype)); }
/** * 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->datatype = DatatypeModel::fromArray(array('name' => 'TextstringTest', 'prevalue_value' => 'a:1:{s:6:"length";i:10;}', 'model' => 'Textstring')); $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->datatype = DatatypeModel::fromArray(array('name' => 'jQueryFileUploadTest', 'prevalue_value' => '', 'model' => 'jQueryFileUpload')); $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->datatype = DatatypeModel::fromArray(array('name' => 'DatatypeCollectionTest', 'prevalue_value' => '', 'model' => 'DatatypeCollectionTest')); $this->datatype->save(); $this->object = new Collection(); }
/** * Test * * @return void */ public function testImportTabActionWithPostData() { $viewModel = ViewModel::fromArray(array('name' => 'Test', 'identifier' => 'Test', 'content' => 'Test')); $viewModel->save(); $datatypeModel = DatatypeModel::fromArray(array('name' => 'DatatypeTest', 'model' => 'Textstring')); $datatypeModel->save(); $documentTypeModel = DocumentTypeModel::fromArray(array('name' => 'TestDocumentType', 'icon_id' => 3, 'default_view_id' => $viewModel->getId(), 'user_id' => $this->user->getId())); $documentTypeModel->save(); $tabModel = TabModel::fromArray(array('name' => 'test', 'description' => 'test', 'document_type_id' => $documentTypeModel->getId())); $tabModel->save(); $propertyModel = PropertyModel::fromArray(array('name' => 'test', 'identifier' => 'test', 'description' => 'test', 'tab_id' => $tabModel->getId(), 'datatype_id' => $datatypeModel->getId())); $propertyModel->save(); $this->dispatch('/admin/development/document-type/import-tab', 'POST', array('tab_id' => $tabModel->getId())); $this->assertResponseStatusCode(200); $this->assertModuleName('GcDevelopment'); $this->assertControllerName('DocumentTypeController'); $this->assertControllerClass('DocumentTypeController'); $this->assertMatchedRouteName('development/document-type/import-tab'); $documentTypeModel->delete(); $propertyModel->delete(); $tabModel->delete(); $viewModel->delete(); $datatypeModel->delete(); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { $this->init(); $this->view = ViewModel::fromArray(array('name' => 'View', 'identifier' => 'ViewIdentifier', 'description' => 'Description', 'content' => '')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'View', 'identifier' => 'ViewIdentifier', 'description' => 'Description', 'content' => '')); $this->layout->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'DocumentType', 'description' => 'description', 'icon_id' => 1, 'default_view_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->documentType->setDependencies(array($this->documentType->getId())); $this->documentType->save(); $this->datatype = DatatypeModel::fromArray(array('name' => 'DatatypeTest', 'model' => 'Textstring')); $this->datatype->save(); $this->tabModel = TabModel::fromArray(array('name' => 'test', 'description' => 'test', 'document_type_id' => $this->documentType->getId())); $this->tabModel->save(); $this->property = PropertyModel::fromArray(array('name' => 'test', 'identifier' => 'test', 'description' => 'test', 'tab_id' => $this->tabModel->getId(), 'datatype_id' => $this->datatype->getId(), 'is_required' => true)); $this->property->save(); $this->document = DocumentModel::fromArray(array('name' => 'test', 'url_key' => '', 'status' => DocumentModel::STATUS_ENABLE, '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(); }
/** * Test * * @return void */ public function testLoad() { $user = UserModel::fromArray(array('lastname' => 'Test', 'firstname' => 'Test', 'email' => '*****@*****.**', 'login' => 'test-user-model', 'user_acl_role_id' => 1)); $user->setPassword('test-user-model-password'); $user->save(); $view = ViewModel::fromArray(array('name' => 'View', 'identifier' => 'ViewIdentifier', 'description' => 'Description', 'content' => '')); $view->save(); $layout = LayoutModel::fromArray(array('name' => 'View', 'identifier' => 'ViewIdentifier', 'description' => 'Description', 'content' => '')); $layout->save(); $documenttype = DocumentTypeModel::fromArray(array('name' => 'DocumentType', 'description' => 'description', 'icon_id' => 1, 'default_view_id' => $view->getId(), 'user_id' => $user->getId())); $documenttype->save(); $documenttype->setDependencies(array($documenttype->getId())); $documenttype->save(); $datatype = DatatypeModel::fromArray(array('name' => 'DatatypeTest', 'model' => 'Textstring')); $datatype->save(); $tab = TabModel::fromArray(array('name' => 'test', 'description' => 'test', 'document_type_id' => $documenttype->getId())); $tab->save(); $property = PropertyModel::fromArray(array('name' => 'test', 'identifier' => 'test', 'description' => 'test', 'tab_id' => $tab->getId(), 'datatype_id' => $datatype->getId(), 'is_required' => true)); $property->save(); $document = DocumentModel::fromArray(array('name' => 'test', 'url_key' => '', 'status' => DocumentModel::STATUS_ENABLE, 'user_id' => $user->getId(), 'document_type_id' => $documenttype->getId(), 'view_id' => $view->getId(), 'layout_id' => $layout->getId(), 'parent_id' => null)); $document->save(); $this->assertNull($this->object->load($document, array('locales' => array('en_GB' => 'English')))); $this->object->setData(array()); $this->assertFalse($this->object->isValid()); $document->delete(); $documenttype->delete(); $property->delete(); $tab->delete(); $view->delete(); $layout->delete(); $user->delete(); $datatype->delete(); unset($documenttype); unset($document); unset($property); unset($tab); unset($view); unset($layout); unset($user); unset($datatype); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { $this->init(); $this->view = ViewModel::fromArray(array('name' => 'View', 'identifier' => 'ViewIdentifier', 'description' => 'Description', 'content' => '')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'View', 'identifier' => 'LayoutIdentifier', 'description' => 'Description', 'content' => '')); $this->layout->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'DocumentType', 'description' => 'description', 'icon_id' => 1, 'default_view_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->documentType->setDependencies(array($this->documentType->getId())); $this->documentType->save(); $this->datatype = DatatypeModel::fromArray(array('name' => 'DatatypeTest', 'model' => 'Textstring')); $this->datatype->save(); $this->tabModel = TabModel::fromArray(array('name' => 'test', 'description' => 'test', 'document_type_id' => $this->documentType->getId())); $this->tabModel->save(); $this->property = PropertyModel::fromArray(array('name' => 'test', 'identifier' => 'test', 'description' => 'test', 'tab_id' => $this->tabModel->getId(), 'datatype_id' => $this->datatype->getId(), 'is_required' => true)); $this->property->save(); $this->config = Registry::get('Application')->getServiceManager()->get('CoreConfig'); $this->getApplicationServiceLocator()->get('ViewTemplatePathStack')->addPath(GC_TEMPLATE_PATH); $this->getApplicationServiceLocator()->get('Auth')->clearIdentity(); }
protected function createContent() { $this->view = ViewModel::fromArray(array('name' => 'View', 'identifier' => 'ViewContentIdentifier', 'description' => 'Description', 'content' => 'Content of the webpage <br/>This is my view')); $this->view->save(); $this->layout = LayoutModel::fromArray(array('name' => 'Layout', 'identifier' => 'LayoutContentIdentifier', 'description' => 'Description', 'content' => '<?php echo $this->content; ')); $this->layout->save(); $this->script = ScriptModel::fromArray(array('name' => 'Script', 'identifier' => 'ScriptContentIdentifier', 'description' => 'Description', 'content' => '')); $this->script->save(); $this->documentType = DocumentTypeModel::fromArray(array('name' => 'DocumentType', 'description' => 'description', 'icon_id' => 1, 'default_view_id' => $this->view->getId(), 'user_id' => $this->user->getId())); $this->documentType->save(); $this->documentType->setDependencies(array($this->documentType->getId())); $this->documentType->addView($this->view->getId()); $this->documentType->save(); $this->datatype = DatatypeModel::fromArray(array('name' => 'DatatypeTest', 'model' => 'Textstring')); $this->datatype->save(); $this->tabModel = TabModel::fromArray(array('name' => 'test', 'description' => 'test', 'document_type_id' => $this->documentType->getId())); $this->tabModel->save(); $this->property = PropertyModel::fromArray(array('name' => 'test', 'identifier' => 'azd', 'description' => 'test', 'tab_id' => $this->tabModel->getId(), 'datatype_id' => $this->datatype->getId(), 'is_required' => true)); $this->property->save(); $this->document = DocumentModel::fromArray(array('name' => 'test', 'url_key' => '', 'status' => DocumentModel::STATUS_ENABLE, '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->property->setDocumentId($this->document->getId()); $this->property->setValue('string'); $this->property->saveValue(); }
/** * Test * * @return void */ public function testDeleteAction() { $datatypeModel = DatatypeModel::fromArray(array('name' => 'LayoutName', 'model' => 'Textstring')); $datatypeModel->save(); $this->dispatch('/admin/development/datatype/delete/' . $datatypeModel->getId()); $this->assertResponseStatusCode(200); $this->assertModuleName('GcDevelopment'); $this->assertControllerName('DatatypeController'); $this->assertControllerClass('DatatypeController'); $this->assertMatchedRouteName('development/datatype/delete'); $datatypeModel->delete(); }
/** * 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 testSaveWithWrongValues() { $this->setExpectedException('Gc\\Exception'); $model = $this->object->fromArray(array('name' => 'ModelTest', 'prevalue_value' => '', 'description' => 'ModelTest')); $this->assertFalse($model->save()); }