| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
class Tracker2TestCase extends DrupalWebTestCase {
|
| 5 |
function getInfo() {
|
| 6 |
return array(
|
| 7 |
'name' => t('Tracker 2'),
|
| 8 |
'description' => t('tests the tracker2 module'),
|
| 9 |
'group' => t('tracker2'),
|
| 10 |
);
|
| 11 |
}
|
| 12 |
|
| 13 |
function setUp() {
|
| 14 |
parent::setUp('tracker2');
|
| 15 |
}
|
| 16 |
|
| 17 |
function testTracker2TrackUser() {
|
| 18 |
$base = 'tracker2';
|
| 19 |
$user_base = 'track2';
|
| 20 |
if (!module_exists('tracker')) {
|
| 21 |
$base = 'tracker';
|
| 22 |
$user_base = 'track';
|
| 23 |
}
|
| 24 |
|
| 25 |
// call tracker2_track_user -> there is not arg(1)
|
| 26 |
$this->drupalGet('user');
|
| 27 |
tracker2_track_user();
|
| 28 |
$this->assertResponse(404, t('take sure that the function returns 404, if there is no arg(1)'));
|
| 29 |
|
| 30 |
// create user
|
| 31 |
$web_user_1 = $this->drupalCreateUser();
|
| 32 |
$web_user_2 = $this->drupalCreateUser();
|
| 33 |
$web_user_1->status = 0;
|
| 34 |
user_save($web_user_1);
|
| 35 |
$admin_user = $this->drupalCreateUser(array('administer users'));
|
| 36 |
|
| 37 |
$this->drupalLogin($web_user_2);
|
| 38 |
$this->drupalGet('user/'. $web_user_1->uid .'/'. $user_base);
|
| 39 |
$this->assertResponse(403, t('take sure that it is pot possible to look at users with status 0 for normal users'));
|
| 40 |
|
| 41 |
$this->drupalLogin($admin_user);
|
| 42 |
$this->drupalGet('user/'. $web_user_1->uid .'/'. $user_base);
|
| 43 |
$this->assertTitle(check_plain($web_user_1->name), t('take sure that the title is set right'));
|
| 44 |
}
|
| 45 |
}
|