| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Provide test of functionality.
|
| 7 |
*
|
| 8 |
* Copyright 2008-2009 by Jimmy Berry ("boombatower", http://drupal.org/user/214218)
|
| 9 |
*/
|
| 10 |
|
| 11 |
class SubuserTestCase extends DrupalWebTestCase {
|
| 12 |
|
| 13 |
/**
|
| 14 |
* Implementation of getInfo().
|
| 15 |
*/
|
| 16 |
public static function getInfo() {
|
| 17 |
return array(
|
| 18 |
'name' => t('Subuser'),
|
| 19 |
'description' => t('...'),
|
| 20 |
'group' => t('Subuser'),
|
| 21 |
);
|
| 22 |
}
|
| 23 |
|
| 24 |
/**
|
| 25 |
* Implementation of setUp().
|
| 26 |
*/
|
| 27 |
public function setUp() {
|
| 28 |
parent::setUp('views', 'subuser');
|
| 29 |
}
|
| 30 |
|
| 31 |
/**
|
| 32 |
* Confirm the various client management interfaces function properly.
|
| 33 |
*/
|
| 34 |
public function testSubuser() {
|
| 35 |
// Create user that has the necessary PIFR permissions.
|
| 36 |
$user = $this->drupalCreateUser(array('pifr add project client', 'pifr add test client', 'pifr manage own client'));
|
| 37 |
$this->drupalLogin($user);
|
| 38 |
|
| 39 |
// Create a test client.
|
| 40 |
$client_id = $this->createClient($user->uid, PIFR_SERVER_CLIENT_TYPE_TEST);
|
| 41 |
|
| 42 |
// Attempt to set the test client URL to an invalid value.
|
| 43 |
$edit = array(
|
| 44 |
'url' => 'fail',
|
| 45 |
'type' => PIFR_SERVER_CLIENT_TYPE_PROJECT
|
| 46 |
);
|
| 47 |
$this->drupalPost("user/$user->uid/pifr/edit/$client_id", $edit, t('Save'));
|
| 48 |
$this->assertText(t('Client URL must end with a slash.'));
|
| 49 |
|
| 50 |
// Change the test client to a project client.
|
| 51 |
unset($edit['url']);
|
| 52 |
$this->drupalPost("user/$user->uid/pifr/edit/$client_id", $edit, t('Save'));
|
| 53 |
$this->assertText(t('Changes saved successfully.'));
|
| 54 |
}
|
| 55 |
}
|