/[drupal]/contributions/modules/simple_access/simple_access.test
ViewVC logotype

Contents of /contributions/modules/simple_access/simple_access.test

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Tue Oct 6 05:45:53 2009 UTC (7 weeks, 2 days ago) by gordon
Branch: MAIN
CVS Tags: DRUPAL-7--2-0-ALPHA1, HEAD
Changes since 1.1: +54 -0 lines
File MIME type: text/x-php
* Update Simple Access from 6.x-2.x branch
1 <?php
2 // $Id: simple_access.test,v 1.1.2.1 2008/10/01 07:45:00 gordon Exp $
3
4 /**
5 * @file
6 * Tests to check that simple access is working correctly
7 */
8
9 /**
10 * Test Owner permissions
11 */
12 class SimpleAccessOwnerTestCase extends DrupalWebTestCase {
13 function getInfo() {
14 return array(
15 'name' => t('Check owner permissions'),
16 'description' => t('Test different owner permissions and make sure access is correct'),
17 'group' => t('Simple Access'),
18 );
19 }
20
21 function setUp() {
22 parent::setUp('simple_access');
23
24 $this->node_type = $this->drupalCreateContentType();
25
26 node_access_rebuild();
27
28 }
29
30 function testSimpleAccessOwnerCanEdit() {
31 $account = $this->drupalCreateUser();
32 $n1 = $this->drupalCreateNode(array(
33 'type' => $this->node_type,
34 'uid' => $account->uid,
35 'status' => 1,
36 'simple_access_owner' => array('sa_view' => 1),
37 ));
38 $n2 = $this->drupalCreateNode(array(
39 'type' => $this->node_type,
40 'uid' => $account->uid,
41 'status' => 1,
42 'simple_access_owner' => array('sa_view' => 1, 'sa_update' => 1),
43 ));
44
45 $n1 = node_load($n1->nid);
46 $n1->status = 1;
47 $this->assertFalse(node_access('update', $n1, $account), t('Owner doesn\'t have edit access to content'), 'Access');
48
49 $n2 = node_load($n2->nid);
50 $n2->status = 1;
51 $this->assertTrue(node_access('update', $n2, $account), t('Owner has edit access to content'), 'Access');
52 }
53 }
54

  ViewVC Help
Powered by ViewVC 1.1.2