public function MessageUiMassiveHardCodedArguments::testRemoveAddingArguments in Message UI 7
File
- ./
message_ui.test, line 244
Class
- MessageUiMassiveHardCodedArguments
- Testing the update of the hard coded arguments in massive way.
Code
public function testRemoveAddingArguments() {
// Create a message.
$this->user1 = $this
->drupalCreateUser();
$message = message_create('dummy_message');
$message->uid = $this->user1->uid;
$message
->save();
$original_arguments = $message->arguments;
// Update message instance when removing a hard coded argument.
variable_set('update_tokens_how_to_act', 'update_when_removed');
$message_type = message_type_load('dummy_message');
$message_type->message_text[LANGUAGE_NONE][0]['value'] = '[message:user:name].';
$message_type
->save();
// Fire the queue worker.
$queue = DrupalQueue::get('message_ui_arguments');
$item = $queue
->claimItem();
message_ui_arguments_worker($item->data);
// Verify the arguments has changed.
$message = message_load($message->mid);
$this
->assertTrue($original_arguments != $message->arguments, 'The message arguments has changed during the queue worker work.');
// Creating a new message and her hard coded arguments.
$message = message_create('dummy_message');
$message->uid = $this->user1->uid;
$message
->save();
$original_arguments = $message->arguments;
// Process the message instance when adding hard coded arguments.
variable_set('update_tokens_how_to_act', 'update_when_added');
$message_type = message_type_load('dummy_message');
$message_type->message_text[LANGUAGE_NONE][0]['value'] = '@{message:user:name}.';
$message_type
->save();
// Fire the queue worker.
$queue = DrupalQueue::get('message_ui_arguments');
$item = $queue
->claimItem();
message_ui_arguments_worker($item->data);
// Verify the arguments has changed.
$message = message_load($message->mid);
$this
->assertTrue($original_arguments == $message->arguments, 'The message arguments has changed during the queue worker work.');
}