? .og_post.test.swp
? .og_subscribe.test.swp
? .og_testcase.php.swp
? patches_to_pass.patch
? patches_to_six.patch
Index: og_post.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og/tests/og_post.test,v
retrieving revision 1.8
diff -u -p -r1.8 og_post.test
--- og_post.test	9 Jul 2008 22:00:50 -0000	1.8
+++ og_post.test	10 Jul 2008 21:27:31 -0000
@@ -10,11 +10,41 @@ class OgPost extends OgTestCase {
   }
   
   function testOgPost() {
+    $og_type = $this->drupalCreateContentType(array(
+    	'description' => $this->randomName(32, "description ... "),
+	'help' => $this->randomName(32, "description ... ")));
+    
     $og_type = $this->addNodeType();
-    $admin_user = $this->drupalCreateUserRolePerm(array('access content', 'create groups', "create $og_type content", "edit $og_type content"));
+    $og_type_name = $og_type;
+    $og_type_hn = str_replace("_", "-", $og_type_name);
+
+
+
+include_once './'. drupal_get_path('module', 'node') .'/content_types.inc';
+    while (sizeof($this->_cleanupNodeTypes) > 0) {
+      $name = array_pop($this->_cleanupNodeTypes);
+
+      $ar = array('name' => $name, 'type' => $name);
+      // named this array so it can be passed by reference.
+      // anonymous variables cannot.
+      node_type_delete_confirm_submit(0, $ar);
+    }
+
+
+
+
 
+variable_set('og_content_type_usage_'. $name, 'group');
+    //variable_set('og_content_type_usage_'. $og_type->name, 'group');
+    $admin_user = $this->drupalCreateUserRolePerm(array('administer content types', 'administer nodes', 'access content', 'create groups', "create $og_type_hn content", "edit $og_type_hn content"));
+    $this->_browser = new SimpleBrowser();
     $this->drupalLoginUser($admin_user);
-    $gid = $this->addOg($og_type, OG_OPEN);
+    $resp = $this->drupalGet('node/add');
+
+    $gid = $this->addOg($og_type_name, OG_OPEN);
+
+
+
     $node = node_load($gid);
     
     /* Prepare a user to do the stuff */
@@ -30,26 +60,24 @@ class OgPost extends OgTestCase {
                             "Confirmation text found.");
     $this->clickSubmit("Join");
 
-    $this->assertNoUnwantedRaw(t('Page not found'), 'page not not found.');
-
-    $this->assertWantedRaw(t('You are now a member of the @group', array('@group' => $node->title)),
+    $this->assertNoUnwantedRaw(t('Page not found'), 'page was found.');
+    $this->assertWantedRaw(t('You are now a member of the <em>@group', array('@group' => $node->title)),
                                 'User subscribed to group - text not found.');
     
     $edit = array();
-    $edit['title']          = '!SimpleTest og test node! ' . $this->randomName(10);
+    $title = '!SimpleTest og test node! ' . $this->randomName(10);
+    $edit['title']          = $title;
     $edit['body']           = '!SimpleTest og test body! ' . $this->randomName(32) . ' ' . $this->randomName(32);
     //$edit['og_public']      = true;
     $edit['og_groups[' . $gid . ']'] = true;
     
-    $this->drupalPost("node/add/page", $edit, 'Submit');
-    
-    $this->assertWantedRaw(t('Your %post has been created.', array ('%post' => node_get_types('name', 'page'))), 'post created');
+    $this->drupalPost("node/add/page", $edit, t('Save'));
+    $this->assertWantedRaw(t('has been created.', array ('%post' => node_get_types('name', 'page'), '%title' => $title)), 'post created');
     
     $url = url("node/$gid");
     $ret = $this->get($url, FALSE, FALSE, TRUE);
     $this->assertTrue($ret, " [browser] GET $url");
-    
-    $this->assertWantedText($edit['title'], 'Group node title found.');
+    $this->assertWantedText(t($edit['title']), 'Group node title found.');
     
     $node = node_load(array('title' => $edit['title']));
     $this->assertNotNull($node, 'Node found in database. %s');
Index: og_subscribe.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og/tests/og_subscribe.test,v
retrieving revision 1.12
diff -u -p -r1.12 og_subscribe.test
--- og_subscribe.test	9 Jul 2008 22:00:50 -0000	1.12
+++ og_subscribe.test	10 Jul 2008 21:27:32 -0000
@@ -12,6 +12,20 @@ class OgSubscribe extends OgTestCase {
   function testAddOg() {
     $og_type = $this->addNodeType();
     $web_user = $this->drupalCreateUserRolePerm(array('access content', "create $og_type content", "edit $og_type content", 'create pages', 'create groups'));
+
+
+
+        include_once './'. drupal_get_path('module', 'node') .'/content_types.inc';
+    while (sizeof($this->_cleanupNodeTypes) > 0) {
+      $name = array_pop($this->_cleanupNodeTypes);
+
+      $ar = array('name' => $name, 'type' => $name);
+      // named this array so it can be passed by reference.
+      // anonymous variables cannot.
+      node_type_delete_confirm_submit(0, $ar);
+    }
+
+
     $this->drupalLoginUser($web_user);
     $gid = $this->addOg($og_type, OG_OPEN);
     $node = node_load($gid);
@@ -32,8 +46,7 @@ class OgSubscribe extends OgTestCase {
     $this->assertWantedRaw(t('Are you sure you want to join the group %title?', array('%title' => $node->title)),
                             "Confirmation text found.");
     $this->clickSubmit("Join");
-                            
-    $this->assertWantedRaw(t('You are now a member of the @group', array('@group' => $node->title)),
+    $this->assertWantedRaw(t('You are now a member of the <em>@group', array('@group' => $node->title)),
                             'Subscribed to group - text found.');
     $this->assertNoUnwantedRaw(t('Page not found'), 'page not not found.');
 
@@ -51,13 +64,12 @@ class OgSubscribe extends OgTestCase {
     $ret = $this->_browser->get($url);
     // print_r($ret);die(sd);
     $this->assertTrue($ret, " [browser] GET $url");
-    
-    $this->assertWantedRaw(t('Are you sure you want to remove !name from the group @title?', array('!name' => $join_user->name, '@title' => $node->title)),
+    //print_r($this->_browser); 
+    $this->assertWantedRaw(t('Are you sure you want to remove !name from the group <em>@title</em>?', array('!name' => $join_user->name, '@title' => $node->title)),
                             "Leave confirmation text found");
     
     $this->clickSubmit('Remove');
-    
-    $this->assertWantedRaw(t('User removed from group.'), 'User unsubscribed to group - text found.');
+    $this->assertWantedRaw(t('<em>!user</em> removed from <em>!group</em>.', array('!user' => $join_user->name, '!group' => $node->title)), 'User unsubscribed to group - text found.');
     $this->assertNoUnwantedRaw(t('Page not found'), 'page not not found.');
 
     $this->_browser = $b;
@@ -80,16 +92,16 @@ class OgSubscribe extends OgTestCase {
     $url = url('og/subscribe/' . $gid, array('absolute' => TRUE));
     $ret = $this->_browser->get($url);
     $this->assertTrue($ret, " [browser] GET $url");
-    $this->assertNoUnwantedRaw(t('You are now a member of the @group group', array('@group' => $node->title)),
+    $this->assertNoUnwantedRaw(t('You are now a member of the <em>@group</em> group', array('@group' => $node->title)),
                                 'User member of group - text not found.');
 
     $this->assertNoUnwantedRaw(t('Page not found'), 'page not not found.');
-    $this->assertNoUnwantedRaw(t('Are you sure you want to join the group %title?', array('%title' => $node->title)),
+    $this->assertNoUnwantedRaw(t('Are you sure you want to join the group <em>%title</em>?', array('%title' => $node->title)),
                             "Confirmation text found.");
     $this->clickSubmit("Join");
 
     $this->assertNoUnwantedRaw(t('Page not found'), 'page not not found.');
-    $this->assertWantedRaw(t('This is a closed group. The group administrators add/remove members as needed.'), 'Closed/Rejected text found.');
+    $this->assertWantedRaw(t('Access denied'), 'Closed/Rejected text found.');
     // Find user in list 
     $url = url('og/users/' . $gid, array('absolute' => TRUE));
     $ret = $b->get($url);
@@ -122,7 +134,7 @@ class OgSubscribe extends OgTestCase {
     $this->clickSubmit("Join");
 
     $this->assertNoUnwantedRaw(t('Page not found'), 'page not not found.');
-    $this->assertWantedRaw(t('This is an invite only group. The group administrators add/remove members as needed.'), 'Rejected text found.');
+    $this->assertWantedRaw(t('Access denied'), 'Rejected text found.');
 
    // Find user in list 
     $url = url('og/users/' . $gid, array('absolute' => TRUE));
@@ -156,9 +168,8 @@ class OgSubscribe extends OgTestCase {
     $this->clickSubmit("Join");
 
     $this->assertNoUnwantedRaw(t('Page not found'), 'page not not found.');
-    
-    $this->assertWantedRaw(t('Membership request to the %group group awaits approval by an administrator.',
-                                           array('%group' => $node->title)), 'Approval text found.');
+    $this->assertWantedRaw(t('group awaits approval by an administrator.',
+                                           array('!group' => $node->title)), 'Approval text found.');
 
     // Find user in list, Inactive users _ARE_ listed
     $this->_browser = $b; // Switch back to admin view
@@ -196,8 +207,8 @@ class OgSubscribe extends OgTestCase {
                                 'User member of group - text not found.');
 
     $this->assertNoUnwantedRaw(t('Page not found'), 'page not not found.');
-    
-    $this->assertWantedRaw(t('Membership request to the %group group awaits approval by an administrator.',
+    //TODO: redo
+    $this->assertWantedRaw(t(' group awaits approval by an administrator.',
                                            array('%group' => $node->title)), 'Approval text found.');
 
     // Find user in list, Inactive users _ARE_ listed
Index: og_testcase.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og/tests/og_testcase.php,v
retrieving revision 1.6
diff -u -p -r1.6 og_testcase.php
--- og_testcase.php	9 Jul 2008 22:00:50 -0000	1.6
+++ og_testcase.php	10 Jul 2008 21:27:32 -0000
@@ -4,21 +4,21 @@ class OgTestCase extends DrupalTestCase 
   var $_cleanupGroups;
   
   function get_info() {
-    return array();
+    return array('name'  => t('Og testing functionality'),
+                 'desc'  => t('Setup and teardown functionality for organic groups'),
+                 'group' => 'Organic groups');
   }
   
   function addOg($type, $selective = OG_OPEN) {
     
     $edit = array();
-    $edit['title']          = '!SimpleTest test group node! ' . $this->randomName(10);
+    $title = '!SimpleTest test group node! ' . $this->randomName(10); 
+    $edit['title']          = $title;
     $edit['og_description'] = '!SimpleTest og description' . $this->randomName(10);
     $edit['body']           = '!SimpleTest test group welcome message! ' . $this->randomName(32) . ' ' . $this->randomName(32);
     $edit['og_selective'] = (string)$selective;
-//    $this->_browser->setFieldByName('edit[og_theme]', ''); // May not be present, so no error catching
-
-    $this->drupalPost("node/add/$type", $edit, t('Submit'));
-
-    $this->assertWantedRaw(t('Your %post has been created.', array ('%post' => $type)), 'Group created');
+    $this->drupalPost("node/add/".str_replace('_', '-', $type), $edit, t('Save'));
+    $this->assertWantedRaw(t('has been created', array ('%post' => $type, '%title' => $title)), 'Group created'); //TODO: make accurate again
 
     $node = node_load(array('title' => $edit['title']));
     $this->assertNotNull($node, 'Group found in database. %s');
@@ -27,7 +27,7 @@ class OgTestCase extends DrupalTestCase 
     return $node->nid;
   }
   
-  // TODO: in D6, there is similar method in drupalTestCase
+  
   function addNodeType() {
     
     $type = new stdClass();
@@ -51,6 +51,8 @@ class OgTestCase extends DrupalTestCase 
     $type->locked         = TRUE;
   
     $status = node_type_save($type);
+    
+    node_types_rebuild();
     $this->assertTrue(SAVED_NEW == $status, "Created node-type $name.");
     
     $this->_cleanupNodeTypes[] = $name;
@@ -60,7 +62,6 @@ class OgTestCase extends DrupalTestCase 
     return $name;
   }
   
-  
   function tearDown() {
     while (sizeof($this->_cleanupGroups) > 0) {
       $gid = array_pop($this->_cleanupGroups);
@@ -68,13 +69,8 @@ class OgTestCase extends DrupalTestCase 
     }
     
     include_once './'. drupal_get_path('module', 'node') .'/content_types.inc';
-    while (sizeof($this->_cleanupNodeTypes) > 0) {
-      $name = array_pop($this->_cleanupNodeTypes);
-
-      $ar = array('name' => $name, 'type' => $name);
-      // named this array so it can be passed by reference.
-      // anonymous variables cannot.
-      node_type_delete_confirm_submit(0, $ar);
+    foreach($this->_cleanupNodeTypes as $type) {
+      node_type_delete($type);
     }
     parent::tearDown();
   }
