public function setUp()
 {
     parent::setUp();
     $pluginHelper = new Omeka_Test_Helper_Plugin();
     $pluginHelper->setUp(self::PLUGIN_NAME);
     define('TEST_FILES_DIR', ARCHIVE_REPERTORY_DIR . '/tests/suite/_files');
     // Add constraints if derivatives have been added in the config file.
     $fileDerivatives = Zend_Registry::get('bootstrap')->getResource('Config')->fileDerivatives;
     if (!empty($fileDerivatives) && !empty($fileDerivatives->paths)) {
         foreach ($fileDerivatives->paths->toArray() as $type => $path) {
             set_option($type . '_constraint', 1);
         }
     }
     // Prepare config and set a test temporary storage in registry.
     $config = new Omeka_Test_Resource_Config();
     $configIni = $config->init();
     if (isset($configIni->paths->imagemagick)) {
         $this->convertDir = $configIni->paths->imagemagick;
     } else {
         $this->convertDir = dirname(`which convert`);
     }
     $storage = Zend_Registry::get('storage');
     $adapter = $storage->getAdapter();
     $adapterOptions = $adapter->getOptions();
     $this->_storagePath = $adapterOptions['localDir'];
     // Set default strategy for the creation of derivative files.
     $this->strategy = new Omeka_File_Derivative_Strategy_ExternalImageMagick();
     $this->strategy->setOptions(array('path_to_convert' => $this->convertDir));
     $this->creator = new Omeka_File_Derivative_Creator();
     $this->creator->setStrategy($this->strategy);
     Zend_Registry::set('file_derivative_creator', $this->creator);
     // Create one item on which attach files.
     $this->item = insert_item(array('public' => true));
     set_option('disable_default_file_validation', 1);
 }
 public function setUp()
 {
     parent::setUp();
     $pluginHelper = new Omeka_Test_Helper_Plugin();
     $pluginHelper->setUp('RecordRelations');
     $this->_createRelation();
 }
 public function setUp()
 {
     parent::setUp();
     $this->helper = new ExhibitBuilder_IntegrationHelper();
     $this->helper->setUpPlugin();
     $this->helper->createNewExhibits(1, 0, 0, 0);
 }
 public function setUp()
 {
     parent::setUp();
     // All tests are done with local paths to simplify them (no http layer).
     if ($this->_allowLocalPaths) {
         $settings = (object) array('local_folders' => (object) array('allow' => '1', 'check_realpath' => '0', 'base_path' => TEST_FILES_DIR));
         Zend_Registry::set('oai_pmh_static_repository', $settings);
     } else {
         $settings = (object) array('local_folders' => (object) array('allow' => '0', 'check_realpath' => '0', 'base_path' => '/var/path/to/the/folder'));
         Zend_Registry::set('oai_pmh_static_repository', $settings);
     }
     defined('TEST_FILES_WEB') or define('TEST_FILES_WEB', WEB_ROOT . DIRECTORY_SEPARATOR . basename(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'suite' . DIRECTORY_SEPARATOR . '_files');
     $pluginHelper = new Omeka_Test_Helper_Plugin();
     // ArchiveDocument is a required plugin.
     $path = PLUGIN_DIR . DIRECTORY_SEPARATOR . 'ArchiveDocument' . DIRECTORY_SEPARATOR . 'ArchiveDocumentPlugin.php';
     $this->assertTrue(is_file($path) && filesize($path), __('This plugin requires ArchiveDocument.'));
     $pluginHelper->setUp('ArchiveDocument');
     $pluginHelper->setUp(self::PLUGIN_NAME);
     // OcrElementSet is an optional plugin, but required for some tests.
     try {
         $pluginHelper->setUp('OcrElementSet');
     } catch (Omeka_Plugin_Loader_Exception $e) {
     }
     // Allow extensions "xml" and "json".
     $whiteList = get_option(Omeka_Validate_File_Extension::WHITELIST_OPTION) . ',xml,json';
     set_option(Omeka_Validate_File_Extension::WHITELIST_OPTION, $whiteList);
     // Allow media types for "xml" and "json".
     $whiteList = get_option(Omeka_Validate_File_MimeType::WHITELIST_OPTION) . ',application/xml,text/xml,application/json';
     set_option(Omeka_Validate_File_MimeType::WHITELIST_OPTION, $whiteList);
 }
 public function setUp()
 {
     parent::setUp();
     $acl = get_acl();
     $acl->addResource('TestResource');
     $acl->allow(null, 'TestResource', 'allowedPrivilege');
     $acl->deny(null, 'TestResource', 'deniedPrivilege');
 }
 public function setUp()
 {
     parent::setUp();
     $this->_defaultTagLimit = 10;
     $this->_itemToTag = new Item();
     $this->_itemToTag->setArray(array('title' => 'Thing'));
     $this->_itemToTag->save();
 }
 public function setUp()
 {
     $themeDir = PUBLIC_THEME_DIR . '/' . self::THEME;
     if (!is_dir($themeDir) || !file_exists($themeDir . '/config.ini')) {
         $this->markTestSkipped("Cannot test ThemesController without the '" . self::THEME . "' theme.");
     }
     parent::setUp();
     $this->_authenticateUser($this->_getDefaultUser());
 }
 /**
  * Spin up the plugins and prepare the database.
  *
  * @return void.
  */
 public function setUp()
 {
     parent::setUp();
     $this->user = $this->db->getTable('User')->find(1);
     $this->_authenticateUser($this->user);
     // Set up Neatline Time.
     $plugin_helper = new Omeka_Test_Helper_Plugin();
     $plugin_helper->setUp('NeatlineTime');
     Omeka_Test_Resource_Db::$runInstaller = true;
 }
 public function setUp()
 {
     parent::setUp();
     // Authenticate and set the current user
     $this->user = $this->db->getTable('User')->find(1);
     $this->_authenticateUser($this->user);
     $pluginHelper = new Omeka_Test_Helper_Plugin();
     $pluginHelper->setUp(self::PLUGIN_NAME);
     Omeka_Test_Resource_Db::$runInstaller = true;
 }
Exemple #10
0
 public function setUp()
 {
     parent::setUp();
     $this->super = new User();
     $this->super->role = 'super';
     $this->super->id = 1;
     $this->admin = new User();
     $this->admin->role = 'admin';
     $this->admin->id = 2;
 }
 public function setUp()
 {
     parent::setUp();
     $pluginHelper = new Omeka_Test_Helper_Plugin();
     $pluginHelper->setUp('UserProfiles');
     $pluginHelper->setUp('RecordRelations');
     $user = $this->_getDefaultUser();
     $this->_authenticateUser($user);
     $this->_setupType();
     $this->_setupProfile();
 }
 public function setUp()
 {
     parent::setUp();
     $this->user = $this->_getDefaultUser();
     $this->salt = $this->user->salt;
     // The user is attempting to change their own password.
     // Pretend that this user is not a super user.
     $this->_authenticateUser($this->user);
     $this->user->role = 'admin';
     $this->user->save();
 }
 public function setUp()
 {
     parent::setUp();
     // Set the ACL to allow access to users.
     $this->acl = $this->application->getBootstrap()->acl;
     $this->acl->allow(null, 'Users');
     $this->db = $this->application->getBootstrap()->db;
     $this->user = $this->db->getTable('User')->find(1);
     $this->_authenticateUser($this->user);
     // Hack: add_plugin_hook() still doesn't allow arbitrary namespaces.
     $this->pluginbroker->setCurrentPluginDirName('__global__');
 }
Exemple #14
0
 public function setUp()
 {
     parent::setUp();
     $view = new Omeka_View();
     $this->helper = $view->getHelper('RecordUrl');
     $this->mockString = $this->getMock('Item', array('getRecordUrl'), array(), '', false);
     $this->mockString->expects($this->any())->method('getRecordUrl')->will($this->returnValue('/boring-url'));
     $this->mockQuery = $this->getMock('Item', array('getRecordUrl'), array(), '', false);
     $this->mockQuery->expects($this->any())->method('getRecordUrl')->will($this->returnValue('/boring-url?existing=baz'));
     $this->mockRoute = $this->getMock('Item', array('getRecordUrl'), array(), '', false);
     $this->mockRoute->expects($this->any())->method('getRecordUrl')->will($this->returnValue(array('controller' => 'items', 'action' => 'browse')));
 }
 /**
  * Spin up the plugins and prepare the database.
  *
  * @return void.
  */
 public function setUpPlugin()
 {
     parent::setUp();
     $this->user = $this->db->getTable('User')->find(1);
     $this->_authenticateUser($this->user);
     $this->servicesTable = $this->db->getTable('NeatlineMapsService');
     $this->serversTable = $this->db->getTable('NeatlineMapsServer');
     // Set up Neatline WMS.
     $plugin_broker = get_plugin_broker();
     $this->_addHooksAndFilters($plugin_broker, 'NeatlineMaps');
     $plugin_helper = new Omeka_Test_Helper_Plugin();
     $plugin_helper->setUp('NeatlineMaps');
     $this->_dbHelper = Omeka_Test_Helper_Db::factory($this->core);
 }
 public function setUp()
 {
     parent::setUp();
     $plugin = $this->db->getTable('Plugin')->find(1);
     if ($plugin) {
         $plugin->delete();
     }
     $plugin = new Plugin();
     $plugin->setDirectoryName(self::PLUGIN_NAME);
     $plugin->setActive(true);
     $plugin->setDbVersion('1.0');
     $plugin->save();
     $this->plugin = $plugin;
 }
Exemple #17
0
 public function setUp()
 {
     parent::setUp();
     $super = new User();
     $super->role = 'super';
     $super->id = 1;
     $contributor = new User();
     $contributor->role = 'contributor';
     $contributor->id = 2;
     $researcher = new User();
     $researcher->role = 'researcher';
     $researcher->id = 3;
     $this->_users = array('super' => $super, 'contributor' => $contributor, 'researcher' => $researcher);
     $this->_collections = array('addedBySelf' => $this->_getMockCollection(true), 'notAddedBySelf' => $this->_getMockCollection(false));
 }
Exemple #18
0
 public function setUp()
 {
     parent::setUp();
     // Set the ACL to allow access to collections
     $this->acl = $this->application->getBootstrap()->acl;
     $this->acl->allow(null, 'Collections');
     $this->db = $this->application->getBootstrap()->db;
     $this->user = $this->db->getTable('User')->find(1);
     $this->_authenticateUser($this->user);
     // Create a collection
     $collection = new Collection();
     $collection->public = true;
     $collection->save();
     $this->collection = $collection;
 }
 /**
  * Log in, create plugin helper.
  */
 public function setUp()
 {
     parent::setUp();
     // Authenticate and set the current user.
     $this->user = $this->db->getTable('User')->find(1);
     $this->_authenticateUser($this->user);
     // Install plugins.
     $this->helper = new Omeka_Test_Helper_Plugin();
     $this->helper->setUp('Neatline');
     // Install sibling plugins.
     $this->_installSiblingPlugins();
     // Alias Neatline tables.
     $this->_exhibits = $this->db->getTable('NeatlineExhibit');
     $this->_records = $this->db->getTable('NeatlineRecord');
 }
 public function setUp()
 {
     parent::setUp();
     $this->_view = get_view();
     $this->_view->addHelperPath(CLEAN_URL_DIR . '/views/helpers', self::PLUGIN_NAME . '_View_Helper_');
     $pluginHelper = new Omeka_Test_Helper_Plugin();
     $pluginHelper->setUp(self::PLUGIN_NAME);
     // Add constraints if derivatives have been added in the config file.
     $fileDerivatives = Zend_Registry::get('bootstrap')->getResource('Config')->fileDerivatives;
     if (!empty($fileDerivatives) && !empty($fileDerivatives->paths)) {
         foreach ($fileDerivatives->paths->toArray() as $type => $path) {
             set_option($type . '_constraint', 1);
         }
     }
     $this->_prepareRecords();
     $this->_reloadRoutes();
 }
 public function setUp()
 {
     parent::setUp();
     $this->helper = new ExhibitBuilder_IntegrationHelper();
     $this->helper->setUpPlugin();
     $this->exhibit = $this->helper->createNewExhibit(true, false, 'Exhibit Title', 'Exhibit Description', 'Exhibit Credits', 'exhibit');
     $this->assertTrue($this->exhibit->exists());
     $maxPageCount = 3;
     $parentPage = null;
     for ($i = 1; $i <= $maxPageCount; $i++) {
         $exhibitPage = $this->helper->createNewExhibitPage($this->exhibit, $parentPage, 'Exhibit Page Title ' . $i, 'page' . $i, 1, 'text');
         $this->assertTrue($exhibitPage->exists());
         $parentPage = $exhibitPage;
     }
     $this->dispatch('exhibits/show/exhibit/page1/page2/page3');
     $this->basePageUrl = public_url('exhibits/show/exhibit');
 }
 /**
  * Install SolrSearch and prepare the database.
  */
 public function setUp()
 {
     parent::setUp();
     // Create and authenticate user.
     $this->user = $this->db->getTable('User')->find(1);
     $this->_authenticateUser($this->user);
     // Install up SolrSearch.
     $this->helper = new Omeka_Test_Helper_Plugin();
     $this->helper->setUp('SolrSearch');
     // Get tables.
     $this->fieldTable = $this->db->getTable('SolrSearchField');
     $this->elementSetTable = $this->db->getTable('ElementSet');
     $this->elementTable = $this->db->getTable('Element');
     $this->itemTypeTable = $this->db->getTable('ItemType');
     // Apply `solr.ini` values.
     $this->_applyTestingOptions();
     // Connect to Solr.
     $this->solr = SolrSearch_Helpers_Index::connect();
 }
Exemple #23
0
 public function setUp()
 {
     parent::setUp();
     $this->_authenticateUser($this->_getDefaultUser());
     $userRoles = array('admin', 'contributor', 'researcher');
     foreach ($userRoles as $role) {
         $user = new User();
         $userData = array('role' => $role, 'username' => $role, 'name' => "User {$role}", 'email' => $role . '@example.com');
         $user->setPostData($userData);
         $user->save();
         $this->_users[$role] = $user;
     }
     foreach ($userRoles as $role) {
         if ($role != 'researcher') {
             $item = $this->_createItem($role);
             $this->_items[$role] = $item;
         }
     }
     $this->_users['super'] = $this->_getDefaultUser();
     $this->_authenticateUser($this->_getDefaultUser());
 }
 public function setUp()
 {
     parent::setUp();
     $integrationHelper = new SimpleContactForm_IntegrationHelper();
     $integrationHelper->setUpPlugin();
     // Override existing options to ensure that ReCaptcha
     // config does not interfere with tests (CAPTCHA should be disabled in
     // test environment, though not in development/production).
     $bootstrap = $this->core->getBootstrap();
     $options = $bootstrap->options;
     unset($options[Omeka_Captcha::PUBLIC_KEY_OPTION]);
     unset($options[Omeka_Captcha::PRIVATE_KEY_OPTION]);
     $bootstrap->getContainer()->options = $options;
     $this->mailHelper = Omeka_Test_Helper_Mail::factory();
     $this->mailTo = Zend_Registry::get('test_config')->email->to;
     $this->mailAdmin = Zend_Registry::get('test_config')->email->administrator;
     $this->mailHelper->reset();
     $this->mailName = 'Jim Safley';
     $this->mailMessage = 'Lorem ipsum dolor sit amet.';
     $post = array('name' => $this->mailName, 'email' => $this->mailTo, 'message' => $this->mailMessage);
     $this->getRequest()->setPost($post);
     $this->getRequest()->setMethod('post');
     $this->dispatch('contact');
 }
Exemple #25
0
 public function setUp()
 {
     parent::setUp();
     $this->builder = new Builder_Collection($this->db);
 }
Exemple #26
0
 public function setUp()
 {
     parent::setUp();
     $this->_nav = new Omeka_Navigation();
     $this->_beforePages = array();
 }
 public function setUp()
 {
     parent::setUp();
     $this->messenger = new Omeka_Controller_Action_Helper_FlashMessenger();
 }
Exemple #28
0
 public function setUp()
 {
     parent::setUp();
     $this->adminUser = $this->_addNewUserWithRole('admin');
     $this->superUser = $this->_addNewUserWithRole('super');
 }
 public function setUp()
 {
     parent::setUp();
     $this->_authenticateUser($this->_getDefaultUser());
     // login as admin
 }
 public function setUp()
 {
     // Somehow a previous GET request is leaking into these tests.
     $_GET = array();
     parent::setUp();
 }