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();
     $this->helper = new ExhibitBuilder_IntegrationHelper();
     $this->helper->setUpPlugin();
     $this->helper->createNewExhibits(1, 0, 0, 0);
 }
 public function setUp()
 {
     parent::setUp();
     $pluginHelper = new Omeka_Test_Helper_Plugin();
     $pluginHelper->setUp('RecordRelations');
     $this->_createRelation();
 }
Ejemplo n.º 4
0
 public function setUp()
 {
     parent::setUp();
     $this->_defaultTagLimit = 10;
     $this->_itemToTag = new Item();
     $this->_itemToTag->setArray(array('title' => 'Thing'));
     $this->_itemToTag->save();
 }
Ejemplo n.º 5
0
 public function setUp()
 {
     parent::setUp();
     $acl = get_acl();
     $acl->addResource('TestResource');
     $acl->allow(null, 'TestResource', 'allowedPrivilege');
     $acl->deny(null, 'TestResource', 'deniedPrivilege');
 }
    /**
     * Clear testing records. This needs to be done manually since the records
     * table is MyISAM (for spatial/fulltext indexes), and doesn't get cleared
     * with the rest of the tables when the transaction is rolled back.
     */
    public function tearDown()
    {
        $this->db->query(<<<SQL
        DELETE FROM {$this->db->prefix}neatline_records WHERE 1=1
SQL
);
        parent::tearDown();
    }
 public function tearDown()
 {
     // TODO Why is this needed for last tests?
     $this->_deleteAllRecords();
     // By construction, cached files aren't deleted when plugin is removed.
     $this->_removeCachedFiles();
     parent::tearDown();
 }
 /**
  * Clear the Solr index.
  */
 public function tearDown()
 {
     try {
         SolrSearch_Helpers_Index::deleteAll();
     } catch (Exception $e) {
     }
     parent::tearDown();
 }
Ejemplo n.º 9
0
 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());
 }
 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;
 }
 /**
  * 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;
 }
Ejemplo n.º 12
0
 public function dispatch($url = null, $callback = null)
 {
     if ($callback) {
         $callback = (array) $callback;
         foreach ($callback as $c) {
             $this->{$c}();
         }
     }
     return parent::dispatch($url);
 }
 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();
 }
Ejemplo n.º 14
0
 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();
 }
Ejemplo n.º 15
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')));
 }
Ejemplo n.º 16
0
 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__');
 }
Ejemplo n.º 17
0
 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;
 }
 /**
  * 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);
 }
Ejemplo n.º 19
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;
 }
 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');
 }
 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();
 }
Ejemplo n.º 22
0
 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');
 }
Ejemplo n.º 23
0
 public function setUp()
 {
     // Somehow a previous GET request is leaking into these tests.
     $_GET = array();
     parent::setUp();
 }
Ejemplo n.º 24
0
 public function tearDown()
 {
     release_object($this->super);
     release_object($this->admin);
     parent::tearDown();
 }
Ejemplo n.º 25
0
 public function setUp()
 {
     parent::setUp();
     $this->_nav = new Omeka_Navigation();
     $this->_beforePages = array();
 }
Ejemplo n.º 26
0
 public function setUp()
 {
     parent::setUp();
     $this->messenger = new Omeka_Controller_Action_Helper_FlashMessenger();
 }
Ejemplo n.º 27
0
 public function setUp()
 {
     parent::setUp();
     $this->adminUser = $this->_addNewUserWithRole('admin');
     $this->superUser = $this->_addNewUserWithRole('super');
 }
Ejemplo n.º 28
0
 public function setUp()
 {
     parent::setUp();
     $this->_authenticateUser($this->_getDefaultUser());
     // login as admin
 }
Ejemplo n.º 29
0
 public function setUp()
 {
     parent::setUp();
     $this->builder = new Builder_Collection($this->db);
 }
Ejemplo n.º 30
0
 public function tearDown()
 {
     release_object($this->_users);
     release_object($this->_items);
     parent::tearDown();
 }