security update core+modules
This commit is contained in:
@@ -1455,6 +1455,57 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
|
||||
function testEntityIntegration() {
|
||||
global $user;
|
||||
|
||||
$page = $this->drupalCreateNode(array('type' => 'page'));
|
||||
$article = $this->drupalCreateNode(array('type' => 'article'));
|
||||
|
||||
$result = rules_condition('entity_field_access')
|
||||
->execute(entity_metadata_wrapper('node', $article), 'field_tags');
|
||||
$this->assertTrue($result);
|
||||
|
||||
// Test entiy_is_of_bundle condition.
|
||||
$result = rules_condition('entity_is_of_bundle', array(
|
||||
'type' => 'node',
|
||||
'bundle' => array('article'),
|
||||
))->execute(entity_metadata_wrapper('node', $page));
|
||||
$this->assertFalse($result, 'Entity is of bundle condition has not been met.');
|
||||
$result = rules_condition('entity_is_of_bundle', array(
|
||||
'type' => 'node',
|
||||
'bundle' => array('article'),
|
||||
))->execute(entity_metadata_wrapper('node', $article));
|
||||
$this->assertTrue($result, 'Entity is of bundle condition has been met.');
|
||||
|
||||
// Also test a full rule so the integrity check must work.
|
||||
$term_wrapped = entity_property_values_create_entity('taxonomy_term', array(
|
||||
'name' => $this->randomName(),
|
||||
'vocabulary' => 1,
|
||||
))->save();
|
||||
$rule = rule(array(
|
||||
'node' => array('type' => 'node'),
|
||||
));
|
||||
$rule->condition('entity_is_of_bundle', array(
|
||||
'entity:select' => 'node',
|
||||
'bundle' => array('article'),
|
||||
));
|
||||
$rule->action('data_set', array('data:select' => 'node:field_tags', 'value' => array($term_wrapped->getIdentifier())));
|
||||
$rule->integrityCheck();
|
||||
$rule->execute($article);
|
||||
$this->assertEqual($term_wrapped->getIdentifier(), $article->field_tags[LANGUAGE_NONE][0]['tid'], 'Entity is of bundle condition has been met.');
|
||||
|
||||
// Test again using an entity variable.
|
||||
$article = $this->drupalCreateNode(array('type' => 'article'));
|
||||
$rule = rule(array(
|
||||
'entity' => array('type' => 'entity'),
|
||||
));
|
||||
$rule->condition('entity_is_of_bundle', array(
|
||||
'entity:select' => 'entity',
|
||||
'type' => 'node',
|
||||
'bundle' => array('article'),
|
||||
));
|
||||
$rule->action('data_set', array('data:select' => 'entity:field_tags', 'value' => array($term_wrapped->getIdentifier())));
|
||||
$rule->integrityCheck();
|
||||
$rule->execute(entity_metadata_wrapper('node', $article));
|
||||
$this->assertEqual($term_wrapped->getIdentifier(), $article->field_tags[LANGUAGE_NONE][0]['tid'], 'Entity is of bundle condition has been met.');
|
||||
|
||||
// Test CRUD actions.
|
||||
$action = rules_action('entity_create', array(
|
||||
'type' => 'node',
|
||||
@@ -1883,8 +1934,11 @@ class RulesIntegrationTestCase extends DrupalWebTestCase {
|
||||
// Test sending mail to all users of a role. First make sure there is a
|
||||
// custom role and a user for it.
|
||||
$user = $this->drupalCreateUser(array('administer nodes'));
|
||||
$roles = array_keys($user->roles);
|
||||
rules_action('mail_to_users_of_role', $settings + array('roles' => $roles))->execute();
|
||||
$roles = $user->roles;
|
||||
// Remove the authenticate role so we only use the new role created by
|
||||
// drupalCreateUser().
|
||||
unset($roles[DRUPAL_AUTHENTICATED_RID]);
|
||||
rules_action('mail_to_users_of_role', $settings + array('roles' => array_keys($roles)))->execute();
|
||||
$this->assertMail('to', $user->mail, 'Mail to users of a role has been sent.');
|
||||
|
||||
// Test reacting on new log entries and make sure the log entry is usable.
|
||||
|
@@ -6,9 +6,9 @@ files[] = rules_test.rules.inc
|
||||
files[] = rules_test.rules_defaults.inc
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-23
|
||||
version = "7.x-2.2+5-dev"
|
||||
; Information added by drupal.org packaging script on 2013-03-27
|
||||
version = "7.x-2.3"
|
||||
core = "7.x"
|
||||
project = "rules"
|
||||
datestamp = "1350998486"
|
||||
datestamp = "1364401818"
|
||||
|
||||
|
Reference in New Issue
Block a user