source: sipes/modules_contrib/feeds/tests/feeds_mapper_emfield.test @ 92213c1

stableversion-3.0
Last change on this file since 92213c1 was 177a560, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agrego el directorio de modulos contribuidos de drupal

  • Propiedad mode establecida a 100755
File size: 2.1 KB
Línea 
1<?php
2module_load_include('test', 'feeds', 'tests/feeds_mapper');
3
4/**
5 * @file
6 * Test case for simple CCK field mapper mappers/emfield.inc.
7 */
8
9/**
10 * Class for testing Feeds <em>emfield</em> mapper.
11 */
12class FeedsMapperEmfieldTestCase extends FeedsMapperTestCase {
13  public static function getInfo() {
14    return array(
15      'name' => 'Mapper: Emfield',
16      'description' => 'Test Feeds Mapper support for Emfield CCK fields.',
17      'group' => 'Feeds',
18      'dependencies' => array('content', 'emfield'),
19    );
20  }
21
22  function setUp() {
23    parent::setUp(array('content', 'emfield', 'emvideo'));
24  }
25
26  /**
27   * Basic test loading a doulbe entry CSV file.
28   */
29  function test() {
30
31    // Create content type.
32    $typename = $this->createContentType(array(), array(
33      'video' => array(
34        'type' => 'emvideo',
35        'widget' => 'emvideo_textfields',
36      ),
37    ));
38
39    // Create and configure importer.
40    $this->createImporterConfiguration('Emfield CSV', 'csv');
41    $this->setSettings('csv', NULL, array('content_type' => '', 'import_period' => FEEDS_SCHEDULE_NEVER));
42    $this->setPlugin('csv', 'FeedsFileFetcher');
43    $this->setPlugin('csv', 'FeedsCSVParser');
44    $this->setSettings('csv', 'FeedsNodeProcessor', array('content_type' => $typename));
45    $this->addMappings('csv', array(
46      array(
47        'source' => 'title',
48        'target' => 'title',
49      ),
50      array(
51        'source' => 'created',
52        'target' => 'created',
53      ),
54      array(
55        'source' => 'body',
56        'target' => 'body',
57      ),
58      array(
59        'source' => 'video',
60        'target' => 'field_video',
61      ),
62    ));
63
64    // Import CSV file.
65    $this->importFile('csv', $this->absolutePath() .'/tests/feeds/emfield.csv');
66    $this->assertText('Created 2 '. $typename .' nodes.');
67
68    // Check the two imported files.
69    $this->drupalGet('node/1/edit');
70    $this->assertFieldByName('field_video[0][embed]', 'http://www.youtube.com/watch?v=gpkhANg919Y');
71
72    $this->drupalGet('node/2/edit');
73    $this->assertFieldByName('field_video[0][embed]', 'http://www.youtube.com/watch?v=ewAGXAeCXJY');
74  }
75}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.