diff options
author | Andrey Andreev <narf@devilix.net> | 2014-01-17 11:53:47 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-01-17 11:53:47 +0100 |
commit | e33e9c1e5f0b600c0b14558fb74cf61258f7d684 (patch) | |
tree | be44db5e20b60da916aea46b6f6d37eec6c218fd | |
parent | 3cf23cdc7ee2120fb7571d6bef7191c67d4a7ae8 (diff) |
Add CI_Model unit test
-rw-r--r-- | tests/codeigniter/core/Model_test.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/codeigniter/core/Model_test.php b/tests/codeigniter/core/Model_test.php new file mode 100644 index 000000000..80dc97b3b --- /dev/null +++ b/tests/codeigniter/core/Model_test.php @@ -0,0 +1,37 @@ +<?php + +class Model_test extends CI_TestCase { + + private $ci_obj; + + public function set_up() + { + $loader = $this->ci_core_class('loader'); + $this->load = new $loader(); + $this->ci_obj = $this->ci_instance(); + $this->ci_set_core_class('model', 'CI_Model'); + + $model_code =<<<MODEL +<?php +class Test_model extends CI_Model { + + public \$property = 'foo'; + +} +MODEL; + + $this->ci_vfs_create('Test_model', $model_code, $this->ci_app_root, 'models'); + $this->load->model('test_model'); + } + + // -------------------------------------------------------------------- + + public function test__get() + { + $this->assertEquals('foo', $this->ci_obj->test_model->property); + + $this->ci_obj->controller_property = 'bar'; + $this->assertEquals('bar', $this->ci_obj->test_model->controller_property); + } + +}
\ No newline at end of file |