public function testaction_save() { $SugarController = new SugarController(); $SugarController->setModule('Users'); $SugarController->loadBean(); //execute the method and check if it either works or throws an mysql exception. //Fail if it throws any other exception. try { $SugarController->action_save(); } catch (Exception $e) { $this->assertStringStartsWith('mysqli_query()', $e->getMessage()); } $this->assertTrue(true); }