You are here

public function ActivityWebTest::testNodeActivityLoadObjects in Activity 7

Test that the node activity handler properly loads the node objects.

File

tests/activity_unit.test, line 92

Class

ActivityWebTest

Code

public function testNodeActivityLoadObjects() {
  $handler = activity_load_handler('node_insert');
  $handler->options = array(
    'types' => array(),
    'view_modes' => array(),
  );
  $handler->actions_id = -1;
  $handler->label = 'Test node update';
  $node1 = $this
    ->drupalCreateNode(array(
    'type' => 'article',
  ));
  $node2 = $this
    ->drupalCreateNode(array(
    'type' => 'page',
    'status' => 0,
  ));
  $objects1 = $handler
    ->loadObjects($node1->nid);
  $objects2 = $handler
    ->loadObjects($node2->nid);

  // Make sure loaded objects match what is expected.
  $this
    ->assertEqual($node1->nid, $objects1['node']->nid, t('Loaded up the correct article node'));
  $this
    ->assertEqual($node2->nid, $objects2['node']->nid, t('Loaded up the correct page node'));
}