/**
  * Preparation work that is done before each test.
  * Test users, content types, nodes etc. are created.
  */
 function setUp($module = '')
 {
     if (empty($module)) {
         // Enable content access module
         parent::setUp('content_access');
     } else {
         // Enable content access module plus another module
         parent::setUp('content_access', $module);
         // Stop setup when module could not be enabled
         if (!module_exists($module)) {
             $this->pass('No ' . $module . ' module present, skipping test');
             return;
         }
     }
     // Create test user with seperate role
     $this->test_user = $this->drupalCreateUser();
     // Get the value of the new role
     // Needed in D7 because it's by default create two roles for new users
     // one role is Authenticated and the second is new default one
     // @see drupalCreateUser()
     foreach ($this->test_user->roles as $rid => $role) {
         if (!in_array($rid, array(DRUPAL_AUTHENTICATED_RID))) {
             $this->rid = $rid;
             break;
         }
     }
     // Create admin user
     $this->admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'grant content access', 'grant own content access', 'administer nodes', 'access administration pages'));
     $this->drupalLogin($this->admin_user);
     // Rebuild content access permissions
     node_access_rebuild();
     // Create test content type
     $this->content_type = $this->drupalCreateContentType();
 }
 /**
  * Preparation work that is done before each test.
  * Test users, content types, nodes etc. are created.
  */
 function setUp($module = '')
 {
     if (empty($module)) {
         // Enable content access module
         parent::setUp('content_access');
     } else {
         // Enable content access module plus another module
         parent::setUp('content_access', $module);
         // Stop setup when module could not be enabled
         if (!module_exists($module)) {
             return;
         }
     }
     // Create test user with seperate role
     $this->test_user = $this->drupalCreateUser();
     // Create admin user
     $this->admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'grant content access', 'grant own content access', 'administer nodes', 'access administration pages'));
     $this->drupalLogin($this->admin_user);
     // Rebuild content access permissions
     $this->drupalPost('admin/content/node-settings/rebuild', array(), t('Rebuild permissions'));
     // This would be nice to have - but it does not work in the current simpletest version
     // Create test content type
     //$content_type = $this->drupalCreateContentType();
     //$this->url_content_type_name = $content_type->type;
     //$this->url_content_type_name = str_replace('_', '-', $content_type->type);
     // Create test content type (the old way)
     $this->content_type_name = strtolower($this->randomName(5));
     $edit = array('name' => $this->content_type_name, 'type' => $this->content_type_name);
     $this->drupalPost('admin/content/types/add', $edit, t('Save content type'));
     $this->assertRaw(t('The content type %type has been added.', array('%type' => $this->content_type_name)), 'Test content type was added successfully: ' . $this->content_type_name);
     $this->url_content_type_name = str_replace('_', '-', $this->content_type_name);
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     $this->cookieFile = '/tmp/cookie.txt';
     $this->cookies = array();
     parent::setUp();
     // Overwrite mailing system settings (See Drupal issue 2279851).
     $this->mail_system = variable_get('mail_system');
     variable_set('mail_system', array('default-system' => 'oshaTestingMailSystem'));
 }
 public function setUp()
 {
     parent::setUp(array('collection', 'collection_field', 'xautoload', 'entity'));
     $field = array('active' => '1', 'cardinality' => '-1', 'deleted' => '0', 'entity_types' => array(), 'field_name' => 'field_collection', 'foreign keys' => array(), 'indexes' => array('collection' => array(0 => 'value')), 'locked' => '0', 'module' => 'collection_field', 'settings' => array(), 'translatable' => '0', 'type' => 'collection');
     field_create_field($field);
     $instance = array('bundle' => 'article', 'entity_type' => 'node', 'field_name' => 'field_collection', 'label' => 'Collection', 'widget' => array('module' => 'collections', 'type' => 'collection'), 'display' => array('default' => array('label' => 'hidden', 'settings' => array(), 'type' => 'hidden'), 'teaser' => array('label' => 'hidden', 'settings' => array(), 'type' => 'hidden')));
     field_create_instance($instance);
     $this->createCollection();
     $this->node = $this->createNode();
 }
示例#5
0
 function setUp()
 {
     $modules = func_get_args();
     if (isset($modules[0]) && is_array($modules[0])) {
         $modules = $modules[0];
     }
     parent::setUp($modules);
     variable_set('ldap_simpletest', 2);
     variable_set('ldap_help_watchdog_detail', 0);
     $this->createTestUserFields();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     // Support both an array of modules and a single module.
     $modules = func_get_args();
     if (isset($modules[0]) && is_array($modules[0])) {
         $modules = $modules[0];
     }
     $modules[] = 'service_container';
     parent::setUp($modules);
     \ServiceContainer::init();
     $this->container = \Drupal::getContainer();
 }
示例#7
0
 /**
  * Sets up modules for API tests, and saves the default branch for teardown.
  */
 function baseSetUp()
 {
     // This is restored in the tearDown() function.
     $this->default_branch = variable_get('api_default_branch', NULL);
     variable_del('api_default_branch');
     DrupalWebTestCase::setUp('drupal_queue', 'grammar_parser', 'ctools', 'api');
     include_once drupal_get_path('module', 'api') . '/api.admin.inc';
     include_once drupal_get_path('module', 'api') . '/parser.inc';
     drupal_queue_include();
     // Set up a super-user.
     $this->super_user = $this->drupalCreateUser(array('access API reference', 'administer API reference', 'access content', 'access administration pages', 'administer blocks', 'administer nodes'));
     $this->drupalLogin($this->super_user);
 }
示例#8
0
 /**
  * Sets up modules for API tests, and a super-user.
  *
  * @param array $extra_modules
  *   Extra modules to install.
  */
 function baseSetUp($extra_modules = array())
 {
     $modules = array_merge(array('api', 'ctools', 'gplib', 'node', 'comment', 'dblog', 'views'), $extra_modules);
     DrupalWebTestCase::setUp($modules);
     // Set the line break tag to nothing for most tests.
     variable_set('api_breaks_tag', '');
     // For debug purposes, visit the Recent Log Messages report page.
     $this->drupalGet('admin/reports/dblog');
     $this->verifyCounts(array('api_project' => 0, 'api_branch' => 0, 'api_documentation' => 0, 'node' => 0, 'comment' => 0, 'api_file' => 0, 'api_function' => 0, 'api_reference_storage' => 0, 'api_overrides' => 0, 'api_members' => 0, 'api_php_branch' => 1, 'api_php_documentation' => 0), 0, 'Immediately after install');
     // Set up a super-user.
     $this->super_user = $this->drupalCreateUser(array('access API reference', 'administer API reference', 'access content', 'access administration pages', 'administer blocks', 'administer nodes', 'access site reports', 'administer site configuration'));
     $this->drupalLogin($this->super_user);
 }
 function setUp()
 {
     parent::setUp('api', 'job_queue');
     include drupal_get_path('module', 'api') . '/api.admin.inc';
     include drupal_get_path('module', 'api') . '/parser.inc';
     // Make a branch for sample code.
     $branch->branch_name = '6';
     $branch->title = 'Testing 6';
     $branch->directory = drupal_get_path('module', 'api') . '/tests/sample';
     $branch = null;
     api_save_branch($branch);
     // Parse the code.
     api_update_all_branches();
     while (job_queue_dequeue()) {
     }
 }
示例#10
0
 /**
  * Setup the test enviroment
  */
 function setUp()
 {
     parent::setUp();
     // Create and log in an administrative user having access to the Full HTML
     // text format.
     $full_html_format = db_query_range('SELECT * FROM {filter_format} WHERE name = :name', 0, 1, array(':name' => 'Full HTML'))->fetchObject();
     $adminuser = $this->drupalCreateUser(array('administer blocks', filter_permission_name($full_html_format), 'access administration pages', 'access dashboard'));
     $this->drupalLogin($adminuser);
     // Define the existing regions.
     $this->regions = array();
     $this->regions[] = array('name' => 'header', 'class' => 'region region-header clearfix');
     $this->regions[] = array('name' => 'sidebar_first');
     $this->regions[] = array('name' => 'content');
     $this->regions[] = array('name' => 'sidebar_second');
     $this->regions[] = array('name' => 'footer');
 }
 /**
  * Setup the test.
  */
 function setUp()
 {
     parent::setUp('block_test');
     // Create an admin user, log in and enable test blocks.
     $this->admin_user = $this->drupalCreateUser(array('administer blocks', 'access administration pages'));
     $this->drupalLogin($this->admin_user);
     // Create additional users to test caching modes.
     $this->normal_user = $this->drupalCreateUser();
     $this->normal_user_alt = $this->drupalCreateUser();
     // Sync the roles, since drupalCreateUser() creates separate roles for
     // the same permission sets.
     user_save($this->normal_user_alt, array('roles' => $this->normal_user->roles));
     $this->normal_user_alt->roles = $this->normal_user->roles;
     // Enable block caching.
     variable_set('block_cache', TRUE);
     // Enable our test block.
     $edit['block_test_test_cache[region]'] = 'sidebar_first';
     $this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
 }
    protected function setUp() {
        // preparing list of modules
        $modules = func_get_args();
        if (isset($modules[0]) && is_array($modules[0])) {
            $modules = $modules[0];
        }
        // to enable test datasets
        $modules[] = 'gd_test';

        parent::setUp($modules);

        // 1) the property was set by init hook function
        // 2) the value was stored using drupal_static
        // 3) drupal_static_reset() was called by setUp()
        Sequence::registerDataSource(DrupalDatabaseEnvironmentMetaModelGenerator::$DATASOURCE_NAME__DEFAULT);

        // creating and populating test database
        $this->prepareTestDatabase();
    }
示例#13
0
 function setUp()
 {
     // Enable the module.
     parent::setUp('merci');
     $perms = user_permission_get_modules();
     $this->verbose('perms: ' . var_export($perms, TRUE));
     // Create admin user.
     $this->admin_user = $this->drupalCreateUser(array('administer nodes', 'bypass node access', 'administer content types', 'access administration pages', 'administer site configuration', 'view revisions', 'revert revisions', 'administer MERCI', 'manage reservations'));
     // Login the admin user.
     $this->drupalLogin($this->admin_user);
     $settings = array('merci_default_reservation_status' => '2', 'merci_max_days_advance_reservation' => '0', 'merci_saturday_is_weekend' => '1', 'merci_sunday_is_weekend' => '1', 'merci_hours_monday' => '09:00-17:00', 'merci_hours_tuesday' => '09:00-17:00', 'merci_hours_wednesday' => '09:00-17:00', 'merci_hours_thursday' => '09:00-17:00', 'merci_hours_friday' => '09:00-17:00', 'merci_hours_saturday' => '09:00-17:00', 'merci_hours_sunday' => '09:00-17:00', 'merci_hours_admin' => '07:00-22:00', 'merci_closed_dates' => '12-25', 'merci_lock' => FALSE);
     $this->merciCreateConfig($settings);
     $settings = array('date_default_timezone' => 'America/Los_Angeles');
     $this->drupalPost('admin/config/regional/settings', $settings, t('Save configuration'));
     $this->assertText(t("The configuration options have been saved."));
     $settings = array('instance[widget][settings][input_format]' => 'Y-m-d H:i:s');
     $this->drupalPost('admin/structure/types/manage/merci-reservation/fields/field_merci_date', $settings, t('Save settings'));
     $this->assertText(t("Saved Reservation configuration"));
 }
 public function setUp()
 {
     // For benchmarking.
     $this->start = time();
     // Enable any modules required for the test.
     parent::setUp('better_exposed_filters', 'date', 'date_views', 'list', 'number', 'taxonomy', 'text', 'views', 'views_ui');
     // One of these days I'll figure out why Features is breaking all my tests.
     module_enable(array('bef_test_content'));
     // User with edit views perms
     $this->admin_user = $this->drupalCreateUser();
     $role = user_role_load_by_name('administrator');
     $this->assertTrue(!empty($role->rid), 'Found the "administrator" role.');
     user_save($this->admin_user, array('roles' => array($role->rid => $role->rid)));
     $this->drupalLogin($this->admin_user);
     // Build a basic view for use in tests.
     $this->createView();
     // $this->createDisplay('Page', array('path' => array('path' => 'bef_test_page')));
     // Add field to default display
     // $this->addField('node.title');
     // Turn of Better Exposed Filters
     $this->setBefExposedForm();
 }
 /**
  * Implementation of setUp().
  */
 public function setUp($additional_modules = array())
 {
     $enable_modules = array('webform_user');
     $enable_modules = array_merge($enable_modules, $additional_modules);
     // Call the parent to set all of the base modules up.
     parent::setUp($enable_modules);
     // Setup the environment to a default standard.
     $this->webformUserSetupUserProfile();
     $this->webformUserCreateType();
     // $this->webformUserCreateNode();
     // Create a webform editor to test creating and editing own content.
     $permissions['editor'] = array('access content', 'administer nodes', 'create webform content', 'create petition content', 'edit own webform content', 'edit own petition content', 'access all webform results');
     // Create a webform admin that will do all node creation.
     $permissions['admin'] = array('access content', 'administer nodes', 'create webform content', 'create petition content', 'edit any webform content', 'access all webform results', 'edit all webform submissions', 'delete all webform submissions', 'administer users', 'administer user map', 'alter webform components', 'configure webform settings', 'configure webform emails');
     // Make sure the new permissions for the content type get added to the
     // permission cache.
     $this->checkPermissions(array('create petition content'), TRUE);
     foreach ($permissions as $user_key => $role_permissions) {
         $this->users[$user_key] = $this->drupalCreateUser($role_permissions);
     }
     // Set the mail system to test.
     variable_set('mail_system', array('default-system' => 'TestingMailSystem'));
 }
 /**
  * Preparation work that is done before each test.
  * Test users, content types, nodes etc. are created.
  */
 function setUp($module = '')
 {
     if (empty($module)) {
         // Enable content access module
         parent::setUp('content_access');
     } else {
         // Enable content access module plus another module
         parent::setUp('content_access', $module);
         // Stop setup when module could not be enabled
         if (!module_exists($module)) {
             return;
         }
     }
     // Create test user with seperate role
     $this->test_user = $this->drupalCreateUser();
     // Create admin user
     $this->admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'grant content access', 'grant own content access', 'administer nodes', 'access administration pages'));
     $this->drupalLogin($this->admin_user);
     // Rebuild content access permissions
     node_access_rebuild();
     #$this->drupalPost('admin/reports/status/rebuild', array(), t('Rebuild permissions'));
     // Create test content type
     $this->content_type = $this->drupalCreateContentType();
 }
示例#17
0
 protected function setUp()
 {
     parent::setUp(array('drupal_ti_test'));
 }
 /**
  * {@inheritdoc}
  */
 function setUp()
 {
     parent::setUp();
 }
 function setUp()
 {
     // Include the menu plugin file, because those classes are not autoloaded!
     module_load_include('inc', 'crumbs', 'plugins/crumbs.menu');
     parent::setUp('crumbs');
 }
 function setUp($addl_modules = array())
 {
     parent::setUp(array_merge(array('ldap_authentication', 'ldap_authorization', 'ldap_authorization_drupal_role'), $addl_modules));
     variable_set('ldap_simpletest', 1);
     variable_set('ldap_help_watchdog_detail', 0);
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp('plug');
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp('authcache_enum');
 }
示例#23
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp('forcejs', 'forcejs_test');
 }
示例#24
0
 public function setUp()
 {
     parent::setUp($this->initModules());
     // Enable any modules required for the test
     // Create and log in our privileged user.
     $settings = array('type' => 'photo', 'name' => 'Photography', 'base' => 'node_content', 'description' => 'show a photo and the metadata', 'help' => '', 'title_label' => 'Title', 'body_label' => 'Body', 'has_title' => 1, 'has_body' => 0);
     $type = $this->drupalCreateContentType($settings);
     //Types
     //image/Image
     //taxonomy_term_reference/Term reference
     //text/Text
     //Widgets
     //exif_readonly/metadata from image
     //image_image/Image
     $this->privileged_user = $this->drupalCreateUser(array('administer image metadata', 'administer content types', 'administer nodes', 'administer taxonomy', 'create photo content', 'edit any photo content'));
     $this->assertNotEqual(FALSE, $this->privileged_user, "user created.", 'Exif');
     $this->drupalLogin($this->privileged_user);
     $this->addExistingFieldToContentType($type, 'photo', 'image', 'image_image');
     $this->addNewFieldToContentType($type, 'model', 'exif_model', 'taxonomy_term_reference', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'keywords', 'iptc_keywords', 'taxonomy_term_reference', 'exif_readonly', array(), array("field[cardinality]" => -1));
     $this->addNewFieldToContentType($type, 'usercomment', 'exif_usercomment', 'text', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'latitude', 'gps_gpslatitude', 'text', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'longitude', 'gps_gpslongitude', 'text', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'latituderef', 'gps_gpslatituderef', 'text', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'longituderef', 'gps_gpslongituderef', 'text', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'artist', 'ifd0_artist', 'taxonomy_term_reference', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'title', 'ifd0_title', 'text', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'flash', 'exif_flash', 'text', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'date', 'exif_datetime', 'text', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'DateObject', 'ifd0_datetime', 'datetime', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'fileDate', 'exif_filedatetime', 'text', 'exif_readonly');
     $this->addNewFieldToContentType($type, 'fileDateObject', 'ifd0_filedatetime', 'datetime', 'exif_readonly');
     $this->activateMetadataOnObjectTypes(array($type->type));
     $this->drupalGet("admin/structure/types/manage/photo/fields");
     $this->drupalGet("node/add");
     $this->assertResponse(200, t('User is allowed to add content types.'), 'Exif');
 }
 public function setUp()
 {
     DrupalBootstrap::backupDatabase();
     parent::setUp();
 }
 function setUp()
 {
     parent::setUp(array('ldap_authentication', 'ldap_authorization', 'ldap_authorization_drupal_role', 'ldap_authorization_og', 'og_example'));
     variable_set('ldap_simpletest', 1);
     variable_set('ldap_help_watchdog_detail', 0);
 }