public function PMPAPIPermissionsWebTestCase::testPmpAPIPermissionsPushNodeWhitelistOnlyUser in Public Media Platform API Integration 7
Pushes a node to the PMP.
File
- pmpapi_permissions/
tests/ pmpapi_permissions.test, line 119
Class
- PMPAPIPermissionsWebTestCase
- Tests the functionality of the PMPAPI permissions module.
Code
public function testPmpAPIPermissionsPushNodeWhitelistOnlyUser() {
$this
->createContentType();
$user_id = variable_get('pmpapi_user_id');
$node = $this
->createNodeWithPermissions($user_id);
$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/' . $user_id;
$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 Only Current User` permission attached to node.');
node_delete($node->nid);
}