Projet

Général

Profil

Paste
Télécharger (2,03 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / feeds_tamper / tests / temporary_target.test @ d808fa20

1
<?php
2

    
3
/**
4
 * Tests blank sources and temporary targets.
5
 */
6
class FeedsTamperTemporaryTargetTestCase extends FeedsTamperWebTestHelper {
7

    
8
  public static function getInfo() {
9
    return array(
10
      'name' => 'Temporary targets and blank sources',
11
      'description' => 'Tests for adding temporary targets and blank sources.',
12
      'group' => 'Feeds Tamper',
13
    );
14
  }
15

    
16
  /**
17
   * Tests adding temporary targets.
18
   */
19
  public function testAddTemporaryTargets() {
20
    $importer_name = $this->randomName();
21
    $importer_id = drupal_strtolower($importer_name);
22
    // Set up an importer.
23
    $this->createImporterConfiguration($importer_name, $importer_id);
24

    
25
    // Add three temporary targets.
26
    $this->addMappings($importer_id, array(
27
      0 => array(
28
        'source' => 'title',
29
        'target' => 'Temporary target 1',
30
      ),
31
      1 => array(
32
        'source' => 'guid',
33
        'target' => 'Temporary target 2',
34
      ),
35
      2 => array(
36
        'source' => 'description',
37
        'target' => 'Temporary target 3',
38
      ),
39
    ));
40

    
41
    // Assert that all targets are displayed in the UI.
42
    $this->assertText('Temporary target 1');
43
    $this->assertText('Temporary target 2');
44
    $this->assertText('Temporary target 3');
45
  }
46

    
47
  /**
48
   * Tests adding blank sources.
49
   */
50
  public function testAddBlankSources() {
51
    $importer_name = $this->randomName();
52
    $importer_id = drupal_strtolower($importer_name);
53
    // Set up an importer.
54
    $this->createImporterConfiguration($importer_name, $importer_id);
55

    
56
    // Add three blank sources.
57
    $this->addMappings($importer_id, array(
58
      0 => array(
59
        'source' => 'Blank source 1',
60
        'target' => 'title',
61
      ),
62
      1 => array(
63
        'source' => 'Blank source 2',
64
        'target' => 'guid',
65
      ),
66
      2 => array(
67
        'source' => 'Blank source 3',
68
        'target' => 'body',
69
      ),
70
    ));
71

    
72
    // Assert that all sources are displayed in the UI.
73
    $this->assertText('Blank source 1');
74
    $this->assertText('Blank source 2');
75
    $this->assertText('Blank source 3');
76
  }
77

    
78
}