Yep, that was it. <stupid look>I put $result->db_fetch_object($result) instead 
of just db_fetch_object($result).</stupid look>

Best,
Dave

-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Daniel F. Kudwien
Sent: Tuesday, January 26, 2010 11:11 AM
To: [email protected]
Subject: Re: [development] Simpletest question


        21 public function test_sync () {

Should be testSync().


        22
require_once(drupal_get_path('module','compoundmanagement').'/compoundmanage
ment.inc');

Should be module_load_include().


        23    $result = db_query('select count(objdid) as count from
{cpd_compounds}');

"cpd_compounds" does not match your module name.


        24    $row = $result->db_fetch_object($result);

If this is for D7: db_fetch_object() no longer exists.  You can iterate over
$result directly.  Read more on http://drupal.org/node/310069

If this is for D6, then $result simply is no class and db_fetch_object()
simply is no method.


        25    $this->pass('There are '.$row->count.' compounds in
cpd_compounds');

Should use t() as always, with appropriate placeholders (@count in this
case).


        26    $this->drupalGet('sync_cpds',array('absolute' => TRUE));

Unless you have a very good reason to do so, the options array (and absolute
URL) is not required.


        27    $result = db_query('select count(objdid) as count from
{cpd_compounds}');

SimpleTest always queries the table in the database of the currently running
test, as along as it is escaped (which it is here).


        28    $row = $result->db_fetch_object($result);

Your real error is likely here (again).


        29    $this->pass('There are now '.$row->count.' compounds in
cpd_compounds');

See above.


        30    $this->assertEqual($row->count,1313,"CPD_COMPOUNDS should have
1313 rows.");

Only use double-quotes where technically required.



        The test above threw this error:
        <b>Fatal error</b>: Call to a member function db_fetch_object() on a
non-object

In the end, the actual error message is pretty concise. ;)


sun



Reply via email to