Inheritance: extends ArrayObjec\ArrayObject
Ejemplo n.º 1
0
 /**
  * Test
  *
  * @return void
  */
 public function testInvokeUnsecure()
 {
     $coreConfig = Registry::get('Application')->getServiceManager()->get('CoreConfig');
     $basePath = $coreConfig->setValue('force_backend_ssl', 0);
     $basePath = $coreConfig->setValue('unsecure_cdn_base_path', 'http://got-cms.com');
     $this->assertEquals('http://got-cms.com/test', $this->object->__invoke('test'));
 }
Ejemplo n.º 2
0
 /**
  * Returns true if the $index is a named value in the registry,
  * or false if $index was not found in the registry.
  *
  * @param string $index Index
  *
  * @return boolean
  */
 public static function isRegistered($index)
 {
     if (self::$registry === null) {
         return false;
     }
     return self::$registry->offsetExists($index);
 }
Ejemplo n.º 3
0
 /**
  * Test
  *
  * @return void
  */
 public function testOnBootstrap()
 {
     $this->assertTrue($this->object->install());
     $this->assertTrue($this->object->update('0.1.0'));
     $this->assertNull($this->object->onBootstrap(Registry::get('Application')->getMvcEvent()));
     $this->assertTrue($this->object->uninstall());
     StaticEventManager::resetInstance();
 }
Ejemplo n.º 4
0
 /**
  * Constructor, initialize documents
  *
  * @param integer $documentId   Document id
  * @param boolean $activeBranch Use active branch or not
  */
 public function __construct($documentId = 0, $activeBranch = false)
 {
     $documents = new Document\Collection();
     $documents->load($documentId);
     $this->documents = $documents->getDocuments();
     $this->requestUri = Registry::get('Application')->getRequest()->getUri()->getPath();
     $this->useActiveBranch = (bool) $activeBranch;
 }
Ejemplo n.º 5
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     $serviceManager = Registry::get('Application')->getServiceManager();
     $renderer = $serviceManager->get('Zend\\View\\Renderer\\PhpRenderer');
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('currentDocument', Model::fromArray(array('id' => 1)));
     $serviceManager->setAllowOverride(false);
     $this->object = new CurrentDocument($serviceManager);
 }
Ejemplo n.º 6
0
 /**
  * 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);
 }
Ejemplo n.º 7
0
 /**
  * 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();
 }
Ejemplo n.º 8
0
 public function setUp()
 {
     $this->addthis = Mockery::mock('Social\\Model\\AddThis');
     $this->addthis->shouldReceive('getConfig')->once()->andReturn(array('profile_id' => '', 'username' => '', 'password' => '', 'show_stats' => '1', 'language' => 'fr', 'data_ga_property_id' => 'test', 'data_track_clickback' => '1', 'data_track_addressbar' => '1', 'config_json' => '', 'widgets' => array(array('name' => 'blog', 'identifier' => 'custom_string', 'settings' => 'custom_string', 'custom_string' => '<!-- AddThis Button BEGIN -->' . '<div class="addthis_toolbox addthis_default_style">' . '<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>' . '<a class="addthis_button_tweet"></a>' . '<a class="addthis_button_pinterest_pinit" pi:pinit:layout="horizontal"></a>' . '<a class="addthis_counter addthis_pill_style"></a>' . '</div>', 'chosen_list' => ''), array('name' => 'something', 'identifier' => 'something', 'settings' => 'nothing', 'custom_string' => '', 'chosen_list' => ''), array('name' => 'large_toolbox', 'identifier' => 'large_toolbox', 'settings' => 'large_toolbox', 'custom_string' => '', 'chosen_list' => 'facebook, twitter, pinterest_share, advqr, google_plusone_share, compact, counter'), array('name' => 'fb_tw_p1_sc', 'identifier' => 'fb_tw_p1_sc', 'settings' => 'fb_tw_p1_sc', 'custom_string' => '', 'chosen_list' => 'facebook, twitter, pinterest_share, google_plusone, google_plusone_share, compact, counter'), array('name' => 'large_toolbox_without_chosen_list', 'identifier' => 'large_toolbox_without_chosen_list', 'settings' => 'large_toolbox', 'custom_string' => '', 'chosen_list' => ''), array('name' => 'small_toolbox', 'identifier' => 'small_toolbox', 'settings' => 'small_toolbox', 'custom_string' => '', 'chosen_list' => 'facebook, twitter, pinterest_share, advqr, google_plusone_share, compact, counter')), 'addthis_show_stats' => true, 'addthis_append_data' => true, 'addthis_copytracking1' => false, 'addthis_copytracking2' => false, 'addthis_brand' => '', 'addthis_language' => 'fr', 'custom_size' => '', 'custom_services' => '', 'custom_preferred' => '', 'custom_more' => '', 'custom_string' => '', 'json_config' => '{"language":"fr"}'));
     $this->addthis->shouldReceive('getDefaultStyles')->once()->andReturn(array('large_toolbox' => array('src' => '<div class="addthis_toolbox addthis_default_style addthis_32x32_style" %1$s>' . '<a class="addthis_button_facebook"></a><a class="addthis_button_twitter"></a>' . '<a class="addthis_button_email"></a><a class="addthis_button_pinterest_share"></a>' . '<a class="addthis_button_compact"></a><a class="addthis_counter addthis_bubble_style">' . '</a></div>', 'img' => 'toolbox-large.png', 'name' => 'Large Toolbox'), 'small_toolbox' => array('src' => '<div class="addthis_toolbox addthis_default_style addthis_" %1$s>' . '<a class="addthis_button_facebook"></a><a class="addthis_button_twitter"></a>' . '<a class="addthis_button_email"></a><a class="addthis_button_pinterest_share"></a>' . '<a class="addthis_button_compact"></a><a class="addthis_counter addthis_bubble_style">' . '</a></div>', 'img' => 'toolbox-small.png', 'name' => 'Small Toolbox'), 'fb_tw_p1_sc' => array('src' => '<div class="addthis_toolbox addthis_default_style" %1$s>' . '<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>' . '<a class="addthis_button_tweet"></a><a class="addthis_button_pinterest_pinit"></a>' . '<a class="addthis_counter addthis_pill_style"></a></div>', 'img' => 'horizontal_share_rect.png', 'name' => 'Like, Tweet, +1, Share'), 'button' => array('src' => '<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=' . Model\AddThis::ADDTHIS_VERSION . '" %1$s><img src="//cache.addthis.com/cachefly/' . 'static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" ' . 'style="border:0"/></a></div>', 'img' => 'horizontal_share.png', 'name' => 'Classic Share Button'), 'custom_string' => array('name' => 'Custom string')));
     $serviceManager = Registry::get('Application')->getServiceManager();
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('CurrentDocument', DocumentModel::fromArray(array('id' => 1, 'url_key' => 'test', 'name' => 'Test')));
     $serviceManager->setService('AddThisModel', $this->addthis);
     $serviceManager->setAllowOverride(false);
     $this->object = new AddThisWidget();
 }
Ejemplo n.º 9
0
 /**
  * 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();
 }
Ejemplo n.º 10
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     $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', DocumentModel::fromArray(array('id' => 1)));
     $serviceManager->setAllowOverride(false);
     $this->object = $this->renderer->plugin('modulePlugin');
     $this->module = ModuleModel::fromArray(array('name' => 'Blog'));
     $this->module->save();
 }
Ejemplo n.º 11
0
 /**
  * Render treeview html
  *
  * @param array   $treeviewData Contains data as array
  * @param boolean $init         Initialize
  *
  * @return string
  */
 public static function render(array $treeviewData = array(), $init = true)
 {
     $html = '';
     if ($init) {
         $html .= '<div id="browser">';
     }
     $html .= '<ul>';
     foreach ($treeviewData as $iterator) {
         if (!$iterator instanceof IterableInterface) {
             continue;
         }
         $children = $iterator->getChildren();
         $hasChildren = !empty($children);
         $html .= '<li id="' . $iterator->getIterableId() . '"';
         if ($hasChildren) {
             $rel = ' class="folder"';
             $ins = '<ins class="jstree-icon">&nbsp;</ins>';
             $renderChildren = self::render($children, false);
         } else {
             $renderChildren = '';
             $rel = ' class="default"';
             $ins = '';
             $requestUri = Registry::get('Application')->getRequest()->getUri()->getPath();
             if ($requestUri == $iterator->getEditUrl()) {
                 $rel = ' class="default active"';
             }
         }
         $html .= $rel . '>' . $ins;
         $html .= self::renderLink($iterator);
         $html .= self::renderIcon($iterator);
         $html .= $iterator->getName() . '</a>';
         $html .= $renderChildren;
         $html .= '</li>';
     }
     $html .= '</ul>';
     if ($init) {
         $html .= '</div>';
     }
     return $html;
 }
Ejemplo n.º 12
0
 /**
  * Retrieve Service Manager
  *
  * @return ServiceManager
  */
 public function getServiceLocator()
 {
     return Registry::get('Application')->getServiceManager();
 }
Ejemplo n.º 13
0
 /**
  * Test
  *
  * @return void
  */
 public function testRemoveElement()
 {
     $mvcEvent = Registry::get('Application')->getMvcEvent();
     $mvcEvent->setTarget($this->document);
     //Create xml
     $this->assertNull($this->object->addElement($mvcEvent));
     //Delete Element
     $this->assertNull($this->object->removeElement($mvcEvent));
 }
Ejemplo n.º 14
0
 /**
  * Test
  *
  * @return void
  */
 public function testGetConfig()
 {
     $coreConfig = Registry::get('Application')->getServiceManager()->get('CoreConfig');
     $coreConfig->setValue('debug_is_active', 1);
     $this->assertInternalType('array', $this->object->getConfig());
 }
Ejemplo n.º 15
0
 /**
  * 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->object = new Config(Registry::get('Application')->getServiceManager()->get('CoreConfig'));
 }
Ejemplo n.º 16
0
 /**
  * Render info file to html
  *
  * @return string|false
  */
 public function render()
 {
     $infos = $this->getInfos();
     if (empty($infos) or !is_array($infos)) {
         return false;
     }
     $translator = Registry::get('Application')->getServiceManager()->get('MvcTranslator');
     $escaper = Registry::get('Application')->getServiceManager()->get('ViewManager')->getHelperManager()->get('escapehtml');
     $return = '<dl>';
     foreach ($infos as $key => $info) {
         if (!empty($this->optionsArray[$key])) {
             $return .= sprintf('<dt>%s</dt>', $translator->translate($this->optionsArray[$key]));
             if (!is_array($info)) {
                 $info = array($info);
             }
             foreach ($info as $value) {
                 $return .= sprintf('<dd>%s</dd>', $escaper($value));
             }
         } elseif (!empty($this->optionsString[$key])) {
             $return .= sprintf('<dt>%s</dt>', $translator->translate($this->optionsString[$key]));
             $return .= sprintf('<dd>%s</dd>', $escaper($info));
         } elseif (!empty($this->optionsLinks[$key])) {
             $return .= sprintf('<dt>%s</dt>', $translator->translate($this->optionsLinks[$key]));
             $return .= sprintf('<dd><a href="%s">%s</a></dd>', $escaper($info), $translator->translate($key));
         }
     }
     return $return .= '</dl>';
 }
Ejemplo n.º 17
0
 /**
  * Test
  *
  * @return void
  */
 public function testOnBootstrap()
 {
     $this->assertTrue($this->object->install());
     $this->assertNull($this->object->onBootstrap(Registry::get('Application')->getMvcEvent()));
     $this->assertTrue($this->object->uninstall());
 }
Ejemplo n.º 18
0
 /**
  * Send new password
  *
  * @param string $email Email address
  *
  * @return boolean
  */
 public function sendForgotPasswordEmail($email)
 {
     $row = $this->fetchRow($this->select(array('email' => $email)));
     if (!empty($row)) {
         $user = self::fromArray((array) $row);
         $passwordKey = sha1(uniqid());
         $user->setRetrievePasswordKey($passwordKey);
         $user->setRetrieveUpdatedAt(new Expression('NOW()'));
         $user->save();
         $serviceManager = Registry::get('Application')->getServiceManager();
         $message = $serviceManager->get('MvcTranslator')->translate('To reset your password follow this link but be careful ' . 'you only have one hour before the link expires:');
         $message .= '<br>';
         $message .= Registry::get('Application')->getMvcEvent()->getRouter()->assemble(array('id' => $user->getId(), 'key' => $passwordKey), array('force_canonical' => true, 'name' => 'config/user/forgot-password-key'));
         $mail = new Mail('utf-8', $message, $serviceManager->get('CoreConfig')->getValue('mail_from'), $user->getEmail());
         $mail->send();
         return true;
     }
     return false;
 }
Ejemplo n.º 19
0
 /**
  * Test
  *
  * @return void
  */
 public function testSaveWithWrongValues()
 {
     $configuration = Registry::get('Application')->getConfig();
     if ($configuration['db']['driver'] == 'pdo_mysql') {
         $this->markTestSkipped('Mysql does not thrown exception.');
     }
     $this->setExpectedException('Gc\\Exception');
     $this->object->setIdentifier(null);
     $this->assertFalse($this->object->save());
 }
Ejemplo n.º 20
0
 protected function removeUser()
 {
     Registry::get('Application')->getServiceManager()->get('Auth')->clearIdentity();
     $this->user->delete();
     unset($this->user);
 }
Ejemplo n.º 21
0
 /**
  * Load upload editor
  *
  * @return string
  */
 public function load()
 {
     $parameters = $this->getConfig();
     $options = empty($parameters['options']) ? array() : $parameters['options'];
     $this->initScript();
     $fileList = array();
     $files = unserialize($this->getValue());
     if (!empty($files)) {
         $fileClass = new File();
         $fileClass->load($this->getProperty(), $this->getDatatype()->getDocument());
         foreach ($files as $fileData) {
             $fileObject = array();
             $fileObject['name'] = $fileData['value'];
             $fileObject['filename'] = $fileData['value'];
             $fileObject['thumbnail_url'] = $fileData['value'];
             $router = Registry::get('Application')->getMvcEvent()->getRouter();
             $fileObject['delete_url'] = $router->assemble(array('document_id' => $this->getDatatype()->getDocument()->getId(), 'property_id' => $this->getProperty()->getId(), 'file' => base64_encode($fileData['value'])), array('name' => 'content/media/remove'));
             $fileObject['delete_type'] = 'DELETE';
             $fileList[] = $fileObject;
         }
     }
     return $this->addPath(__DIR__)->render('upload-editor.phtml', array('property' => $this->getProperty(), 'uploadUrl' => $this->getUploadUrl(), 'name' => $this->getName(), 'files' => json_encode($fileList), 'options' => $options));
 }
Ejemplo n.º 22
0
 /**
  * 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);
 }
Ejemplo n.º 23
0
 /**
  * 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->renderer = new PhpRenderer();
     $renderer = Registry::get('Application')->getServiceManager()->get('Zend\\View\\Renderer\\PhpRenderer');
     $this->renderer->setHelperPluginManager(clone $renderer->getHelperPluginManager());
     $this->renderer->layout()->currentDocument = DocumentModel::fromArray(array('id' => $this->document->getId()));
     $this->module = ModuleModel::fromArray(array('name' => 'Blog'));
     $this->module->save();
     $this->boostrap = new Module();
     $this->boostrap->install();
     $this->object = new CommentList();
     $this->object->plugin('layout')->setController($this->getMockForAbstractClass('\\Zend\\Mvc\\Controller\\AbstractController'));
 }
Ejemplo n.º 24
0
 /**
  * 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->element = new Element\MultiCheckbox('foo');
     $this->object = new FormMultiCheckbox();
     $this->object->setTranslator(Registry::get('Application')->getServiceManager()->get('MvcTranslator'));
 }
Ejemplo n.º 25
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @return void
  */
 public function tearDown()
 {
     StaticEventManager::resetInstance();
     ModuleModel::uninstall(Registry::get('Application')->getServiceManager()->get('CustomModules')->getModule('Social'), ModuleModel::fromName('Social'));
     parent::tearDown();
 }
Ejemplo n.º 26
0
 /**
  * Test
  *
  * @return void
  */
 public function testOnDispatchWithIdentityAndAdminRole()
 {
     $userModel = UserModel::fromArray(array('lastname' => 'Test', 'firstname' => 'Test', 'email' => '*****@*****.**', 'login' => 'login-test', 'user_acl_role_id' => 1));
     $userModel->setPassword('password-test');
     $userModel->save();
     $userModel->authenticate('login-test', 'password-test');
     $routeMatch = new RouteMatch(array());
     $routeMatch->setMatchedRouteName('cms');
     $this->object->getEvent()->setRouteMatch($routeMatch);
     $this->assertInstanceOf('Zend\\View\\Model\\ViewModel', $this->object->dispatch(Registry::get('Application')->getRequest(), null));
     $userModel->delete();
 }
Ejemplo n.º 27
0
 /**
  * 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);
 }
Ejemplo n.º 28
0
 /**
  * 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);
 }
Ejemplo n.º 29
0
 /**
  * Test
  *
  * @return void
  */
 public function testDeleteWithWrongId()
 {
     $configuration = Registry::get('Application')->getConfig();
     if ($configuration['db']['driver'] == 'pdo_mysql') {
         $this->markTestSkipped('Mysql does not thrown exception.');
     }
     $this->setExpectedException('\\Gc\\Exception');
     $model = new Model();
     $model->setId('undefined');
     $this->assertFalse($model->delete());
 }
Ejemplo n.º 30
0
 /**
  * Test
  *
  * @return void
  */
 public function testGetDocument()
 {
     $parent = new ViewModel();
     $parent->setTemplate('layout');
     $view = new View();
     $renderer = Registry::get('Application')->getServiceManager()->get('Zend\\View\\Renderer\\PhpRenderer');
     $view->setHelperPluginManager($renderer->getHelperPluginManager());
     $view->plugin('view_model')->setRoot($parent);
     $view->resolver()->addPath(__DIR__ . '/_files/views');
     $this->object->setView($view);
     $this->assertInstanceOf('Gc\\Document\\Model', $this->object->getDocument());
 }