Closed tato469 closed 3 years ago
It is because $this->newModel()
resets the CI instance.
Please try:
public function setUp()
{
$this->obj = $this->newModel('Candidate_model');
$this->CI->load->library('Mongo_db');
}
If you still have this problem, feel free to reopen.
I am trying to set mongodb as database instead mysql. I have my test model loading my mongo library (It works in normal models):
My problem is that I am having the following error:
PHP Fatal error: Class 'MongoDB\Driver\WriteConcern' not found in /Users/fernando/Desktop/codeigniter/application/tests/_ci_phpunit_test/replacing/core/Loader.php on line 1346
Fatal error: Class 'MongoDB\Driver\WriteConcern' not found in /Users/fernando/Desktop/codeigniter/application/tests/_ci_phpunit_test/replacing/core/Loader.php on line 1346
A PHP Error was encountered
Severity: Error Message: Class 'MongoDB\Driver\WriteConcern' not found Filename: /Users/fernando/Desktop/codeigniter/application/tests/_ci_phpunit_test/replacing/core/Loader.php Line Number: 1346
I think it fails because it is not including the vendor autoload file, where should I add it?
I tried to add
include_once APPPATH .'vendor/autoload.php';
(my vendor is inside application folder) inapplication/tests/_ci_phpunit_test/autoloader.php
but nothing happens.