You are here

public function PMPAPIPullWebTestCase::testPmpAPIPullExpiredStory in Public Media Platform API Integration 7

Checks for status = 0 on pulled expired story.

File

pmpapi_pull/tests/pmpapi_pull.test, line 155

Class

PMPAPIPullWebTestCase
Tests the functionality of the PMPAPI pull module.

Code

public function testPmpAPIPullExpiredStory() {
  $this
    ->createContentType();
  $valid = new stdClass();
  $valid->from = pmpapi_convert_timestamp(strtotime('200 days ago', REQUEST_TIME));
  $valid->to = pmpapi_convert_timestamp(strtotime('100 days ago', REQUEST_TIME));
  $values = array(
    'profile' => 'story',
    'attributes' => array(
      'valid' => $valid,
      'title' => $this
        ->randomName(20),
    ),
  );
  $doc = pmpapi_send($values);
  $this
    ->assertTrue(is_object($doc), 'Successfully pushed a story to the PMP.');
  sleep(self::SLEEP_TIME);
  $guid = $doc->attributes->guid;
  pmpapi_pull_pull_doc($guid);
  $node = node_load(1);
  $this
    ->assertTrue(is_object($node), 'Pulled story and created node.');
  $this
    ->assertFalse($node->status, 'Expired story is unpublished.');
  pmpapi_remove($doc->attributes->guid);
}