Révision 950416da
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/rules/rules_i18n/rules_i18n.test | ||
---|---|---|
10 | 10 |
*/ |
11 | 11 |
class RulesI18nTestCase extends DrupalWebTestCase { |
12 | 12 |
|
13 |
/** |
|
14 |
* Declares test metadata. |
|
15 |
*/ |
|
13 | 16 |
public static function getInfo() { |
14 | 17 |
return array( |
15 | 18 |
'name' => 'Rules I18n', |
... | ... | |
19 | 22 |
); |
20 | 23 |
} |
21 | 24 |
|
22 |
public function setUp() { |
|
25 |
/** |
|
26 |
* Overrides DrupalWebTestCase::setUp(). |
|
27 |
*/ |
|
28 |
protected function setUp() { |
|
23 | 29 |
parent::setUp('rules_i18n'); |
24 | 30 |
$this->admin_user = $this->drupalCreateUser(array('bypass node access', 'administer nodes', 'administer languages', 'administer content types', 'administer blocks', 'access administration pages')); |
25 | 31 |
$this->drupalLogin($this->admin_user); |
... | ... | |
52 | 58 |
} |
53 | 59 |
elseif ($this->xpath('//input[@type="checkbox" and @name=:name and @checked="checked"]', array(':name' => 'enabled[' . $language_code . ']'))) { |
54 | 60 |
// It's installed and enabled. No need to do anything. |
55 |
$this->assertTrue(true, 'Language [' . $language_code . '] already installed and enabled.');
|
|
61 |
$this->assertTrue(TRUE, 'Language [' . $language_code . '] already installed and enabled.');
|
|
56 | 62 |
} |
57 | 63 |
else { |
58 | 64 |
// It's installed but not enabled. Enable it. |
59 |
$this->assertTrue(true, 'Language [' . $language_code . '] already installed.');
|
|
65 |
$this->assertTrue(TRUE, 'Language [' . $language_code . '] already installed.');
|
|
60 | 66 |
$this->drupalPost(NULL, array('enabled[' . $language_code . ']' => TRUE), t('Save configuration')); |
61 | 67 |
$this->assertRaw(t('Configuration saved.'), t('Language successfully enabled.')); |
62 | 68 |
} |
... | ... | |
139 | 145 |
$messages = drupal_get_messages(); |
140 | 146 |
$this->assertEqual($messages['status'][0], 'text-de', 'Text has been successfully translated.'); |
141 | 147 |
|
142 |
// Enable the PHP module and make sure PHP in translations is not evaluted. |
|
148 |
// Enable the PHP module and make sure PHP in translations is not evaluated.
|
|
143 | 149 |
module_enable(array('php')); |
144 | 150 |
i18n_string_textgroup('rules')->update_translation("rules_config:{$set->name}:$id:text", 'de', 'text <?php echo "eval";?>'); |
145 | 151 |
|
... | ... | |
162 | 168 |
|
163 | 169 |
$set = rules_action_set(array('node' => array('type' => 'node'))); |
164 | 170 |
$set->action('rules_i18n_select', array( |
165 |
'data:select' => 'node:body:value',
|
|
166 |
'language' => 'de',
|
|
167 |
'data_translated:var' => 'body',
|
|
171 |
'data:select' => 'node:body:value', |
|
172 |
'language' => 'de', |
|
173 |
'data_translated:var' => 'body', |
|
168 | 174 |
)); |
169 | 175 |
$set->action('drupal_message', array('message:select' => 'body')); |
170 | 176 |
$set->save(); |
... | ... | |
180 | 186 |
$messages = drupal_get_messages(); |
181 | 187 |
$this->assertEqual($messages['status'][0], "German body.\n", 'Translated text has been selected.'); |
182 | 188 |
} |
189 |
|
|
183 | 190 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules