You are here

function RelationRulesTestCase::testRelationLoadRelatedRules in Relation 7

File

tests/relation.rules.test, line 122
Tests for Rules support.

Class

RelationRulesTestCase
Functional test of Relation's integration with Rules.

Code

function testRelationLoadRelatedRules() {
  $nid = $this->node1->nid;
  variable_set('relation_rules_test_nid', $nid);
  module_enable(array(
    'relation_rules_test',
  ));
  $this->node6 = $this
    ->drupalCreateNode(array(
    'type' => 'article',
  ));
  for ($i = 1; $i <= 6; $i++) {
    $property = "node{$i}";
    $node = $this->{$property};
    if ($node->nid == $nid) {
      $this
        ->assertFalse((bool) db_query_range('SELECT * FROM {node} WHERE nid = :nid', 0, 1, array(
        ':nid' => $nid,
      ))
        ->fetchField(), t('The correct node was deleted'));
    }
    else {
      $nids[] = $node->nid;
    }
  }
  $count = count($nids);
  $this
    ->assertEqual($count, db_query('SELECT COUNT(*) FROM {node} WHERE nid IN (:nids)', array(
    ':nids' => $nids,
  ))
    ->fetchField(), t('@count other nodes were found', array(
    '@count' => $count,
  )));
}