Skip to content
Snippets Groups Projects
Commit 14a7c908 authored by The Great Git Migration's avatar The Great Git Migration
Browse files

This commit was manufactured as part of Drupal's Great Git Migration to

create tag 'DRUPAL-6--2-0'.

Sprout from DRUPAL-6--1 2010-08-27 12:50:58 UTC Eugen Mayer <eugen.mayer@kontextwork.de> 'Adding new wording for warning of pending locks'
Delete:
    tests/content_lock.test
parent 830b5b47
No related branches found
No related tags found
No related merge requests found
<?php
// $Id$
/**
* @file
* Backport of Drupal 7 block.test with modifications, see BACKPORT.txt.
*
* Copyright 2008-2009 by Jimmy Berry ("boombatower", http://drupal.org/user/214218)
*/
class ContentLockTestCase extends DrupalWebTestCase {
/**
* Implementation of getInfo().
*/
public static function getInfo() {
return array(
'name' => 'Content lock functionality',
'description' => t('Tests locking'),
'group' => 'Edit',
);
}
/**
* Implementation of setUp().
*/
function setUp() {
parent::setUp('content_lock');
// Create and login user
$author = $this->drupalCreateUser(array('check out documents','edit any page content'));
$this->drupalLogin($author);
}
function testSetupNodeForLocking() {
// Add a new box by filling out the input form on the admin/build/block/add page.
/*$this->drupalPost('http://dst.l/admin/content/node-type/page',array(
))*/
}
function testConcurrentEditing() {
// TODO
}
function testLocking() {
// Add a new box by filling out the input form on the admin/build/block/add page.
$n = $this->DrupalCreateNode(array(
'type' => 'page', // This replaces the default type
));
$this->drupalGet('node/'.$n->nid.'/edit');
$this->assertTrue($this->_checkLock($n->nid,true),'Checking edit lock when user is editing');
}
function testLockingNotAllowed() {
// Add a new box by filling out the input form on the admin/build/block/add page.
$author = $this->drupalCreateUser(array('edit any page content'));
$this->drupalLogin($author);
$n = $this->DrupalCreateNode(array(
'type' => 'page', // This replaces the default type
));
$this->drupalGet('node/'.$n->nid.'/edit');
$this->assertTrue($this->_checkLock($n->nid,false),'Edit lock is not set, when user is editing and has no "checkout out decuments" permission');
}
protected function _checkLock($nid,$bool) {
$lock = content_lock_fetch_lock($nid);
if(is_object($lock) && $bool) {
return true;
}
else if($lock === false && $bool === false) {
return true;
}
// else
return true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment