Comments

rjgoldsborough’s picture

Status: Active » Needs review
StatusFileSize
new1.08 KB

This one is just a simple test that creates a team. I can write some more that would create a person first, and/or an organization.

Also, this test passes some, fails none, but has some exceptions. I haven't really been able to track down the problems. I am going to keep digging but was hoping to maybe get some more insight on the exceptions.

Status: Needs review » Needs work

The last submitted patch, storm_team_simple_test.patch, failed testing.

juliangb’s picture

The exceptions are PHP notices. You would notice these on an actual installation if you had error reporting set to the maximum.

rjgoldsborough’s picture

Yeah, I see them, but some of the errors seem to be untrue.

juliangb’s picture

Which errors seem untrue?

If you'd be keen to work on this, would it be possible to post a patch fixing those errors that you can see, and then we can look at what is left?

rjgoldsborough’s picture

There are multiple "trying to get a property from a non-object", but the line or variable in question seems to be an object.

juliangb’s picture

This generally means that the object has not been set yet, or that the code is trying to read from a variable within the object that has not been set.

I usually work around this by running an if(isset($object->variable)) or isset($object->variable) ? $object->variable : [insert default value here]

rjgoldsborough’s picture

Ahh good idea. Yeah, I had assumed they weren't being declared correctly before they were needed. Thanks, and I'll dig back into this.

rjgoldsborough’s picture

Assigned: Unassigned » rjgoldsborough

Figured out the errors. Patch coming soon.

rjgoldsborough’s picture

Status: Needs work » Needs review
StatusFileSize
new8.75 KB

Ok. So after fixing all the initial errors, I seem to have found some more, but I wanted to go ahead and post this patch as it does clear up quite a bit of PHP notices.

Status: Needs review » Needs work

The last submitted patch, storm_team_simple_test.patch, failed testing.

rjgoldsborough’s picture

Status: Needs work » Needs review

#10: storm_team_simple_test.patch queued for re-testing.

rjgoldsborough’s picture

StatusFileSize
new8.75 KB

Try again?

Status: Needs review » Needs work

The last submitted patch, storm_team_simple_test.patch, failed testing.

rjgoldsborough’s picture

Ok, that's what should have happened. Got it down to about 4 exceptions from 10 so another patch should be coming soon.

rjgoldsborough’s picture

StatusFileSize
new23.63 KB

OK. After some digging and testing, I think I have this test working and all the bugs fixed.

rjgoldsborough’s picture

Status: Needs work » Needs review

Forgot again...

juliangb’s picture

+++ ./stormperson/stormperson.module	2011-01-10 11:29:50.191097000 -0500
@@ -20,18 +20,18 @@ function stormperson_help($path, $arg) {
       $r = db_query("SELECT nid, organization_nid FROM {stormperson} WHERE user_uid=%d", $user->uid);
-      if ($r) {
+      if ($r->num_rows > 0) {
         $a = db_fetch_object($r);
         $user->stormperson_nid = $a->nid;
         $user->stormorganization_nid = $a->organization_nid;
       }

How about here we call _stormperson_user_load(...) to remove duplication?

+++ ./stormperson/stormperson.module	2011-01-10 11:29:50.191097000 -0500
@@ -521,7 +521,7 @@ function stormperson_user($type, &$edit,
   $r = db_query("SELECT nid, organization_nid FROM {stormperson} WHERE user_uid=%d", $account->uid);
-  if ($r) {
+  if ($r->num_rows > 0) {
     $a = db_fetch_object($r);

This can be more simply done as:

$a = db_fetch_object(db_query("SELECT...
if ($a) {
...
+++ ./stormteam/stormteam.module	2011-01-10 14:46:20.651120000 -0500
@@ -338,7 +342,9 @@ function stormteam_form(&$node) {
+  if (isset($additions->members_array)) {
+    $additions->members_array = unserialize($additions->members);
+  }

Should this be if (isset($additions->members))?

+++ ./stormteam/stormteam.module	2011-01-10 14:46:20.651120000 -0500
@@ -355,6 +361,7 @@ function stormteam_view($node) {
   return theme('stormteam_view', $node, $teaser, $page);
+ ¶
 }

Trailing whitespace.

+++ ./stormteam/stormteam.module	2011-01-10 14:46:20.651120000 -0500
@@ -385,11 +398,13 @@ function _stormteam_beforesave(&$node) {
+    db_query("INSERT INTO {stormteam}
+      (vid, nid, members) VALUES ¶
+      (%d, %d, '%s')",
+      $node->vid, $node->nid, $node->members

Trailing whitespace.

+++ ./stormteam/stormteam.test	2011-01-09 08:48:44.931106000 -0500
@@ -0,0 +1,30 @@
diff -urpN ../storm/storm_team_simple_test.patch ./storm_team_simple_test.patch

diff -urpN ../storm/storm_team_simple_test.patch ./storm_team_simple_test.patch
--- ../storm/storm_team_simple_test.patch	1969-12-31 19:00:00.000000000 -0500

--- ../storm/storm_team_simple_test.patch	1969-12-31 19:00:00.000000000 -0500
+++ ./storm_team_simple_test.patch	2011-01-10 14:51:47.741099960 -0500

This hunk shouldn't be in the patch.

Powered by Dreditor.

juliangb’s picture

Status: Needs review » Needs work
rjgoldsborough’s picture

Status: Needs work » Needs review
StatusFileSize
new5.67 KB

Cleaned up the previous patch with the mentioned points.

juliangb’s picture

Thanks for the updated patch. A couple of comments:

+++ ./stormperson/stormperson.module	2011-01-13 11:20:34.871118000 -0500
@@ -20,18 +20,17 @@ function stormperson_help($path, $arg) {
-    if ($user->uid && !$user->stormorganization_nid || !$user->stormperson_nid) {
-      $r = db_query("SELECT nid, organization_nid FROM {stormperson} WHERE user_uid=%d", $user->uid);
-      if ($r) {
-        $a = db_fetch_object($r);
+    if (isset($user->uid) && (!isset($user->stormorganization_nid)) || (!isset($user->stormperson_nid))) {
+      $a = db_fetch_object(db_query("SELECT nid, organization_nid FROM {stormperson} WHERE user_uid=%d", $user->uid));
+      if (!empty($a)) {
         $user->stormperson_nid = $a->nid;
         $user->stormorganization_nid = $a->organization_nid;
       }
     }

We could simplify this section by calling _stormperson_user_load(...)

+++ ./stormteam/stormteam.module	2011-01-13 11:16:23.811123000 -0500
@@ -315,7 +315,7 @@ function stormteam_form(&$node) {
-      '#default_value' => $node->$variable,
+      '#default_value' => (isset($variable)) ? $variable : NULL,

Just to clarify why this is now $variable rather than $node->$variable?

+++ ./stormteam/stormteam.module	2011-01-13 11:16:23.811123000 -0500
@@ -385,11 +390,13 @@ function _stormteam_beforesave(&$node) {
+      (vid, nid, members) VALUES ¶

Trailing whitespace. Not introduced by this patch, but good to remove.

Powered by Dreditor.

rjgoldsborough’s picture

StatusFileSize
new5.58 KB

Alrighty. After a few busy weeks, here's an updated patch that I think should do the trick. Simplified the user load and fixed that variable. I'm not sure why I changed it. Heh. Also removed that whitespace and it passes all the tests.

Status: Needs review » Needs work

The last submitted patch, storm_team_simpletest.patch, failed testing.

rjgoldsborough’s picture

Status: Needs work » Needs review
StatusFileSize
new5.58 KB

Let's try this one.

rjgoldsborough’s picture

My bad. Didn't apply to right version. Fixing now.

Status: Needs review » Needs work

The last submitted patch, storm_test.patch, failed testing.

rjgoldsborough’s picture

Status: Needs work » Needs review
StatusFileSize
new3.88 KB

Alright, well it looks the storm person module was updated to fix the two changes that were needed for this patch.

juliangb’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

Patch looks fine, but I just noticed that this is testing against 1.x rather than 2.x. Needs a retest against 2.x first as that is where it will initially be committed to.

juliangb’s picture

#27: storm_test.patch queued for re-testing.

juliangb’s picture

Status: Needs review » Reviewed & tested by the community

Great, still passes.

juliangb’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev

Committed to 2.x

juliangb’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 1.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.