| 1 |
<?php
|
| 2 |
// $Id: hidden.test,v 1.2 2008/12/13 18:42:43 ekes Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Tests for hidden module.
|
| 7 |
*
|
| 8 |
* @todo XSS tests.
|
| 9 |
*/
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Hidden test case.
|
| 13 |
*/
|
| 14 |
class HiddenHelperCase extends DrupalWebTestCase {
|
| 15 |
protected $web_user;
|
| 16 |
protected $view_user;
|
| 17 |
protected $report_user;
|
| 18 |
protected $hide_user;
|
| 19 |
protected $admin_user;
|
| 20 |
protected $text_filter;
|
| 21 |
protected $preg_filter;
|
| 22 |
|
| 23 |
function setUp() {
|
| 24 |
parent::setUp('hidden', 'comment');
|
| 25 |
// @todo enabling comment is causing simpletest to fail
|
| 26 |
|
| 27 |
$this->web_user = $this->drupalCreateUser();
|
| 28 |
$this->view_user = $this->drupalCreateUser(array('access hidden'));
|
| 29 |
$this->report_user = $this->drupalCreateUser(array('report for hiding'));
|
| 30 |
// Yes untested edge case able to hide but not see hidden. Make sense?
|
| 31 |
$this->hide_user = $this->drupalCreateUser(array('mark as hidden', 'access hidden'));
|
| 32 |
$this->admin_user = $this->drupalCreateUser(array('administer hidden'));
|
| 33 |
|
| 34 |
$this->text_filter = array(
|
| 35 |
'title' => 'new filter name',
|
| 36 |
'filter' => 'text to filter',
|
| 37 |
'type' => HIDDEN_FILTER_PLAIN,
|
| 38 |
'delay' => 0,
|
| 39 |
'weight' => 0,
|
| 40 |
'enabled' => 1,
|
| 41 |
'uid' => $this->hide_user->uid,
|
| 42 |
'rid' => 0,
|
| 43 |
'publicnote' => 'Public reason for hiding',
|
| 44 |
'privatenote' => 'Filter notes as the reason for hidden',
|
| 45 |
);
|
| 46 |
$this->preg_filter = array(
|
| 47 |
'title' => 'preg filter name',
|
| 48 |
'filter' => '/With \w+/',
|
| 49 |
'type' => HIDDEN_FILTER_PREG,
|
| 50 |
'delay' => 30,
|
| 51 |
'weight' => -5,
|
| 52 |
'enabled' => 1,
|
| 53 |
'uid' => $this->admin_user->uid,
|
| 54 |
'rid' => 1,
|
| 55 |
);
|
| 56 |
}
|
| 57 |
|
| 58 |
/**
|
| 59 |
* Hide a node or comment.
|
| 60 |
*
|
| 61 |
* Frequently required
|
| 62 |
* @see HiddenHideUnitCase::testHiddenHiddenHide() for the first testing.
|
| 63 |
*
|
| 64 |
* @param $settings
|
| 65 |
* array of settings
|
| 66 |
* defaults ... 'type' 'node' but can be node type ....
|
| 67 |
*
|
| 68 |
* @return object
|
| 69 |
* object without delay, only id (not nid|cid), or reason title.
|
| 70 |
*/
|
| 71 |
function hiddenCreateHidden($settings = array()) {
|
| 72 |
$defaults = array(
|
| 73 |
'type' => 'node',
|
| 74 |
'rid' => 1,
|
| 75 |
'publicnote' => $this->randomName(52),
|
| 76 |
'privatenote' => $this->randomName(34),
|
| 77 |
'filter' => FALSE,
|
| 78 |
);
|
| 79 |
// a specific node type is passed rather than 'node' or 'comment'
|
| 80 |
if (isset($settings['node_type'])) {
|
| 81 |
$node_type = $settings['node_type'];
|
| 82 |
}
|
| 83 |
else {
|
| 84 |
$node_type = 'story';
|
| 85 |
}
|
| 86 |
if (empty($settings['id'])) {
|
| 87 |
if (isset($settings['type']) && $settings['type'] == 'comment') {
|
| 88 |
$comment = $this->hiddenCreateComment(array('type' => $node_type));
|
| 89 |
$defaults['id'] = $comment->cid;
|
| 90 |
}
|
| 91 |
else {
|
| 92 |
$new_user = $this->drupalCreateUser(array("create $node_type content"));
|
| 93 |
$node = $this->drupalCreateNode(array('uid' => $new_user->uid, 'type' => $node_type));
|
| 94 |
$defaults['id'] = $node->nid;
|
| 95 |
}
|
| 96 |
}
|
| 97 |
if (empty($settings['uid'])) {
|
| 98 |
global $user;
|
| 99 |
$defaults['uid'] = $user->uid;
|
| 100 |
}
|
| 101 |
$hide = ($settings + $defaults);
|
| 102 |
$result = hidden_hidden_hide($hide['type'], $hide['id'], $hide['uid'], $hide['rid'], $hide['publicnote'], $hide['privatenote'], $hide['filter']);
|
| 103 |
$this->assertTrue($result, t('Hidden %type record created.', array('%type' => $hide['type'])));
|
| 104 |
return (object) $hide;
|
| 105 |
}
|
| 106 |
|
| 107 |
/**
|
| 108 |
* Report a node or comment.
|
| 109 |
*
|
| 110 |
* @see HiddenHideUnitCase::testHiddenReportedHide() for first testing.
|
| 111 |
*
|
| 112 |
* @return object
|
| 113 |
*/
|
| 114 |
function hiddenCreateReported($settings = array()) {
|
| 115 |
$defaults = array(
|
| 116 |
'type' => 'node',
|
| 117 |
'rid' => 1,
|
| 118 |
'publicnote' => $this->randomName(73),
|
| 119 |
);
|
| 120 |
// a specific node type is passed rather than 'node' or 'comment'
|
| 121 |
if (isset($settings['node_type'])) {
|
| 122 |
$node_type = $settings['type'];
|
| 123 |
}
|
| 124 |
else {
|
| 125 |
$node_type = 'story';
|
| 126 |
}
|
| 127 |
if (empty($settings['id'])) {
|
| 128 |
$new_user = $this->drupalCreateUser(array('create '. $node_type .' content'));
|
| 129 |
$node = $this->drupalCreateNode(array('uid' => $new_user->uid, 'type' => $node_type));
|
| 130 |
$defaults['id'] = $node->nid;
|
| 131 |
}
|
| 132 |
if (empty($settings['uid'])) {
|
| 133 |
global $user;
|
| 134 |
$defaults['uid'] = $user->uid;
|
| 135 |
}
|
| 136 |
$reported = ($settings + $defaults);
|
| 137 |
$result = _hidden_reported_hide($reported['type'], $reported['id'], $reported['uid'], $reported['rid'], $reported['publicnote']);
|
| 138 |
$this->assertTrue($result, t('Report for %type created.', array('%type' => $reported['type'])));
|
| 139 |
return (object) $reported;
|
| 140 |
}
|
| 141 |
|
| 142 |
/**
|
| 143 |
* Create a comment.
|
| 144 |
*
|
| 145 |
* A first attempt at creating drupalCreateNode() like programatic comment creation.
|
| 146 |
* - comment_save() does user access checks
|
| 147 |
*
|
| 148 |
* @param $settings
|
| 149 |
* array all optional ('subject', 'comment', 'nid', 'cid', 'pid', 'format', 'status', 'uid', 'name'
|
| 150 |
* 'homepage', 'mail', 'timestamp')
|
| 151 |
*/
|
| 152 |
function hiddenCreateComment($settings = array()) {
|
| 153 |
$defaults = array(
|
| 154 |
'cid' => 0,
|
| 155 |
'subject' => $this->randomName(12),
|
| 156 |
'comment' => $this->randomName(53),
|
| 157 |
'pid' => 0,
|
| 158 |
'format' => FILTER_FORMAT_DEFAULT,
|
| 159 |
'status' => COMMENT_PUBLISHED,
|
| 160 |
);
|
| 161 |
if (empty($settings['uid'])) {
|
| 162 |
$posting_user = $this->drupalCreateUser(array("post comments without approval"));
|
| 163 |
$defaults['uid'] = $posting_user->uid;
|
| 164 |
}
|
| 165 |
if (empty($settings['nid'])) {
|
| 166 |
if (! isset($settings['type'])) {
|
| 167 |
$settings['type'] = 'story';
|
| 168 |
}
|
| 169 |
$posting_user = $this->drupalCreateUser(array("create {$settings['type']} content"));
|
| 170 |
$node = $this->drupalCreateNode(array('type' => $settings['type'], 'uid' => $posting_user->uid, 'comment' => COMMENT_NODE_READ_WRITE));
|
| 171 |
$defaults['nid'] = $node->nid;
|
| 172 |
}
|
| 173 |
$settings += $defaults;
|
| 174 |
$cid = comment_save($settings);
|
| 175 |
$comment = _comment_load($cid);
|
| 176 |
$this->assertEqual($comment->cid, $cid, t('Comment created'));
|
| 177 |
return $comment;
|
| 178 |
}
|
| 179 |
|
| 180 |
/**
|
| 181 |
* Create hidden reason.
|
| 182 |
*
|
| 183 |
* @see HiddenCoreUnitCase::testHiddenReason() for first test
|
| 184 |
*
|
| 185 |
* @param $settings
|
| 186 |
* array 'title' 'description' 'enabled'
|
| 187 |
* @return
|
| 188 |
* array as $settings plus 'rid'
|
| 189 |
*/
|
| 190 |
function hiddenCreateReason($settings = array()) {
|
| 191 |
$defaults = array(
|
| 192 |
'title' => $this->randomName(11),
|
| 193 |
'description' => $this->randomName(42),
|
| 194 |
'enabled' => 1,
|
| 195 |
);
|
| 196 |
$settings += $defaults;
|
| 197 |
$settings['rid'] = hidden_reason_create($settings['title'], $settings['description'], $settings['enabled']);
|
| 198 |
return $settings;
|
| 199 |
}
|
| 200 |
}
|
| 201 |
|
| 202 |
/**
|
| 203 |
* 'Unit' test: un/hiding nodes comments, add/remove/edit reasons
|
| 204 |
*/
|
| 205 |
class HiddenCoreUnitCase extends HiddenHelperCase {
|
| 206 |
/**
|
| 207 |
* Implementation of getInfo().
|
| 208 |
*/
|
| 209 |
function getInfo() {
|
| 210 |
return array(
|
| 211 |
'name' => t('Main functions test'),
|
| 212 |
'description' => t('Test main functions for hiding, reasons, filters.'),
|
| 213 |
'group' => t('Hidden'),
|
| 214 |
);
|
| 215 |
}
|
| 216 |
|
| 217 |
/**
|
| 218 |
* Testing unpublishing and republishing of comments and nodes.
|
| 219 |
*/
|
| 220 |
function testHiddenHiddenHideUnpublish() {
|
| 221 |
$node = $this->drupalCreateNode();
|
| 222 |
$this->assertTrue(node_load($node->nid), t('Node created.'));
|
| 223 |
|
| 224 |
// node - unpublish
|
| 225 |
$result = _hidden_hidden_hide_unpublish('node', $node->nid);
|
| 226 |
$this->assertTrue($result, t('No error unpublishing'));
|
| 227 |
$node = node_load($node->nid, NULL, TRUE);
|
| 228 |
$this->assertEqual($node->status, 0, t('Node unpublished'));
|
| 229 |
$this->assertEqual($node->comment, 1, t('Node commenting switched off'));
|
| 230 |
// node - republish
|
| 231 |
$result = _hidden_hidden_publish('node', $node->nid);
|
| 232 |
$this->assertTrue($result, t('No error publishing'));
|
| 233 |
$node = node_load($node->nid, NULL, TRUE);
|
| 234 |
$this->assertEqual($node->status, 1, t('Node published'));
|
| 235 |
// @todo comment settings may change see code
|
| 236 |
$this->assertEqual($node->comment, 2, t('Node commenting switched on'));
|
| 237 |
|
| 238 |
// comment - unpublish
|
| 239 |
$comment = $this->hiddenCreateComment();
|
| 240 |
$result = _hidden_hidden_hide_unpublish('comment', $comment->cid);
|
| 241 |
$this->assertTrue($result, 'No error unpublishing');
|
| 242 |
$comment = _comment_load($comment->cid);
|
| 243 |
$this->assertEqual($comment->status, COMMENT_NOT_PUBLISHED, t('Comment unpublished'));
|
| 244 |
// comment - republish
|
| 245 |
$result = _hidden_hidden_publish('comment', $comment->cid);
|
| 246 |
$this->assertTrue($result, t('No error publishing'));
|
| 247 |
$comment = _comment_load($comment->cid);
|
| 248 |
$this->assertEqual($comment->status, COMMENT_PUBLISHED, t('Comment published'));
|
| 249 |
}
|
| 250 |
|
| 251 |
/**
|
| 252 |
* Test hiding and retrieving of hidden comments and nodes.
|
| 253 |
*/
|
| 254 |
function testHiddenHiddenHide() {
|
| 255 |
// node - hide
|
| 256 |
$hidden_original = $this->hiddenCreateHidden();
|
| 257 |
$node = node_load($hidden_original->id, NULL, TRUE);
|
| 258 |
$hidden_retrieved = _hidden_hidden_get('node', $node->nid);
|
| 259 |
$this->assertTrue(is_object($hidden_retrieved), t('Hidden node record retrieved.'));
|
| 260 |
$this->assertEqual($hidden_retrieved->type, 'node', t('Correct type recorded.'));
|
| 261 |
$this->assertEqual($hidden_original->id, $hidden_retrieved->nid, t('Correct nid recorded'));
|
| 262 |
$this->assertEqual($hidden_retrieved->id, $node->nid, t('Correct id reported'));
|
| 263 |
$this->assertEqual($hidden_original->rid, $hidden_retrieved->rid, t('Correct reason recorded'));
|
| 264 |
$this->assertEqual($hidden_original->publicnote, $hidden_retrieved->publicnote, t('Correct public note recorded'));
|
| 265 |
$this->assertEqual($hidden_original->privatenote, $hidden_retrieved->privatenote, t('Correct private note recorded'));
|
| 266 |
// node - unhide
|
| 267 |
_hidden_hidden_unhide('node', $hidden_retrieved->id);
|
| 268 |
$this->assertFalse(_hidden_hidden_get('node', $hidden_retrieved->id), t('Node removed from hidden table'));
|
| 269 |
|
| 270 |
// comment - hide, different rid checked too (it's the only non changing)
|
| 271 |
$hidden_original = $this->hiddenCreateHidden(array('type' => 'comment', 'rid' => 18));
|
| 272 |
$comment = _comment_load($hidden_original->id);
|
| 273 |
$hidden_retrieved = _hidden_hidden_get('comment', $comment->cid);
|
| 274 |
$this->assertTrue(is_object($hidden_retrieved), t('Hidden node record retrieved.'));
|
| 275 |
$this->assertEqual($hidden_retrieved->type, 'comment', t('Correct type recorded.'));
|
| 276 |
$this->assertEqual($hidden_original->id, $hidden_retrieved->cid, t('Correct cid recorded'));
|
| 277 |
$this->assertEqual($hidden_retrieved->id, $comment->cid, t('Correct id reported'));
|
| 278 |
$this->assertEqual($hidden_original->rid, $hidden_retrieved->rid, t('Correct reason recorded'));
|
| 279 |
$this->assertEqual($hidden_original->publicnote, $hidden_retrieved->publicnote, t('Correct public note recorded'));
|
| 280 |
$this->assertEqual($hidden_original->privatenote, $hidden_retrieved->privatenote, t('Correct private note recorded'));
|
| 281 |
// comment - unhide
|
| 282 |
_hidden_hidden_unhide('comment', $hidden_retrieved->id);
|
| 283 |
$this->assertFalse(_hidden_hidden_get('comment', $hidden_retrieved->id), t('Comment removed from hidden table'));
|
| 284 |
|
| 285 |
// @todo variations - already hidden, timelapsed,
|
| 286 |
}
|
| 287 |
|
| 288 |
/**
|
| 289 |
* Test reporting and retrieving of reports of comments and nodes.
|
| 290 |
*/
|
| 291 |
function testHiddenReportedHide() {
|
| 292 |
$reported_orginal = $this->hiddenCreateReported();
|
| 293 |
// @todo when there is an individual inteface for editing/viewing reported or query it
|
| 294 |
}
|
| 295 |
|
| 296 |
/**
|
| 297 |
* Test creating, editing and removing reasons.
|
| 298 |
*/
|
| 299 |
function testHiddenReason() {
|
| 300 |
// Create reason and check it with retrieval functions
|
| 301 |
$reason_original = $this->hiddenCreateReason();
|
| 302 |
$this->assertTrue($reason_original['rid'] > 0, t('Reason rid created'));
|
| 303 |
$this->assertTrue(hidden_reason_check($reason_original['rid']), t('Reason check confirms a valid reason'));
|
| 304 |
$reason_retrieved = hidden_reason_get($reason_original['rid']);
|
| 305 |
foreach ($reason_original as $key => $value) {
|
| 306 |
$this->assertEqual($value, $reason_retrieved->$key, t('Correct %key retrieved', array('%key' => $key)));
|
| 307 |
}
|
| 308 |
|
| 309 |
// Disable reason and check
|
| 310 |
hidden_reason_disable($reason_original['rid']);
|
| 311 |
$reason_retrieved = hidden_reason_get($reason_original['rid'], FALSE, FALSE);
|
| 312 |
$this->assertFalse($reason_retrieved->enabled, t('Reason disabled'));
|
| 313 |
// And enable again
|
| 314 |
hidden_reason_enable($reason_original['rid']);
|
| 315 |
$reason_retrieved = hidden_reason_get($reason_original['rid'], FALSE, FALSE);
|
| 316 |
$this->assertTrue($reason_retrieved->enabled, t('Reason enabled'));
|
| 317 |
|
| 318 |
// Update reason and check
|
| 319 |
$reason_original['title'] = 'New title';
|
| 320 |
$reason_original['description'] = 'New description';
|
| 321 |
$update_rid = hidden_reason_update($reason_original['title'], $reason_original['description'], $reason_original['enabled'], $reason_original['rid']);
|
| 322 |
$this->assertEqual($reason_original['rid'], $update_rid, t('Reason updated'));
|
| 323 |
$reason_retrieved = hidden_reason_get($reason_original['rid'], FALSE, FALSE);
|
| 324 |
foreach ($reason_original as $key => $value) {
|
| 325 |
$this->assertEqual($value, $reason_retrieved->$key, t('Correct updated %key retrieved', array('%key' => $key)));
|
| 326 |
}
|
| 327 |
|
| 328 |
// Check next non-existing reason isn't reported as existing
|
| 329 |
$update_rid++;
|
| 330 |
$this->assertFalse(hidden_reason_check($update_rid), t('Non existing reason not found'));
|
| 331 |
$this->assertFalse(hidden_reason_get($update_rid, FALSE, FALSE), t('Non exisitng reason not retrieved'));
|
| 332 |
}
|
| 333 |
|
| 334 |
/**
|
| 335 |
* Test retrieving multiple reasons.
|
| 336 |
*/
|
| 337 |
function testHiddenReasonMultiple() {
|
| 338 |
// Adds a set or reasons
|
| 339 |
$reasons_original = array();
|
| 340 |
for ($i = 0; $i < 11; $i++) {
|
| 341 |
$reason = $this->hiddenCreateReason();
|
| 342 |
$reasons_original[$reason['rid']] = $reason;
|
| 343 |
}
|
| 344 |
|
| 345 |
// Retrieve all and ensure all new reasons saved
|
| 346 |
// (there is also the previous test ones, and the default...)
|
| 347 |
$reasons_retrieved = hidden_reason_get_all(FALSE, FALSE);
|
| 348 |
$equal = TRUE;
|
| 349 |
foreach ($reasons_original as $rid => $reason) {
|
| 350 |
foreach ($reason as $key => $value) {
|
| 351 |
if ($reasons_retrieved[$rid]->$key != $value) {
|
| 352 |
$equal = FALSE;
|
| 353 |
}
|
| 354 |
}
|
| 355 |
}
|
| 356 |
$this->assertTrue($equal, t('All reasons retrieved as originals'));
|
| 357 |
|
| 358 |
// disable one of the reasons
|
| 359 |
reset($reasons_original);
|
| 360 |
$reason = next($reasons_original);
|
| 361 |
// and check not returned when only want enabled ones
|
| 362 |
hidden_reason_disable($reason['rid']);
|
| 363 |
$reasons_retrieved = hidden_reason_get_all(TRUE, FALSE);
|
| 364 |
$this->assertFalse(isset($reasons_retrieved[$reason['rid']]), t('Disabled reason not retrieved'));
|
| 365 |
$this->assertTrue(isset($reasons_retrieved[++$reason['rid']]), t('Enabled reason retrieved'));
|
| 366 |
}
|
| 367 |
|
| 368 |
/**
|
| 369 |
* Test saving and loading filters.
|
| 370 |
*/
|
| 371 |
function testHiddenFilterSave() {
|
| 372 |
$original_preg = $sent_preg = (object) $this->preg_filter;
|
| 373 |
$original_text = $sent_text = (object) $this->text_filter;
|
| 374 |
|
| 375 |
$this->assertEqual(hidden_filter_save($sent_text), SAVED_NEW, t('New filter reported saved'));
|
| 376 |
$retrieved_text = hidden_filter_load($sent_text->hfid);
|
| 377 |
$equal = TRUE;
|
| 378 |
foreach ($original_text as $var => $value) {
|
| 379 |
if ($retrieved_text->$var != $value) {
|
| 380 |
$equal = FALSE;
|
| 381 |
}
|
| 382 |
}
|
| 383 |
$this->assertTrue($equal, t('Saved and retrieved filters equal'));
|
| 384 |
|
| 385 |
$this->assertEqual(hidden_filter_save($sent_preg), SAVED_NEW, t('New filter reported saved'));
|
| 386 |
$retrieved_preg = hidden_filter_load($sent_preg->hfid);
|
| 387 |
$equal = TRUE;
|
| 388 |
foreach ($original_preg as $var => $value) {
|
| 389 |
if ($retrieved_preg->$var != $value) {
|
| 390 |
$equal = FALSE;
|
| 391 |
}
|
| 392 |
}
|
| 393 |
$this->assertTrue($equal, t('Saved and retrieved filters equal'));
|
| 394 |
|
| 395 |
// Disable and enable a filter using function
|
| 396 |
hidden_filter_enable($sent_preg->hfid, FALSE);
|
| 397 |
$retrieved_preg = hidden_filter_load($sent_preg->hfid);
|
| 398 |
$this->assertFalse($retrieved_preg->enabled, t('Filter successfully disabled'));
|
| 399 |
hidden_filter_enable($sent_preg->hfid);
|
| 400 |
$retrieved_preg = hidden_filter_load($sent_preg->hfid);
|
| 401 |
$this->assertTrue($retrieved_preg->enabled, t('Filter successfully enabled'));
|
| 402 |
|
| 403 |
// Change and add some values
|
| 404 |
$sent_preg->title = 'updated preg filter title';
|
| 405 |
$sent_preg->rid = 0;
|
| 406 |
$sent_preg->privatenote = 'New filter hidden note';
|
| 407 |
hidden_filter_save($sent_preg);
|
| 408 |
$retrieved_preg = hidden_filter_load($sent_preg->hfid);
|
| 409 |
$equal = TRUE;
|
| 410 |
foreach ($sent_preg as $var => $value) {
|
| 411 |
if ($retrieved_preg->$var != $value) {
|
| 412 |
$equal = FALSE;
|
| 413 |
}
|
| 414 |
}
|
| 415 |
$this->assertTrue($equal, t('Edited and retrieved filters equal'));
|
| 416 |
|
| 417 |
$this->assertTrue(hidden_filter_delete($sent_preg->hfid), t('Filter reported deleted'));
|
| 418 |
$this->assertTrue(hidden_filter_delete($sent_text->hfid), t('Filter reported deleted'));
|
| 419 |
$this->assertFalse(hidden_filter_load($sent_preg->hfid), t('Deleted filter not retrieved'));
|
| 420 |
$this->assertFalse(hidden_filter_load($sent_text->hfid), t('Deleted filter not retrieved'));
|
| 421 |
}
|
| 422 |
|
| 423 |
/**
|
| 424 |
* Test running filters against content
|
| 425 |
*/
|
| 426 |
function testHiddenFilterContentTest() {
|
| 427 |
$no_match = 'This is text that should not match with any filter. With';
|
| 428 |
$first_match = 'This is some text to filter that should match With both of the filters.';
|
| 429 |
$preg_match = 'This should match only With the preg filter.';
|
| 430 |
$text_match = 'This text to filter should only match the text filter.';
|
| 431 |
$text_filter = (object) $this->text_filter;
|
| 432 |
$preg_filter = (object) $this->preg_filter;
|
| 433 |
|
| 434 |
hidden_filter_save($text_filter);
|
| 435 |
hidden_filter_save($preg_filter);
|
| 436 |
|
| 437 |
$result = _hidden_filter_content_test($no_match);
|
| 438 |
$this->assertFalse($result, t('Filter did not no_match text correctly'));
|
| 439 |
$result = _hidden_filter_content_test($first_match);
|
| 440 |
$this->assertTrue($result != FALSE, t('Filter matched first_match correctly'));
|
| 441 |
$this->assertEqual($preg_filter->hfid, $result->hfid, t('Preg filter correctly matched first by weight'));
|
| 442 |
$result = _hidden_filter_content_test($preg_match);
|
| 443 |
$this->assertTrue($result != FALSE, t('Filter matched preg_match correctly'));
|
| 444 |
$this->assertEqual($preg_filter->hfid, $result->hfid, t('Preg filter correctly matched'));
|
| 445 |
$result = _hidden_filter_content_test($text_match);
|
| 446 |
$this->assertTrue($result != FALSE, t('Filter matched text_match correctly'));
|
| 447 |
$this->assertEqual($text_filter->hfid, $result->hfid, t('Text filter correctly matched'));
|
| 448 |
}
|
| 449 |
|
| 450 |
/**
|
| 451 |
* Test hiding by filters
|
| 452 |
*/
|
| 453 |
function testHiddenFilterContent() {
|
| 454 |
$text_filter = (object) $this->text_filter;
|
| 455 |
$preg_filter = (object) $this->preg_filter;
|
| 456 |
hidden_filter_save($text_filter);
|
| 457 |
hidden_filter_save($preg_filter);
|
| 458 |
|
| 459 |
$text_node = $this->drupalCreateNode(array('body' => "A first simpler text to filter that should get hidden automatically when passed through the filter function"));
|
| 460 |
$preg_node = $this->drupalCreateNode(array('body' => "Another set of text some of which will match the preg test.\nWith this we can check to see if the node is unpublished and has the correct hidden information attached to it and also if the gets set correctly."));
|
| 461 |
|
| 462 |
// Text node first
|
| 463 |
$this->assertTrue(hidden_filter_content($text_node->body, 'node', $text_node->nid), t('Node reported as hidden'));
|
| 464 |
$hidden = _hidden_hidden_get('node', $text_node->nid);
|
| 465 |
$this->assertEqual($hidden->rid, $text_filter->rid, t('Text filter reason recorded'));
|
| 466 |
$this->assertEqual($hidden->publicnote, $text_filter->publicnote, t('Text filter publicnote recorded'));
|
| 467 |
$this->assertEqual($hidden->privatenote, $text_filter->privatenote, t('Text filter privatenote recorded'));
|
| 468 |
$this->assertEqual($hidden->uid, $text_filter->uid, t('Text filter user recorded'));
|
| 469 |
$text_node = node_load($text_node->nid, NULL, TRUE);
|
| 470 |
$this->assertEqual($text_node->status, 0, t('Node unpublished'));
|
| 471 |
|
| 472 |
// Then the preg text
|
| 473 |
$this->assertTrue(hidden_filter_content($preg_node->body, 'node', $preg_node->nid), t('Node reported as hidden'));
|
| 474 |
$hidden = _hidden_hidden_get('node', $preg_node->nid);
|
| 475 |
$this->assertEqual($hidden->rid, $preg_filter->rid, t('Preg filter reason recorded'));
|
| 476 |
$this->assertEqual($hidden->publicnote, '', t('Preg filter lack of public note recorded'));
|
| 477 |
$this->assertTrue($hidden->delay > time(), t('Hide delay time set'));
|
| 478 |
$preg_node = node_load($preg_node->nid, NULL, TRUE);
|
| 479 |
$this->assertEqual($preg_node->status, 1, t('Node not yet unpublished'));
|
| 480 |
}
|
| 481 |
}
|
| 482 |
|
| 483 |
/**
|
| 484 |
* Functional test: hiding nodes and comments.
|
| 485 |
*
|
| 486 |
* Also tests the hide_user view of the hidden item page, may move to Pages class
|
| 487 |
* if further seperation of actions and ui is wanted.
|
| 488 |
*/
|
| 489 |
class HiddenHideTestCase extends HiddenHelperCase {
|
| 490 |
/**
|
| 491 |
* Implementation of getInfo().
|
| 492 |
*/
|
| 493 |
function getInfo() {
|
| 494 |
return array(
|
| 495 |
'name' => t('Hide node and comments'),
|
| 496 |
'description' => t('Hide a node and a comment, check unpublished and in hidden database.'),
|
| 497 |
'group' => t('Hidden'),
|
| 498 |
);
|
| 499 |
}
|
| 500 |
|
| 501 |
function testPageView() {
|
| 502 |
$node = $this->drupalCreateNode();
|
| 503 |
$this->assertTrue(node_load($node->nid), t('Node created.'));
|
| 504 |
$hidden = $this->hiddenCreateHidden();
|
| 505 |
|
| 506 |
$this->drupalLogin($this->web_user);
|
| 507 |
$this->drupalGet(hidden_path('node', $hidden->id, 'view'));
|
| 508 |
$this->assertResponse(403, t('Unprivileged user cannot access hidden view page'));
|
| 509 |
$this->drupalGet(hidden_path('node', $node->nid, 'hide'));
|
| 510 |
$this->assertResponse(403, t('Unprivileged user cannot access node hide page'));
|
| 511 |
$this->drupalGet(hidden_path('node', $node->nid, 'report'));
|
| 512 |
$this->assertResponse(403, t('Unprivileged user cannot access node report page'));
|
| 513 |
$this->drupalLogout();
|
| 514 |
|
| 515 |
$this->drupalLogin($this->view_user);
|
| 516 |
$this->drupalGet(hidden_path('node', $hidden->id, 'view'));
|
| 517 |
$this->assertResponse(200, t('View user can access hidden view page'));
|
| 518 |
$this->drupalGet(hidden_path('node', $node->nid, 'hide'));
|
| 519 |
$this->assertResponse(403, t('View user cannot access node hide page'));
|
| 520 |
$this->drupalGet(hidden_path('node', $node->nid, 'report'));
|
| 521 |
$this->assertResponse(403, t('View user cannot access node report page'));
|
| 522 |
$this->drupalGet(hidden_path('node', $node->nid, 'view'));
|
| 523 |
$this->assertResponse(404, t('View user cannot view unhidden node on hidden view page'));
|
| 524 |
$this->drupalLogout();
|
| 525 |
|
| 526 |
$this->drupalLogin($this->report_user);
|
| 527 |
$this->drupalGet(hidden_path('node', $hidden->id, 'view'));
|
| 528 |
$this->assertResponse(403, t('Report user cannot access hidden view page'));
|
| 529 |
$this->drupalGet(hidden_path('node', $node->nid, 'hide'));
|
| 530 |
$this->assertResponse(403, t('Report user cannot access node hide page'));
|
| 531 |
$this->drupalGet(hidden_path('node', $node->nid, 'report'));
|
| 532 |
$this->assertResponse(200, t('Report user can access node report page'));
|
| 533 |
$this->drupalGet(hidden_path('node', $hidden->id, 'report'));
|
| 534 |
$this->assertText(t('Item is already hidden.'), t('Already hidden message displayed'));
|
| 535 |
$this->drupalLogout();
|
| 536 |
|
| 537 |
$this->drupalLogin($this->hide_user);
|
| 538 |
$this->drupalGet(hidden_path('node', $node->nid, 'hide'));
|
| 539 |
$this->assertResponse(200, t('User can access hide page'));
|
| 540 |
$this->drupalGet(hidden_path('node', $hidden->id, 'hide'));
|
| 541 |
$this->assertText(t('Item is already hidden.'), t('Already hidden message displayed'));
|
| 542 |
$this->drupalGet('node/'. $hidden->id);
|
| 543 |
$this->assertResponse(403, t('Hidden cannot be accessed at original url'));
|
| 544 |
$this->drupalLogout();
|
| 545 |
}
|
| 546 |
|
| 547 |
|
| 548 |
function testHiddenHide() {
|
| 549 |
// Create user to hide content.
|
| 550 |
$this->drupalLogin($this->hide_user);
|
| 551 |
|
| 552 |
// make node to hide
|
| 553 |
$node = $this->drupalCreateNode(array('type' => 'article'));
|
| 554 |
|
| 555 |
// Submit hide form
|
| 556 |
$hide = array(
|
| 557 |
// 'user' => $hide_user->name, // @todo test administer hidden where it can be set
|
| 558 |
'reason' => 1,
|
| 559 |
// @todo length restriction 128 - correct or not
|
| 560 |
'publictext' => $this->randomName(108),
|
| 561 |
'privatetext' => $this->randomName(33),
|
| 562 |
);
|
| 563 |
$this->drupalPost(hidden_path('node', $node->nid, 'hide'), $hide, t('Hide'));
|
| 564 |
$this->assertText(t('Hidden node'), t('Node reported hidden'));
|
| 565 |
$this->assertText($hide['publictext'], t('Public text posted'));
|
| 566 |
$this->assertText($hide['privatetext'], t('Private text posted'));
|
| 567 |
// @todo check reason is displayed in words
|
| 568 |
// note view_user check is HiddenUserPagesTestCase::testHiddenViewPage()
|
| 569 |
|
| 570 |
// Click the unhide link
|
| 571 |
$this->clickLink(t('unhide'));
|
| 572 |
$this->assertText(t('Hidden node unhidden'));
|
| 573 |
$this->assertNoText($hide['publictext'], t('Hidden text not shown'));
|
| 574 |
$this->assertText($node->title, t('On page with node title %title visible', array('%title' => $node->title)));
|
| 575 |
|
| 576 |
// make comment to hide
|
| 577 |
$comment = $this->hiddenCreateComment();
|
| 578 |
$hide = array(
|
| 579 |
'reason' => 1,
|
| 580 |
'publictext' => $this->randomName(82),
|
| 581 |
'privatetext' => $this->randomName(12),
|
| 582 |
);
|
| 583 |
$this->drupalPost(hidden_path('comment', $comment->cid, 'hide'), $hide, t('Hide'));
|
| 584 |
$this->assertText(t('Hidden comment.'), t('Comment reported hidden'));
|
| 585 |
$this->assertText($hide['publictext'], t('Public text posted'));
|
| 586 |
$this->assertText($hide['privatetext'], t('Private text posted'));
|
| 587 |
|
| 588 |
$this->clickLink(t('unhide'));
|
| 589 |
$this->assertText(t('Hidden comment unhidden'));
|
| 590 |
$this->assertNoText($hide['publictext'], t('Hidden text not shown'));
|
| 591 |
$this->asserttext($comment->subject, t('On page with comment title %title visible', array('%title' => $comment->subject)));
|
| 592 |
}
|
| 593 |
|
| 594 |
function testHiddenReport() {
|
| 595 |
$this->drupalLogin($this->report_user);
|
| 596 |
$node = $this->drupalCreateNode(array('type' => 'article'));
|
| 597 |
|
| 598 |
// Submit report form
|
| 599 |
$report = array(
|
| 600 |
'reason' => 1,
|
| 601 |
'publictext' => $this->randomName(23),
|
| 602 |
);
|
| 603 |
$this->drupalPost(hidden_path('node', $node->nid, 'report'), $report, t('Report'));
|
| 604 |
$this->assertText(t('Reported node'), t('Node reported as reported'));
|
| 605 |
|
| 606 |
// @todo hide_user (?) to check the report
|
| 607 |
}
|
| 608 |
}
|
| 609 |
|
| 610 |
/**
|
| 611 |
* Functional test: User pages
|
| 612 |
*/
|
| 613 |
class HiddenUserPagesTestCase extends HiddenHelperCase {
|
| 614 |
/**
|
| 615 |
* Implementation of getInfo().
|
| 616 |
*/
|
| 617 |
function getInfo() {
|
| 618 |
return array(
|
| 619 |
'name' => t('View hidden node and comments user pages'),
|
| 620 |
'description' => t('View hidden nodes and comments on user pages.'),
|
| 621 |
'group' => t('Hidden'),
|
| 622 |
);
|
| 623 |
}
|
| 624 |
|
| 625 |
function testPageView() {
|
| 626 |
$node = $this->drupalCreateNode();
|
| 627 |
$this->assertTrue(node_load($node->nid), t('Node created.'));
|
| 628 |
$hidden = $this->hiddenCreateHidden();
|
| 629 |
|
| 630 |
$this->drupalLogin($this->web_user);
|
| 631 |
$this->drupalGet('hidden');
|
| 632 |
$this->assertResponse(403, t('Unprivileged user cannot access hidden node index'));
|
| 633 |
$this->drupalGet('hidden/node');
|
| 634 |
$this->assertResponse(403, t('Unprivileged user cannot access hidden node index'));
|
| 635 |
$this->drupalGet('hidden/comment');
|
| 636 |
$this->assertResponse(403, t('Unprivileged user cannot access hidden comment index'));
|
| 637 |
|
| 638 |
$this->drupalLogin($this->view_user);
|
| 639 |
$this->drupalGet('hidden');
|
| 640 |
$this->assertResponse(200, t('View user can access hidden node index'));
|
| 641 |
$this->drupalGet('hidden/node');
|
| 642 |
$this->assertResponse(200, t('View user can access hidden node index'));
|
| 643 |
$this->drupalGet('hidden/comment');
|
| 644 |
$this->assertResponse(200, t('View user can access hidden node index'));
|
| 645 |
}
|
| 646 |
|
| 647 |
function testHiddenViewPage() {
|
| 648 |
/* // Just one
|
| 649 |
$hidden = $this->hiddenCreateHidden();
|
| 650 |
$this->drupalLogin($this->view_user);
|
| 651 |
$this->drupalGet('hidden');
|
| 652 |
$node = node_load($hidden->id, NULL, TRUE);
|
| 653 |
$this->assertText($node->title);
|
| 654 |
$this->drupalGet(hidden_path('node', $hidden->id, 'view'));
|
| 655 |
$this->assertText($node->title);
|
| 656 |
$this->drupalLogout(); */
|
| 657 |
|
| 658 |
$hiddens = array();
|
| 659 |
// @todo what about testing page two
|
| 660 |
for ($i = 0; $i < 9; $i++) {
|
| 661 |
$hiddens[$i] = $this->hiddenCreateHidden();
|
| 662 |
$nothiddens[$i] = $this->drupalCreateNode();
|
| 663 |
}
|
| 664 |
|
| 665 |
// using theme('username', ) this cuts long usernames and changes on permissions so:
|
| 666 |
$view_user = $this->drupalCreateUser(array('access hidden', 'access user profiles'));
|
| 667 |
$this->drupalLogin($view_user);
|
| 668 |
// and check lots of hidden pages as well
|
| 669 |
foreach ($hiddens as $hidden) {
|
| 670 |
$this->drupalGet('hidden');
|
| 671 |
// @todo is there a simpletest way of bundling up these asserts?
|
| 672 |
$node = node_load($hidden->id, NULL, TRUE);
|
| 673 |
$this->assertText($node->title);
|
| 674 |
$user = user_load(array('uid' => $node->uid));
|
| 675 |
$this->assertRaw(theme('username', $user));
|
| 676 |
// @todo reasons again
|
| 677 |
$this->clickLink($node->title); // don't really need to run this everytime
|
| 678 |
$this->assertText($node->title, t('Node title visible on node hidden page'));
|
| 679 |
$this->assertText($hidden->publicnote, t('Public text posted'));
|
| 680 |
$this->assertNoText($hidden->privatenote, t('Private text not visible to view only user'));
|
| 681 |
$this->assertNoText(t('Unhide'), t('No unhide link visible to view only user'));
|
| 682 |
}
|
| 683 |
foreach ($nothiddens as $nothidden) {
|
| 684 |
// @todo is there a simpletest way of bundling up these asserts?
|
| 685 |
$node = node_load($nothidden->nid, NULL, TRUE);
|
| 686 |
$this->assertNoText($node->title);
|
| 687 |
$user = user_load(array('uid' => $node->uid));
|
| 688 |
$this->assertNoRaw(theme('username', $user));
|
| 689 |
}
|
| 690 |
$this->drupalLogout();
|
| 691 |
|
| 692 |
$hiddens = array();
|
| 693 |
// @todo what about testing page two
|
| 694 |
for ($i = 0; $i < 9; $i++) {
|
| 695 |
$hiddens[$i] = $this->hiddenCreateHidden(array('type' => 'comment'));
|
| 696 |
}
|
| 697 |
|
| 698 |
$this->drupalLogin($view_user);
|
| 699 |
foreach ($hiddens as $hidden) {
|
| 700 |
$this->drupalGet('hidden/comment');
|
| 701 |
// @todo is there a simpletest way of bundling up these asserts?
|
| 702 |
$comment = _comment_load($hidden->id);
|
| 703 |
$this->assertText($comment->subject);
|
| 704 |
$user = user_load(array('uid' => $comment->uid));
|
| 705 |
$this->assertRaw(theme('username', $user));
|
| 706 |
// @todo reasons again
|
| 707 |
$this->clickLink($comment->subject); // don't really need to run this everytime
|
| 708 |
$this->assertText($comment->subject, t('Node title visible on node hidden page'));
|
| 709 |
$this->assertText($hidden->publicnote, t('Public text posted'));
|
| 710 |
$this->assertNoText($hidden->privatenote, t('Private text not visible to view only user'));
|
| 711 |
$this->assertNoText(t('Unhide'), t('No unhide link visible to view only user'));
|
| 712 |
}
|
| 713 |
$this->drupalLogout();
|
| 714 |
}
|
| 715 |
}
|
| 716 |
|
| 717 |
/**
|
| 718 |
* Function test: Admin pages
|
| 719 |
*/
|
| 720 |
class HiddenAdminPagesTestCase extends HiddenHelperCase {
|
| 721 |
/**
|
| 722 |
* Implementation of getInfo().
|
| 723 |
*/
|
| 724 |
function getInfo() {
|
| 725 |
return array(
|
| 726 |
'name' => t('View and update module settings'),
|
| 727 |
'description' => t('View and change basic settings, reasons and filters on admin pages'),
|
| 728 |
'group' => t('Hidden'),
|
| 729 |
);
|
| 730 |
}
|
| 731 |
|
| 732 |
/**
|
| 733 |
* Test if correct users can view pages.
|
| 734 |
*/
|
| 735 |
function testPageView() {
|
| 736 |
$this->drupalLogin($this->hide_user);
|
| 737 |
// trivial but a quick run down
|
| 738 |
$this->drupalGet('admin/content/hidden');
|
| 739 |
$this->assertResponse(403);
|
| 740 |
// there should always be a reason 1, and by default it is enabled
|
| 741 |
$this->drupalGet('admin/content/hidden/reasons/edit/1');
|
| 742 |
$this->assertResponse(403);
|
| 743 |
$this->drupalGet('admin/content/hidden/reasons/disable/1');
|
| 744 |
$this->assertResponse(403);
|
| 745 |
$this->drupalGet('admin/content/hidden/reasons/enable/1');
|
| 746 |
$this->assertResponse(403);
|
| 747 |
$this->drupalGet('admin/content/hidden/filters');
|
| 748 |
$this->assertResponse(403);
|
| 749 |
$this->drupalLogout();
|
| 750 |
|
| 751 |
$this->drupalLogin($this->admin_user);
|
| 752 |
$this->drupalGet('admin/content/hidden');
|
| 753 |
$this->assertResponse(200);
|
| 754 |
$this->drupalGet('admin/content/hidden/reasons/edit/1');
|
| 755 |
$this->assertResponse(200);
|
| 756 |
$this->drupalGet('admin/content/hidden/reasons/disable/1');
|
| 757 |
$this->assertResponse(200, t('Admin can disable reason'));
|
| 758 |
$this->drupalGet('admin/content/hidden/reasons/enable/1');
|
| 759 |
$this->assertResponse(200, t('Admin can enable reason'));
|
| 760 |
$this->drupalGet('admin/content/hidden/filters');
|
| 761 |
$this->drupalLogout();
|
| 762 |
}
|
| 763 |
|
| 764 |
function testReasonViewPage() {
|
| 765 |
$this->drupalLogin($this->admin_user);
|
| 766 |
$this->drupalGet('admin/content/hidden');
|
| 767 |
$this->assertText(t('Policy Violation'), t('Default reason visible'));
|
| 768 |
// only default reason created so far, so there should be no other reasons
|
| 769 |
// so can easily just click enable disable links to check and test
|
| 770 |
$enable = '<a href="'. url('admin/content/hidden/reasons/enable/1') .'">';
|
| 771 |
$disable = '<a href="'. url('admin/content/hidden/reasons/disable/1') .'">';
|
| 772 |
$this->assertRaw($disable, t('Disable link visible'));
|
| 773 |
$this->assertNoRaw($enable, t('No enable link visible'));
|
| 774 |
$this->clickLink(t('disable'));
|
| 775 |
$this->assertText(t('Reason disabled'), t('Reason reported disabled'));
|
| 776 |
$this->assertRaw($enable, t('Enable link visible'));
|
| 777 |
$this->assertNoRaw($disable, t('No disable link visible'));
|
| 778 |
$this->clickLink(t('enable'));
|
| 779 |
$this->assertText(t('Reason enabled'), t('Reason reported enabled'));
|
| 780 |
$this->assertNoRaw($enable, t('No enable link visible'));
|
| 781 |
$this->assertRaw($disable, t('Disable link visible'));
|
| 782 |
|
| 783 |
$reasons = array();
|
| 784 |
// edit the default reason
|
| 785 |
$this->clickLink(t('edit'));
|
| 786 |
$edit = array(
|
| 787 |
'title' => $this->randomName(12),
|
| 788 |
'description' => $this->randomName(63),
|
| 789 |
'enabled' => 0,
|
| 790 |
);
|
| 791 |
$this->drupalPost(NULL, $edit, t('Submit'));
|
| 792 |
$this->assertRaw(t('%title has been updated.', array('%title' => $edit['title'])), t('Reason reported updated'));
|
| 793 |
// save reason for later
|
| 794 |
$reasons[] = $edit;
|
| 795 |
|
| 796 |
// add some more reasons and check if all can be seen
|
| 797 |
for ($i = 1; $i < 4; $i++) {
|
| 798 |
// create a new reason
|
| 799 |
$this->clickLink(t('Add new reason'));
|
| 800 |
$edit = array(
|
| 801 |
'title' => $this->randomName(21),
|
| 802 |
'description' => $this->randomName(57),
|
| 803 |
);
|
| 804 |
$this->drupalPost(NULL, $edit, t('Submit'));
|
| 805 |
$this->assertRaw(t('%title has been added.', array('%title' => $edit['title'])), t('Reason reported added'));
|
| 806 |
$reasons[$i] = $edit;
|
| 807 |
}
|
| 808 |
$this->drupalGet('admin/content/hidden');
|
| 809 |
foreach ($reasons as $reason) {
|
| 810 |
$this->assertText($reason['title'], t('%title listed', array('%title' => $reason['title'])));
|
| 811 |
}
|
| 812 |
}
|
| 813 |
|
| 814 |
function testHiddenFiltersViewPage() {
|
| 815 |
$this->drupalLogin($this->admin_user);
|
| 816 |
|
| 817 |
$this->drupalGet('admin/content/hidden/filters');
|
| 818 |
$this->clickLink(t('Add new filter'));
|
| 819 |
|
| 820 |
$text_filter = $this->text_filter;
|
| 821 |
$user = user_load($text_filter['uid']);
|
| 822 |
$text_filter['user'] = $user->name;
|
| 823 |
unset($text_filter['uid']);
|
| 824 |
$text_filter['reason'] = $text_filter['rid'];
|
| 825 |
unset($text_filter['rid']);
|
| 826 |
$text_filter['publictext'] = $text_filter['publicnote'];
|
| 827 |
unset($text_filter['publicnote']);
|
| 828 |
$text_filter['privatetext'] = $text_filter['privatenote'];
|
| 829 |
unset($text_filter['privatenote']);
|
| 830 |
|
| 831 |
$this->drupalPost(NULL, $text_filter, t('Submit'));
|
| 832 |
|
| 833 |
$this->assertText($text_filter['title']);
|
| 834 |
// not certain of hfid but there is only one
|
| 835 |
$enable = '<a href="'. url('admin/content/hidden/filters/enable/') .'\d+">';
|
| 836 |
$disable = '<a href="'. url('admin/content/hidden/filters/disable/') .'\d+">';
|
| 837 |
$edit = '<a href="'. url('admin/content/hidden/filters/edit/'). '\d+">';
|
| 838 |
// check links as enabling and disabling sole filter
|
| 839 |
$this->assertPattern($disable, t('Disable link visible'));
|
| 840 |
$this->assertPattern($edit, t('Edit link visible'));
|
| 841 |
$this->assertNoPattern($enable, t('No enable link visible'));
|
| 842 |
$this->clickLink(t('disable'));
|
| 843 |
$this->assertPattern($enable, t('Enable link visible'));
|
| 844 |
$this->assertNoPattern($disable, t('No disable link visible'));
|
| 845 |
$this->assertPattern($edit, t('Edit link visible'));
|
| 846 |
$this->clickLink(t('enable'));
|
| 847 |
$this->assertNoPattern($enable, t('No enable link visible'));
|
| 848 |
$this->clickLink(t('edit'));
|
| 849 |
// change title
|
| 850 |
$text_filter['title'] = $this->randomName(17);
|
| 851 |
$this->drupalPost(NULL, array('title' => $text_filter['title']), t('Submit'));
|
| 852 |
$this->assertText($text_filter['title']);
|
| 853 |
// @todo weights
|
| 854 |
}
|
| 855 |
}
|