You are here

function PMPAPIPushWebTestCase::testPmpAPIPushQueueDelete in Public Media Platform API Integration 7

Pushes a node, fails to delete, queues doc, succeeds.

File

pmpapi_push/tests/pmpapi_push.test, line 161

Class

PMPAPIPushWebTestCase
Tests the functionality of the PMPAPI push module.

Code

function testPmpAPIPushQueueDelete() {
  $this
    ->createContentType();
  $node = $this
    ->createNode();
  $this
    ->assertTrue($node, 'Created test node.');
  sleep(self::SLEEP_TIME);
  $guid = $node->pmpapi_guid;
  $pmp = pmpapi_fetch($guid);
  $this
    ->assertTrue(empty($pmp->errors['query']), 'Pushed node to PMP.');
  $secret = variable_get('pmpapi_auth_client_secret');
  variable_set('pmpapi_auth_client_secret', '1234');
  DrupalWebTestCase::refreshVariables();
  sleep(self::SLEEP_TIME);
  node_delete($node->nid);
  $this
    ->assertTrue(!node_load($node->nid), 'Node was deleted.');
  sleep(self::SLEEP_TIME);
  variable_set('pmpapi_auth_client_secret', $secret);
  DrupalWebTestCase::refreshVariables();
  $pmp = pmpapi_fetch($guid);
  sleep(self::SLEEP_TIME);
  $this
    ->cronRun();
  sleep(self::SLEEP_TIME);
  $pmp = pmpapi_fetch($guid);
  $this
    ->assertTrue(!empty($pmp->errors), 'Node was deleted on cron run.');
}