kenjis/ci-phpunit-test

how to load a model inside modules/../model

ayokay123 opened this issue · 15 comments

hey, when i try to load public

function setUp()
{
     $this->resetInstance();
     $this->CI->load->model(i want to acces model in modules/foo/models/foo_model);
     $this->obj = $this->CI->???;
}

i can only find the models in application/models i can't find models in application/modules/.../models

CodeIgniter cannot load models not in application/models.

should i copie the application/tests folder in each folder inside /modules ?? can that work

You have to dig into how do you load the model in the modules folder.
And implement the logic into ci-phpunit-test.

I don't remember how CodeIgniter-HMVC does it.

do you have any links or resources i could use ?? because i have searched alot with no success

Read CodeIgniter-HMVC code to find out how it loads a model in the modules folder.

i have this method line 197 https://github.com/xttrust/codeigniter-modular-extensions-hmvc-fixed/blob/master/third_party/MX/Loader.php where exactly can i implement it in ci-phpunit-test

Error: Call to undefined method MY_Loader::get_details()

@ayokay123 What's your environment?

  • OS
  • PHP
  • PHPUnit
  • CodeIgniter
  • HMVC

os: ubuntu (im using docker for the project)
php:7.2
phpunit:7
ci: 3.1.3
hmvc not sure

thank you very much, it works now

i have another question if you can help .Can i ignore a database when i do migration in TestCase?

@ayokay123 File another issue for another question.
And Please explain what you want to do as detailed as possible.