1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Contains FeedsMapperHookTestCase.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Test case for the various callbacks implemented for mappers.
|
10
|
*/
|
11
|
class FeedsMapperHookTestCase extends FeedsMapperTestCase {
|
12
|
|
13
|
public static function getInfo() {
|
14
|
return array(
|
15
|
'name' => 'Mapper: Hooks and callbacks',
|
16
|
'description' => 'Test case for the various callbacks implemented for mappers.',
|
17
|
'group' => 'Feeds',
|
18
|
);
|
19
|
}
|
20
|
|
21
|
/**
|
22
|
* Basic test loading a double entry CSV file.
|
23
|
*/
|
24
|
public function test() {
|
25
|
|
26
|
// Create and configure importer.
|
27
|
$this->createImporterConfiguration();
|
28
|
$this->addMappings('syndication', array(
|
29
|
0 => array(
|
30
|
'source' => 'title',
|
31
|
'target' => 'title',
|
32
|
),
|
33
|
1 => array(
|
34
|
'source' => 'description',
|
35
|
'target' => 'test_target',
|
36
|
),
|
37
|
));
|
38
|
|
39
|
// Checks that alter hooks are invoked.
|
40
|
$this->assertText(t('The target description was altered.'));
|
41
|
|
42
|
// Inherently tests preprocess callbacks.
|
43
|
// @see feeds_tests_mapper_set_target()
|
44
|
$nid = $this->createFeedNode();
|
45
|
$this->drupalGet('node/2/edit');
|
46
|
$body_value = $this->xpath('//*[@name = "body[und][0][value]"]');
|
47
|
$value = unserialize((string) $body_value[0]);
|
48
|
$this->assertTrue(!empty($value));
|
49
|
|
50
|
// Tests old-style target keys.
|
51
|
$this->addMappings('syndication', array(
|
52
|
2 => array(
|
53
|
'source' => 'url',
|
54
|
'target' => 'test_target_compat',
|
55
|
),
|
56
|
));
|
57
|
|
58
|
// Click gear to get form.
|
59
|
$this->drupalPostAJAX(NULL, array(), 'mapping_settings_edit_2');
|
60
|
|
61
|
// Set some settings.
|
62
|
$edit = array(
|
63
|
'config[2][settings][checkbox]' => 1,
|
64
|
'config[2][settings][textfield]' => 'Some text',
|
65
|
'config[2][settings][textarea]' => 'Textarea value: Didery dofffffffffffffffffffffffffffffffffffff',
|
66
|
'config[2][settings][radios]' => 'option1',
|
67
|
'config[2][settings][select]' => 'option4',
|
68
|
);
|
69
|
$this->drupalPostAJAX(NULL, $edit, 'mapping_settings_update_2');
|
70
|
$this->assertText(t('* Changes made to target configuration are stored temporarily. Click Save to make your changes permanent.'));
|
71
|
}
|
72
|
|
73
|
}
|