- You can set return value type
void
as':void'
when you use$this->getDouble()
.
$mock = $this->getDouble(
'SplFileObject',
['next' => ':void'],
['php://memory']
);
- Fix bug that
pre_controller
can't modify$class
/$method
. See #394.
- Compatible with PHP 8.1
- Compatible with CodeIgniter 3.1.13
- Compatible with PHP 8.0
- Fix bug that
install.php --from-composer
does not work. See #371. - Exclude
views/errors/
for PHPUnit coverage report. See #372. - Fix bug that Monkey Patching causes Warning: flock(): Illegal operation argument. See #377.
- Require PHP 7.3 or later, PHPUnit 9.3 or later
- Require PHP 7.2 or later, PHPUnit 8.1 to 9.2
- The first official version
- Same as v0.19.0
- If you use Monkey Patching with nikic/PHP-Parser 4.6 or later, the line number when an error occurs is probably different from the actual source code. Please check the cache file of the source that Monkey Patching creates.
- Now you can use nikic/PHP-Parser 4.6 or later as a Composer dependency. See #364, #366.
- Now you can specify custom test directory. See #362.
- Add functionality to create mocks on consecutive calls. See #339.
- Add functionality to change
ENVIRONMENT
constant valuetesting
. See #360.
- Fix bug that
config.php
is loaded beforeconstants.php
. See #348.
- Now you can assert whether a message is logged. See #331.
- Fix bug that config files are not loaded with HMVC. See #327, #328.
- Fix bug that NetBeans test suite provider causes
Class 'PHPUnit_Util_Configuration' not found
. See #313. - Fix bug that
$assign_to_config
does not work. See #314.
- Fix buggy tearDown() with MySQL. See #321.
- Add and fix PHPDoc
- Fix bug when you enable exit patcher only, it causes errors. See #320.
- Fix bug that Monkey Patching causes errors on PHP 7.4. See #318.
- Fix bug that CIPHPUnitTestDbTestCase reconnects DB on every assertions. See #301.
- Fix typo in CIPHPUnitTestDbTestCase. See #299.
- Fix bug that
PHPUnit\Framework\MockObject\Stub
does not work. See #307. - Fix bug that modified helpers are not loaded. See #310.
- Now you can use
_ci_phpunit_test
directly from vendor path. See #274.
- Update nikic/PHP-Parser to v3.1.5
- Add nikic/PHP-Parser 4.2 as a Composer dependency
- Fix bug that you can't use
$this->request()
andDbTestCase
class at the same time. - Fix
MonkeyPatch::patchConstant()
when the user does not specify$class_method
. See #251. - Fix bug that
vendor/kenjis/ci-phpunit-test/update.php
does not work.
- Now Seeder can call dependent seeders. See How to Write Tests.
$this->resetInstance()
could createMY_Controller
instance in stead ofCI_Controller
instance. See #271.- Now you can change Monkey Patch debug log file path. See #243.
- Compatible with CodeIgniter 3.1.10
- Fix bug that installer replaces file path in
tests/Bootstrap.php
with wrong code which causes Parse error. See #247. - Fix bug that
$this->request()
can't be called more than once in a test method. See #248.
- Compatible with CodeIgniter 3.1.8
- Now ci-phpunit-test detects all warnings and notices during
$this->request()
execution, and throws exceptions. If you want to disable the checking, you must addprotected $strictRequestErrorCheck = false;
in your test classes. See #235. - If you use
$this->newModel()
,$this->newLibrary()
,$this->newController()
in your test cases, please installtests/UnitTestCase.php
manually, and change the base classname of the test cases toUnitTestCase
class. See #233. - Now ci-phpunit-test replaces
CI_Output
. If you useMY_Output
, it might delete ci-phpunit-test override for testing. See How to Write Tests for the details.
- Now ci-phpunit-test detects all warnings and notices during
$this->request()
execution, and throws exceptions. $this->newModel()
,$this->newLibrary()
,$this->newController()
moved toUnitTestCase
class.- Now ci-phpunit-test replaces
CI_Output
.
- Now you can pass more than 5 arguments to
$this->verifyInvoked*()
. See #192. - Now you can assert whether a response cookie is just present or not. See #205.
- Now you can move tests folder if you define
TESTPATH
inapplication/tests/Bootstrap.php
. - Now you can specify custom
application
andpublic
directory when you install via Composer. See README.
- Fix bug that
set_status_header()
in controller constructor gets overwritten. See #194. - Fix bug that
MY_Config
is not loaded in$this->request()
. See #196.
- Compatible with CodeIgniter 3.1.7
- Compatible with PHP 7.2
- Now you can create a mock which has a stubbed method that returns the mock itself with using
$this->getDouble()
. See #170.
- Compatible with CodeIgniter 3.1.4
- Please update
application/tests/phpunit.xml
. Replace it or apply this patch.
- download_helper for testing.
$this->newModel()
for model unit testing. See #156.$this->newLibrary()
for library unit testing. See #161.- Now you can write test code for file uploading in controller testing. See #157.
- Now Monkey Patching supports PHP 7.1 new syntax.
- Fix bug that
include_paths
and/orexclude_paths
in Monkey Patching may not work correctly on Windows.
- Compatible with CodeIgniter 3.1.3
- Update nikic/PHP-Parser to v2.1.1
- Add nikic/PHP-Parser v3.0.3
- Compatible with PHPUnit 6.0
- If you use database test helpers, please install
tests/DbTestCase.php
manually.
- Database test helpers. See #133.
- Now you can return Closure with
$this->getDouble()
. See Function/Class Reference. - Now you can set constructor params with
$this->getDouble()
. See #130. $this->newController()
for controller unit testing. See #147.
- Fix bug that routes with closure cause serialization errors. See #139.
- Compatible with CodeIgniter 3.1.2
- Fix bug that Method Patcher fails dealing with interfaces or abstract classes.
- Fix bug that Method Patcher does not work on Windows.
- Update nikic/PHP-Parser to v2.1.0
- Fix bug that Function Patcher on
openssl_random_pseudo_bytes()
may cause "Warning: Missing argument 2". See #119. - Fix bug that installation/update script for Composer installation causes "Notice: Undefined offset: 1".
- Monkey Patching on constants. See How to Write Tests.
- Update nikic/PHP-Parser to v2.0.1
assertRedirect()
does not work with external redirects. See #104.
- Compatible with CodeIgniter 3.0.6
- Improved installer. See #103.
- Compatible with CodeIgniter 3.0.5
- Fix bug that
$this->input->get_request_header()
returns the first header value for all tests. See #92. - Fix bug that config values are not reset between tests. See #94.
- Fix bug that
CI_Output::_display()
is called even if you call a controller method directly (when you pass an array to the 2nd argument of$this->request()
).
- Improved documentation for
$this->request()
.
- Now ci-phpunit-test replaces
CI_Input
. If you use MY_Input, see How to Write Tests. - If you use Monkey Patching, please update
tests/Bootstrap.php
. See How to Write Tests. - If you use PsySH v0.5, please update to v0.6.
$this->assertResponseCookie()
to assert HTTP response cookies. See #88.- Now
$this->request->enableHooks()
calls hookdisplay_override
. $this->request->addCallablePreConstructor()
to add callable.- Now Moneky Patching can patch code with PHP 7 new syntax.
header()
andsetcookie()
are added to Function Patcher's white list.
_output()
method in controllers does not work in controller testing.
- Compatible with CodeIgniter 3.0.4
- Update nikic/PHP-Parser to v2.0.0
- Fix bug that global variables for core classes are null. See #75.
- Fix bug that can't use constant in
config.php
. See #78. - Fix bug that can't autoload library with alternative library name. See #79.
- Fix bug that Function Patcher on
openssl_random_pseudo_bytes()
which returnsnull
does not work.
- Fix wrong implementation of resetting CodeIgniter instance. Now
reset_instance()
removes the existing CodeIgniter instance. See #74.
- Now
$this->getDouble()
does not call the original constructor by default. See Function/Class Reference. - Now
reset_instance()
removes the existing CodeIgniter instance. See #74.
- NetBeans test suite provider
application/tests/_ci_phpunit_test/TestSuiteProvider.php
. To use it, go to Project Properties > Testing, check Use Custom Test Suite checkbox, and select the file.
- Fix bug that
phpunit
dies whenUnable to locate the specified class
error.
- Improved documentation.
$this->request->addCallable()
to add callable. See #68.- Autoloading classes in
application/modules
folder. - You can configure search paths for autoloader. See How to Write Tests.
- Compatible with CodeIgniter 3.0.3
- Fix bug that monkey patching changes original source code in some cases of heredoc/nowdoc strings.
- Compatible with CodeIgniter 3.0.2
- Compatible with PHP 7.0.0-RC4
- Update nikic/PHP-Parser to v1.4.1
- Fix bug that
$route['404_override']
controller/method is called in Bootstrap. See #63.
- Better support for SQLite in-memory database. Now
reset_instance()
does not close SQLite in-memory database connection.
- Fix bug that
$this->getDouble()
can't create mocks which have methods named method. - Fix bug that monkey patching which returns
null
does not work.
- Property
$bc_mode_throw_PHPUnit_Framework_Exception
inCIPHPUnitTestRequest
class (deprecated since v0.4.0). See How to Write Tests.
- Please update
application/tests/phpunit.xml
. Replace it or apply this patch. See #52.
- Now
$this->warningOff()
turns off Notice, too.
- Now
$this->request()
can create REST request more easily. See #47. $this->request->setHeader()
to set HTTP request header. See #47.$this->assertResponseHeader()
to assert HTTP response header. See #47.- You can add query string in URI string of
$this->request()
. See #51. - Autoloading for libraries
- Add
application/libraries/Session/MY_Session.php
as a sample ReflectionHelper
class to access non-public method or property. See Function/Class Reference.
$this->request()
returns null whenshow_404()
orshow_error()
is called. Now it returns error message.$this->CI
inTestCase
class after calling$this->request()
is still the previous instance. #50.- Autoloader only searches class files only in top level and sub folder for them. #48.
set_status_header()
callsheader()
ifis_cli()
returns false.- Fix
phpunit.xml
. See #52.
- 4th param
$callable
of$this->request()
and$this->ajaxRequest()
(deprecated since v0.3.0)- Use
$this->request->setCallable()
method instead. See Function/Class Reference.
- Use
- Add documentation for CodeIgniter Rest Server. See How to Write Tests.
- Compatible with PsySH v0.5.2
- Fix bug that can't test model classes (classes in
application/models
folder) which do not extendCI_Model
more than once.
- How to enable Monkey Patching has been changed.
TestCase::$enable_patcher
was removed. See How to Write Tests.
- Monkey Patching on functions. See How to Write Tests.
- Monkey Patching on methods in user-defined classes. See How to Write Tests.
$this->resetInstance()
for better model testing. See #40.
TestCase::$enable_patcher
(Introduced in v0.5.0)
- Compatible with CodeIgniter 3.0.1
- Now ci-phpunit-test replaces
redirect()
function by default. See #33.
- Monkey Patching on
exit()
. ci-phpunit-test could convertexit()
in your code to Exception on the fly. See #32. $this->request->setCallablePreConstructor()
to inject mocks into your controller constructors. See #29.
- Fix bug that PHPUnit debug info of the first test is not outputted.
get_new_instance()
(deprecated since pre v0.1.0)
- Changed
MY_url_helper.php
as sample. If you use newMY_url_helper.php
, you must update your tests forredirect()
using new$this->assertRedirect()
method. See How to Write Tests and #28. - Changed how to test
show_404()
andshow_error()
. See How to Write Tests and #28.
$this->assertResponseCode()
to check response code in controller tests. See Function/Class Reference.$this->assertRedirect()
to check ifredirect()
is called in controller tests. See Function/Class Reference.- Property
$bc_mode_throw_PHPUnit_Framework_Exception
inCIPHPUnitTestRequest
class
- Property
$bc_mode_throw_PHPUnit_Framework_Exception
inCIPHPUnitTestRequest
class
- Improved documentation. See How to Write Test.
- 4th param
$callable
of$this->request()
and$this->ajaxRequest()
. Use$this->request->setCallable()
method instead. See Function/Class Reference.
$this->request->setCallable()
See How to Write Tests.- You can enable hooks for controller in controller testing.
$this->request->enableHooks()
is added. See How to Write Tests.
- Change
MY_url_helper.php
as sample. If you use newMY_url_helper.php
, you must catchPHPUnit_Framework_Exception
when you test code usingredirect()
. - Improve documentation
- Improve installation. See Installation.
- Fix bug that Bootstrap outputs 404 page when 404_override
- Fix bug that risky tests occur #14
- Initial version
- Compatible with CodeIgniter 3.0.0