You are here

public function SubuserTestCase::testSubuser in Subuser 6

Confirm the various client management interfaces function properly.

File

./subuser.test, line 33
Provide test of functionality.

Class

SubuserTestCase
@file Provide test of functionality.

Code

public function testSubuser() {

  // Create user that has the necessary PIFR permissions.
  $user = $this
    ->drupalCreateUser(array(
    'pifr add project client',
    'pifr add test client',
    'pifr manage own client',
  ));
  $this
    ->drupalLogin($user);

  // Create a test client.
  $client_id = $this
    ->createClient($user->uid, PIFR_SERVER_CLIENT_TYPE_TEST);

  // Attempt to set the test client URL to an invalid value.
  $edit = array(
    'url' => 'fail',
    'type' => PIFR_SERVER_CLIENT_TYPE_PROJECT,
  );
  $this
    ->drupalPost("user/{$user->uid}/pifr/edit/{$client_id}", $edit, t('Save'));
  $this
    ->assertText(t('Client URL must end with a slash.'));

  // Change the test client to a project client.
  unset($edit['url']);
  $this
    ->drupalPost("user/{$user->uid}/pifr/edit/{$client_id}", $edit, t('Save'));
  $this
    ->assertText(t('Changes saved successfully.'));
}