| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: shoutbox_user_access.test,v 1.1.2.1 2008/07/13 09:45:57 disterics Exp $ |
// $Id: shoutbox_user_access.test,v 1.1.4.2 2008/07/15 07:55:29 disterics Exp $ |
| 4 |
|
|
| 5 |
/** |
/** |
| 6 |
* @file |
* @file |
| 108 |
// edit the shout |
// edit the shout |
| 109 |
$edited_shout = array(); |
$edited_shout = array(); |
| 110 |
$edited_shout['shout'] = $this->randomName(10, 'shout'); |
$edited_shout['shout'] = $this->randomName(10, 'shout'); |
| 111 |
$url = 'shoutbox/' . $sid . '/edit'; |
$url = 'shoutbox/'. $sid .'/edit'; |
| 112 |
$this->drupalPost($url, $edited_shout, 'Update'); |
$this->drupalPost($url, $edited_shout, 'Update'); |
| 113 |
$this->assertWantedRaw(t('Your shout has been saved.')); |
$this->assertWantedRaw(t('Your shout has been saved.')); |
| 114 |
$this->assertWantedRaw(t($edited_shout['shout'])); |
$this->assertWantedRaw(t($edited_shout['shout'])); |
| 115 |
|
|
| 116 |
// delete the shout |
// delete the shout |
| 117 |
$url = 'shoutbox/' . $sid . '/delete'; |
$url = 'shoutbox/'. $sid .'/delete'; |
| 118 |
$this->drupalPost($url, NULL, 'Confirm'); |
$this->drupalPost($url, NULL, 'Confirm'); |
| 119 |
$this->assertWantedRaw(t('Your shout was deleted.')); |
$this->assertWantedRaw(t('Your shout was deleted.')); |
| 120 |
$this->assertNoText(t($edited_shout['shout'])); |
$this->assertNoText(t($edited_shout['shout'])); |
| 140 |
// edit the shout |
// edit the shout |
| 141 |
$edited_shout = array(); |
$edited_shout = array(); |
| 142 |
$edited_shout['shout'] = $this->randomName(10, 'shout'); |
$edited_shout['shout'] = $this->randomName(10, 'shout'); |
| 143 |
$url = 'shoutbox/' . $sid . '/edit'; |
$url = 'shoutbox/'. $sid .'/edit'; |
| 144 |
$this->drupalPost($url, $edited_shout, 'Update'); |
$this->drupalPost($url, $edited_shout, 'Update'); |
| 145 |
$this->assertWantedRaw(t('Your shout has been saved.')); |
$this->assertWantedRaw(t('Your shout has been saved.')); |
| 146 |
$this->assertWantedRaw(t($edited_shout['shout'])); |
$this->assertWantedRaw(t($edited_shout['shout'])); |
| 147 |
|
|
| 148 |
// delete the shout |
// delete the shout |
| 149 |
$url = 'shoutbox/' . $sid . '/delete'; |
$url = 'shoutbox/'. $sid .'/delete'; |
| 150 |
$this->drupalPost($url, NULL, 'Confirm'); |
$this->drupalPost($url, NULL, 'Confirm'); |
| 151 |
$this->assertWantedRaw(t('Your shout was deleted.')); |
$this->assertWantedRaw(t('Your shout was deleted.')); |
| 152 |
$this->assertNoText(t($edited_shout['shout'])); |
$this->assertNoText(t($edited_shout['shout'])); |
| 173 |
// get the shout id |
// get the shout id |
| 174 |
$sid = $this->_get_shout_id($shout); |
$sid = $this->_get_shout_id($shout); |
| 175 |
// Try to moderate it |
// Try to moderate it |
| 176 |
$path = 'shoutbox/' . $sid . '/publish'; |
$path = 'shoutbox/'. $sid .'/publish'; |
| 177 |
$url = url($path, array('absolute' => TRUE)); |
$url = url($path, array('absolute' => TRUE)); |
| 178 |
$this->get($url); |
$this->get($url); |
| 179 |
$this->assertResponse(403); |
$this->assertResponse(403); |
| 184 |
// login as moderator |
// login as moderator |
| 185 |
$this->drupalLoginUser($this->moderator); |
$this->drupalLoginUser($this->moderator); |
| 186 |
// moderate content |
// moderate content |
| 187 |
$path = 'shoutbox/' . $sid . '/publish'; |
$path = 'shoutbox/'. $sid .'/publish'; |
| 188 |
$url = url($path, array('absolute' => TRUE)); |
$url = url($path, array('absolute' => TRUE)); |
| 189 |
// verify confirmation page |
// verify confirmation page |
| 190 |
$this->get($url); |
$this->get($url); |
| 193 |
$this->assertText(t('The shout was published.')); |
$this->assertText(t('The shout was published.')); |
| 194 |
|
|
| 195 |
// now unpublish it |
// now unpublish it |
| 196 |
$path = 'shoutbox/' . $sid . '/unpublish'; |
$path = 'shoutbox/'. $sid .'/unpublish'; |
| 197 |
$url = url($path, array('absolute' => TRUE)); |
$url = url($path, array('absolute' => TRUE)); |
| 198 |
// verify confirmation page |
// verify confirmation page |
| 199 |
$this->get($url); |
$this->get($url); |
| 202 |
$this->assertText(t('The shout was unpublished.')); |
$this->assertText(t('The shout was unpublished.')); |
| 203 |
|
|
| 204 |
// try and edit it |
// try and edit it |
| 205 |
$path = 'shoutbox/' . $sid . '/edit'; |
$path = 'shoutbox/'. $sid .'/edit'; |
| 206 |
$url = url($path, array('absolute' => TRUE)); |
$url = url($path, array('absolute' => TRUE)); |
| 207 |
$this->get($url); |
$this->get($url); |
| 208 |
$this->assertResponse(403); |
$this->assertResponse(403); |
| 209 |
|
|
| 210 |
// try and delete it |
// try and delete it |
| 211 |
$path = 'shoutbox/' . $sid . '/delete'; |
$path = 'shoutbox/'. $sid .'/delete'; |
| 212 |
$url = url($path, array('absolute' => TRUE)); |
$url = url($path, array('absolute' => TRUE)); |
| 213 |
$this->get($url); |
$this->get($url); |
| 214 |
$this->assertResponse(403); |
$this->assertResponse(403); |