Skip to content
Snippets Groups Projects
Commit e21af4c2 authored by Chris Leppanen's avatar Chris Leppanen
Browse files

Issue #1711648 by twistor: Fixes for tests.

parent f54cac1d
No related branches found
No related tags found
No related merge requests found
...@@ -25,10 +25,7 @@ class FeedsFileFetcherTestCase extends FeedsWebTestCase { ...@@ -25,10 +25,7 @@ class FeedsFileFetcherTestCase extends FeedsWebTestCase {
// Set up an importer. // Set up an importer.
$this->createImporterConfiguration('Node import', 'node'); $this->createImporterConfiguration('Node import', 'node');
// Set and configure plugins and mappings. // Set and configure plugins and mappings.
$edit = array( $this->setSettings('node', NULL, array('content_type' => ''));
'content_type' => '',
);
$this->drupalPost('admin/structure/feeds/node/settings', $edit, 'Save');
$this->setPlugin('node', 'FeedsFileFetcher'); $this->setPlugin('node', 'FeedsFileFetcher');
$this->setPlugin('node', 'FeedsCSVParser'); $this->setPlugin('node', 'FeedsCSVParser');
$mappings = array( $mappings = array(
......
...@@ -43,8 +43,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase { ...@@ -43,8 +43,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase {
$this->createImporterConfiguration('Date RSS', 'daterss'); $this->createImporterConfiguration('Date RSS', 'daterss');
$this->setSettings('daterss', NULL, array('content_type' => '', 'import_period' => FEEDS_SCHEDULE_NEVER)); $this->setSettings('daterss', NULL, array('content_type' => '', 'import_period' => FEEDS_SCHEDULE_NEVER));
$this->setPlugin('daterss', 'FeedsFileFetcher'); $this->setPlugin('daterss', 'FeedsFileFetcher');
$this->setPlugin('daterss', 'FeedsSyndicationParser'); $this->setSettings('daterss', 'FeedsNodeProcessor', array('bundle' => $typename));
$this->setSettings('daterss', 'FeedsNodeProcessor', array('content_type' => $typename));
$this->addMappings('daterss', array( $this->addMappings('daterss', array(
0 => array( 0 => array(
'source' => 'title', 'source' => 'title',
...@@ -81,7 +80,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase { ...@@ -81,7 +80,7 @@ class FeedsMapperDateTestCase extends FeedsMapperTestCase {
'01/06/2010 - 06:05', '01/06/2010 - 06:05',
'01/06/2010 - 11:26', '01/06/2010 - 11:26',
'01/07/2010 - 00:26', '01/07/2010 - 00:26',
); );
for ($i = 1; $i <= 6; $i++) { for ($i = 1; $i <= 6; $i++) {
$this->drupalGet("node/$i/edit"); $this->drupalGet("node/$i/edit");
$this->assertNodeFieldValue('date', $values[$i-1]); $this->assertNodeFieldValue('date', $values[$i-1]);
......
...@@ -38,7 +38,7 @@ class FeedsMapperFieldTestCase extends FeedsMapperTestCase { ...@@ -38,7 +38,7 @@ class FeedsMapperFieldTestCase extends FeedsMapperTestCase {
$this->setSettings('csv', NULL, array('content_type' => '', 'import_period' => FEEDS_SCHEDULE_NEVER)); $this->setSettings('csv', NULL, array('content_type' => '', 'import_period' => FEEDS_SCHEDULE_NEVER));
$this->setPlugin('csv', 'FeedsFileFetcher'); $this->setPlugin('csv', 'FeedsFileFetcher');
$this->setPlugin('csv', 'FeedsCSVParser'); $this->setPlugin('csv', 'FeedsCSVParser');
$this->setSettings('csv', 'FeedsNodeProcessor', array('content_type' => $typename)); $this->setSettings('csv', 'FeedsNodeProcessor', array('bundle' => $typename));
$this->addMappings('csv', array( $this->addMappings('csv', array(
0 => array( 0 => array(
'source' => 'title', 'source' => 'title',
......
...@@ -47,7 +47,7 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase { ...@@ -47,7 +47,7 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase {
// Create importer configuration. // Create importer configuration.
$this->createImporterConfiguration(); $this->createImporterConfiguration();
$this->setPlugin('syndication', 'FeedsSimplePieParser'); $this->setPlugin('syndication', 'FeedsSimplePieParser');
$this->setSettings('syndication', 'FeedsNodeProcessor', array('content_type' => $typename)); $this->setSettings('syndication', 'FeedsNodeProcessor', array('bundle' => $typename));
$this->addMappings('syndication', array( $this->addMappings('syndication', array(
0 => array( 0 => array(
'source' => 'title', 'source' => 'title',
...@@ -90,7 +90,8 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase { ...@@ -90,7 +90,8 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase {
// Create a CSV importer configuration. // Create a CSV importer configuration.
$this->createImporterConfiguration('Node import from CSV', 'node'); $this->createImporterConfiguration('Node import from CSV', 'node');
$this->setPlugin('node', 'FeedsCSVParser'); $this->setPlugin('node', 'FeedsCSVParser');
$this->setSettings('node', 'FeedsNodeProcessor', array('content_type' => $typename)); $this->setSettings('node', 'FeedsNodeProcessor', array('bundle' => $typename));
$this->setSettings('node', NULL, array('content_type' => ''));
$this->addMappings('node', array( $this->addMappings('node', array(
0 => array( 0 => array(
'source' => 'title', 'source' => 'title',
...@@ -101,10 +102,6 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase { ...@@ -101,10 +102,6 @@ class FeedsMapperFileTestCase extends FeedsMapperTestCase {
'target' => 'field_files' 'target' => 'field_files'
), ),
)); ));
$edit = array(
'content_type' => '',
);
$this->drupalPost('admin/structure/feeds/node/settings', $edit, 'Save');
// Import. // Import.
$edit = array( $edit = array(
......
...@@ -59,7 +59,7 @@ class FeedsMapperLinkTestCase extends FeedsMapperTestCase { ...@@ -59,7 +59,7 @@ class FeedsMapperLinkTestCase extends FeedsMapperTestCase {
// Create importer configuration. // Create importer configuration.
$this->createImporterConfiguration(); //Create a default importer configuration $this->createImporterConfiguration(); //Create a default importer configuration
$this->setSettings('syndication', 'FeedsNodeProcessor', array('content_type' => $typename)); //Processor settings $this->setSettings('syndication', 'FeedsNodeProcessor', array('bundle' => $typename)); //Processor settings
$this->addMappings('syndication', array( $this->addMappings('syndication', array(
0 => array( 0 => array(
'source' => 'title', 'source' => 'title',
......
...@@ -94,10 +94,7 @@ class FeedsMapperPathTestCase extends FeedsMapperTestCase { ...@@ -94,10 +94,7 @@ class FeedsMapperPathTestCase extends FeedsMapperTestCase {
); );
$this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save')); $this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save'));
$this->setSettings('path_test', 'FeedsTermProcessor', array('vocabulary' => 'addams')); $this->setSettings('path_test', 'FeedsTermProcessor', array('bundle' => 'addams', 'update_existing' => 2));
// Turn on update existing.
$this->setSettings('path_test', 'FeedsTermProcessor', array('update_existing' => 2));
// Add mappings. // Add mappings.
$this->addMappings('path_test', array( $this->addMappings('path_test', array(
...@@ -208,7 +205,7 @@ class FeedsMapperPathPathautoTestCase extends FeedsMapperTestCase { ...@@ -208,7 +205,7 @@ class FeedsMapperPathPathautoTestCase extends FeedsMapperTestCase {
$aliases = array(); $aliases = array();
for ($i = 1; $i <= 9; $i++) { for ($i = 1; $i <= 9; $i++) {
$aliases[] = "path$i"; $aliases[] = "content/pathauto$i";
} }
$this->assertAliasCount($aliases); $this->assertAliasCount($aliases);
...@@ -229,12 +226,7 @@ class FeedsMapperPathPathautoTestCase extends FeedsMapperTestCase { ...@@ -229,12 +226,7 @@ class FeedsMapperPathPathautoTestCase extends FeedsMapperTestCase {
} }
public function assertAliasCount($aliases) { public function assertAliasCount($aliases) {
$in_db = db_select('url_alias', 'a') $in_db = db_query("SELECT * FROM {url_alias} WHERE alias IN (:aliases)", array(':aliases' => $aliases))->fetchAll();
->fields('a')
->condition('a.alias', $aliases)
->execute()
->fetchAll();
$this->assertEqual(count($in_db), count($aliases), 'Correct number of aliases in db.'); $this->assertEqual(count($in_db), count($aliases), 'Correct number of aliases in db.');
} }
} }
...@@ -408,13 +408,13 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase { ...@@ -408,13 +408,13 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase {
} }
/** /**
* Test that nodes will not be created if the user is unauthorized to create * Test that nodes will not be created if the user is unauthorized to create
* them. * them.
*/ */
public function testAuthorize() { public function testAuthorize() {
// Create a user with limited permissions. We can't use // Create a user with limited permissions. We can't use
// $this->drupalCreateUser here because we need to to set a specific user // $this->drupalCreateUser here because we need to to set a specific user
// name. // name.
$edit = array( $edit = array(
'name' => 'Development Seed', 'name' => 'Development Seed',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment