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