RE: ci-phpunit-test for CodeIgniter 3.0 - resolv_25 - 01-04-2016
(12-30-2015, 07:26 PM)kenjis Wrote: @resolv_25
Tests run on `testing` environment.
https://github.com/kenjis/ci-phpunit-test/blob/master/docs/HowToWriteTests.md#testing-environment
Did you setup database.php for testing environment correctly?
Hi,
I'm probably missing something.
I believe I did put 'testing' environment properly, in .htaccess i have:
SetEnv CI_ENV 'testing'
On database.php I have:
'db_debug' => (ENVIRONMENT == 'testing'),
If I put in code:
echo $_SERVER['CI_ENV'];
I do get answer 'testing'
phpunit gives following error:
Code: Error: No code coverage driver is available
.......
PHP Fatal error: Call to a member function order_by() on null in /var/www/html/lipa2016/application/models/Category_model.php on line 12
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Controller::$db
Filename: /var/www/html/lipa2016/system/core/Model.php
Line Number: 77
Backtrace:
File: /var/www/html/lipa2016/application/models/Category_model.php
Line: 12
Function: __get
File: /var/www/html/lipa2016/application/tests/models/Category_model_test.php
Line: 25
Function: get_category_list
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php
Line: 910
Function: invokeArgs
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php
Line: 770
Function: runTest
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestResult.php
Line: 685
Function: runBare
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php
Line: 726
Function: run
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php
Line: 747
Function: run
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php
Line: 747
Function: run
File: phar:///usr/local/bin/phpunit/phpunit/TextUI/TestRunner.php
Line: 429
Function: run
File: phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php
Line: 155
Function: doRun
File: phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php
Line: 106
Function: run
File: /usr/local/bin/phpunit
Line: 514
Function: main
Fatal error: Call to a member function order_by() on null in /var/www/html/lipa2016/application/models/Category_model.php on line 12
A PHP Error was encountered
Severity: Error
Message: Call to a member function order_by() on null
Filename: /var/www/html/lipa2016/application/models/Category_model.php
Line Number: 12
BTW, the method get_category_list gives proper result if I'm calling it from a controller.
RE: ci-phpunit-test for CodeIgniter 3.0 - kenjis - 01-04-2016
You misunderstand about `testing` environment.
ci-phpunit-test always sets `testsing` automatically, so you don't have to do anything to set environment.
Do you have `config/testing/database.php`? If you have it, you must configure it correclty.
(01-04-2016, 06:37 AM)resolv_25 Wrote: (12-30-2015, 07:26 PM)kenjis Wrote: @resolv_25
Tests run on `testing` environment.
https://github.com/kenjis/ci-phpunit-test/blob/master/docs/HowToWriteTests.md#testing-environment
Did you setup database.php for testing environment correctly?
Hi,
I'm probably missing something.
I believe I did put 'testing' environment properly, in .htaccess i have:
SetEnv CI_ENV 'testing'
On database.php I have:
'db_debug' => (ENVIRONMENT == 'testing'),
If I put in code:
echo $_SERVER['CI_ENV'];
I do get answer 'testing'
phpunit gives following error:
Code: Error: No code coverage driver is available
.......
PHP Fatal error: Call to a member function order_by() on null in /var/www/html/lipa2016/application/models/Category_model.php on line 12
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Controller::$db
Filename: /var/www/html/lipa2016/system/core/Model.php
Line Number: 77
Backtrace:
File: /var/www/html/lipa2016/application/models/Category_model.php
Line: 12
Function: __get
File: /var/www/html/lipa2016/application/tests/models/Category_model_test.php
Line: 25
Function: get_category_list
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php
Line: 910
Function: invokeArgs
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php
Line: 770
Function: runTest
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestResult.php
Line: 685
Function: runBare
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php
Line: 726
Function: run
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php
Line: 747
Function: run
File: phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php
Line: 747
Function: run
File: phar:///usr/local/bin/phpunit/phpunit/TextUI/TestRunner.php
Line: 429
Function: run
File: phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php
Line: 155
Function: doRun
File: phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php
Line: 106
Function: run
File: /usr/local/bin/phpunit
Line: 514
Function: main
Fatal error: Call to a member function order_by() on null in /var/www/html/lipa2016/application/models/Category_model.php on line 12
A PHP Error was encountered
Severity: Error
Message: Call to a member function order_by() on null
Filename: /var/www/html/lipa2016/application/models/Category_model.php
Line Number: 12
BTW, the method get_category_list gives proper result if I'm calling it from a controller.
RE: ci-phpunit-test for CodeIgniter 3.0 - kenjis - 01-04-2016
I opened the issue:
How to test setting cookie in controller testing https://github.com/kenjis/ci-phpunit-test/issues/86
If you have opinion about it, please comment.
RE: ci-phpunit-test for CodeIgniter 3.0 - kenjis - 01-06-2016
(01-04-2016, 10:24 PM)kenjis Wrote: I opened the issue:
How to test setting cookie in controller testing https://github.com/kenjis/ci-phpunit-test/issues/86
If you have opinion about it, please comment.
I sent a PR for it. See https://github.com/kenjis/ci-phpunit-test/pull/88
RE: ci-phpunit-test for CodeIgniter 3.0 - kenjis - 01-07-2016
At last ci-phpunit-test can test Welcome controller using wiredesignz/codeigniter-modular-extensions-hmvc without any modifications.
See https://github.com/kenjis/ci-hmvc-ci-phpunit-test
This dose not means ci-phpunit-test fully supports HMVC, but the compatibility with HMVC has been increased.
RE: ci-phpunit-test for CodeIgniter 3.0 - kenjis - 01-20-2016
v0.11.0 was released.
https://github.com/kenjis/ci-phpunit-test/releases
Please read Upgrade Note when you upgrade.
RE: ci-phpunit-test for CodeIgniter 3.0 - kenjis - 02-14-2016
About HMVC
Another test case was added to:
https://github.com/kenjis/ci-hmvc-ci-phpunit-test
And I added a note:
https://github.com/kenjis/ci-hmvc-ci-phpunit-test#note-to-use
RE: ci-phpunit-test for CodeIgniter 3.0 - kenjis - 02-21-2016
v0.11.1 was released!
See https://github.com/kenjis/ci-phpunit-test/releases
It is a bug fix release.
RE: ci-phpunit-test for CodeIgniter 3.0 - kenjis - 03-17-2016
v0.11.2 was released!
See https://github.com/kenjis/ci-phpunit-test/releases
RE: ci-phpunit-test for CodeIgniter 3.0 - kenjis - 03-25-2016
v0.11.3 was released!
Minor fix and update.
See https://github.com/kenjis/ci-phpunit-test/releases
|