info->type ." content"); if ($type_edit == TRUE) { $perms = array_merge($perms, array('administer content types', 'access administration pages')); } $user = $this->drupalCreateUser($perms); $this->drupalGet('logout'); $this->drupalLogin($user); } /** * Create a new content-type for creating the feed node */ protected function create_type($parser, $file_upload = FALSE) { $this->info->type = 'test'. str_replace('_', '', $this->randomName()); $this->info->name = 'Feed'. str_replace('_', ' ', $this->randomName()); $this->info->description = t('Aggregates RSS or Atom feeds. Items from these feeds will be turned into nodes.'); $this->info->module = 'node'; $this->info->has_title = TRUE; $this->info->title_label = t('Title'); $this->info->has_body = TRUE; $this->info->body_label = t('Body'); $this->info->min_word_count = 0; $this->info->custom = TRUE; $type = $this->drupalCreateContentType((array) $this->info); $this->assertTrue(is_object($type), 'The temporary content-type is created. The content-type name is: '. $this->info->type); // Adding default FeedAPI settings if ($file_upload) { variable_set('feedapi_settings_'. $this->info->type, unserialize('a:4:{s:7:"enabled";s:1:"1";s:13:"upload_method";s:6:"upload";s:7:"parsers";a:1:{s:'. strlen($parser) .':"'. $parser .'";a:3:{s:7:"enabled";s:1:"1";s:6:"weight";s:1:"0";s:4:"test";s:1:"3";}}s:10:"processors";a:2:{s:12:"feedapi_node";a:4:{s:6:"weight";s:1:"0";s:12:"content_type";s:5:"story";s:9:"node_date";s:4:"feed";s:7:"enabled";s:1:"1";}s:18:"feedapi_aggregator";a:2:{s:6:"weight";s:1:"0";s:5:"block";s:1:"3";}}}')); } else { variable_set('feedapi_settings_'. $this->info->type, unserialize('a:3:{s:7:"enabled";s:1:"1";s:7:"parsers";a:1:{s:'. strlen($parser) .':"'. $parser .'";a:3:{s:7:"enabled";s:1:"1";s:6:"weight";s:1:"0";s:4:"test";s:1:"3";}}s:10:"processors";a:2:{s:12:"feedapi_node";a:4:{s:6:"weight";s:1:"0";s:12:"content_type";s:5:"story";s:9:"node_date";s:4:"feed";s:7:"enabled";s:1:"1";}s:18:"feedapi_aggregator";a:2:{s:6:"weight";s:1:"0";s:5:"block";s:1:"3";}}}')); } } /** * Returns the list of sane parsers. */ protected function get_parsers() { // Determine enabled and well-setup parsers // @todo: the hard-wired list is suboptimal. But no way to determine the compatibility of the parser $parsers_ok = array('parser_simplepie', 'parser_common_syndication'); foreach ($parsers_ok as $key => $parser) { $status = module_invoke($parser, 'requirements', 'runtime'); if (isset($status[$parser]) && $status[$parser]['severity'] == REQUIREMENT_ERROR) { unset($parsers_ok[$key]); } } return $parsers_ok; } protected function testFileURL($filename = '') { global $base_url; if (!empty($filename)) { return $base_url .'/'. drupal_get_path('module', 'feedapi') .'/tests/files/'. $filename; } else { return $base_url .'/'. drupal_get_path('module', 'feedapi') .'/tests/files/test_feed.rss'; } } }