View source
<?php
require_once drupal_get_path('module', 'og') . '/tests/og_testcase.php';
class OgWiki extends OgTestCase {
public static function getInfo() {
return array(
'name' => t('Organic groups wiki test'),
'description' => t('Tests posting a wiki post and editing it.'),
'group' => t('Organic groups'),
);
}
function setUp() {
parent::setUp('og', 'og_access');
$web_admin = $this
->drupalCreateUser(array(
'administer nodes',
'administer content types',
'access administration pages',
'administer site configuration',
'administer organic groups',
));
$this->web_admin = $web_admin;
$this
->drupalLogin($web_admin);
$web_user = $this
->drupalCreateUser(array(
'access content',
));
$this->web_user = $web_user;
}
function testOgWiki() {
$og_group_type = $this
->drupalCreateContentType();
variable_set('og_content_type_usage_' . $og_group_type->name, 'group');
$og_post_type = $this
->drupalCreateContentType();
variable_set('og_content_type_usage_' . $og_post_type->name, 'group_post_wiki');
menu_rebuild();
$gid = $this
->addOgGroup($og_group_type->name);
$nid = $this
->addOgPost($og_post_type->name, array(
$gid,
));
$this
->drupalLogin($this->web_user);
$this
->drupalGet("node/{$nid}/edit");
$this
->assertResponse(403, t('Non-group member got a 403 page while trying to access edit wiki post.'));
$this
->drupalGet('og/subscribe/' . $gid);
$this
->drupalPost(NULL, array(), t('Join'));
$this
->drupalGet("node/{$nid}/edit");
$this
->assertResponse(200, t('Group member is allowed to edit a wiki post.'));
}
}