You are here

public function PMPAPIPermissionsWebTestCase::testPmpAPIPermissionsPushNodeWhitelistGroup in Public Media Platform API Integration 7

Pushes a node to the PMP.

File

pmpapi_permissions/tests/pmpapi_permissions.test, line 98

Class

PMPAPIPermissionsWebTestCase
Tests the functionality of the PMPAPI permissions module.

Code

public function testPmpAPIPermissionsPushNodeWhitelistGroup() {
  $this
    ->createContentType();
  $node = $this
    ->createNodeWithPermissions($this->testGroupGUID);
  $this
    ->assertTrue($node, 'Created test node.');
  $guid = $node->pmpapi_guid;
  sleep(self::SLEEP_TIME);
  $pmp = pmpapi_fetch($guid);
  $this
    ->assertTrue(empty($pmp->errors['query']), 'Pushed node to PMP.');
  $doc = $pmp->query->results->json;
  $perm_href = variable_get('pmpapi_base_url') . '/docs/' . $this->testGroupGUID;
  $perm_ok = !empty($doc->links->permission) && !empty($doc->links->permission[0]->href) && $doc->links->permission[0]->href == $perm_href && empty($doc->links->permission[0]->blacklist);
  $this
    ->assertTrue($perm_ok, '`Whitelist group` permission attached to node.');
  node_delete($node->nid);
}