Skip to content

Commit 61500cc

Browse files
committed
Update docs for release
1 parent 12ff5bf commit 61500cc

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

docs/ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Change Log for CI PHPUnit Test
22

3-
## v0.11.1 (Not Released)
3+
## v0.11.1 (2016/02/22)
44

55
### Fixed
66

docs/HowToWriteTests.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ See [Controller with Hooks](#controller-with-hooks) for details.
167167

168168
*CI PHPUnit Test* has an autoloader for class files.
169169

170-
To change the search paths, change the line [`CIPHPUnitTest::init();`](https://github.com/kenjis/ci-phpunit-test/blob/v0.11.0/application/tests/Bootstrap.php#L336) in `tests/Bootstrap.php` like below:
170+
To change the search paths, change the line [`CIPHPUnitTest::init();`](https://github.com/kenjis/ci-phpunit-test/blob/v0.11.1/application/tests/Bootstrap.php#L336) in `tests/Bootstrap.php` like below:
171171

172172
~~~php
173173
CIPHPUnitTest::init([
@@ -251,7 +251,7 @@ class Inventory_model_test extends TestCase
251251
}
252252
~~~
253253

254-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/models/Category_model_test.php).
254+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/models/Category_model_test.php).
255255

256256
#### Database Seeding
257257

@@ -272,7 +272,7 @@ You can use them like below:
272272
}
273273
~~~
274274

275-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/models/Category_model_test.php).
275+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/models/Category_model_test.php).
276276

277277
#### Using PHPUnit Mock Objects
278278

@@ -337,7 +337,7 @@ If you don't know well about PHPUnit Mock Objects, see [Test Doubles](https://ph
337337
}
338338
~~~
339339

340-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/models/Category_model_mocking_db_test.php).
340+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/models/Category_model_mocking_db_test.php).
341341

342342
### Libraries
343343

@@ -379,7 +379,7 @@ You can use [$this->request()](FunctionAndClassReference.md#testcaserequestmetho
379379

380380
**Note:** If you pass URI string to the 2nd argument of `$this->request()`, it invokes the routing. If the resolved controller has `_remap()` and/or `_output()` methods, they will be invoked, too.
381381

382-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/sub/Sub_test.php).
382+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/sub/Sub_test.php).
383383

384384
If you want to call a controller method directly, you can pass an array to the 2nd argument of `$this->request()`.
385385

@@ -399,7 +399,7 @@ class Welcome_test extends TestCase
399399

400400
**Note:** If you pass an array to the 2nd argument of `$this->request()`, it does not invokes the routing. The `_remap()` and/or `_output()` methods in a controller are not invoked, too.
401401

402-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Welcome_test.php).
402+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Welcome_test.php).
403403

404404
#### REST Request
405405

@@ -437,7 +437,7 @@ You can set request header with [$this->request->setHeader()](FunctionAndClassRe
437437
}
438438
~~~
439439

440-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/api/Example_test.php).
440+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/api/Example_test.php).
441441

442442
#### Ajax Request
443443

@@ -452,7 +452,7 @@ You can use [$this->ajaxRequest()](FunctionAndClassReference.md#testcaseajaxrequ
452452
}
453453
~~~
454454

455-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Ajax_test.php).
455+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Ajax_test.php).
456456

457457
#### Request and Use Mocks
458458

@@ -482,7 +482,7 @@ You can use [$this->request->setCallable()](FunctionAndClassReference.md#request
482482

483483
**Note:** When you have not loaded a class with CodeIgniter loader, if you make a mock object for the class, your application code may not work correclty. If you have got an error, please try to load it with CodeIgniter loader, before getting the mock object.
484484

485-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Mock_phpunit_test.php).
485+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Mock_phpunit_test.php).
486486

487487
The function you set by `$this->request->setCallable()` runs after controller instantiation. So you can't inject mocks into controller constructor.
488488

@@ -532,7 +532,7 @@ In this case, You can use [$this->request->setCallablePreConstructor()](Function
532532
}
533533
~~~
534534

535-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Auth_check_in_construct_test.php).
535+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Auth_check_in_construct_test.php).
536536

537537
**Note:** If you can't create mocks or it is too hard to create mocks, it may be better to use Monkey Patching.
538538

@@ -596,7 +596,7 @@ I recommend using PHPUnit mock objects. [$this->getDouble()](FunctionAndClassRef
596596
}
597597
~~~
598598

599-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Auth_test.php).
599+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Auth_test.php).
600600

601601
#### `redirect()`
602602

@@ -616,7 +616,7 @@ If you use `redirect()` in *CI PHPUnit Test*, you can write tests like this:
616616

617617
[$this->assertRedirect()](FunctionAndClassReference.md#testcaseassertredirecturi-code--null) is a method in *CI PHPUnit Test*.
618618

619-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Redirect_test.php).
619+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Redirect_test.php).
620620

621621
##### Upgrade Note for v0.4.0
622622

@@ -658,7 +658,7 @@ You can use [$this->assertResponseCode()](FunctionAndClassReference.md#testcasea
658658
}
659659
~~~
660660

661-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Nocontroller_test.php).
661+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Nocontroller_test.php).
662662

663663
If you don't call `$this->request()` in your tests, `show_error()` throws `CIPHPUnitTestShowErrorException` and `show_404()` throws `CIPHPUnitTestShow404Exception`. So you must expect the exceptions. You can use `@expectedException` annotation in PHPUnit.
664664

@@ -708,7 +708,7 @@ If you want to enable hooks, call [$this->request->enableHooks()](FunctionAndCla
708708
$output = $this->request('GET', 'products/shoes/show/123');
709709
~~~
710710

711-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Hook_test.php).
711+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Hook_test.php).
712712

713713
#### Controller with Name Collision
714714

@@ -734,7 +734,7 @@ class sub_Welcome_test extends TestCase
734734
}
735735
~~~
736736

737-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/sub/Welcome_test.php).
737+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/sub/Welcome_test.php).
738738

739739
### Mock Libraries
740740

@@ -870,15 +870,15 @@ A test case could be like this:
870870
}
871871
~~~
872872

873-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Exit_to_exception_test.php).
873+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Exit_to_exception_test.php).
874874

875875
#### Patching Functions
876876

877877
This patcher allows replacement of global functions that can't be mocked by PHPUnit.
878878

879879
But it has a few limitations. Some functions can't be replaced and it might cause errors.
880880

881-
So by default we can replace only a dozen pre-defined functions in [FunctionPatcher](https://github.com/kenjis/ci-phpunit-test/blob/v0.11.0/application/tests/_ci_phpunit_test/patcher/Patcher/FunctionPatcher.php#L27).
881+
So by default we can replace only a dozen pre-defined functions in [FunctionPatcher](https://github.com/kenjis/ci-phpunit-test/blob/v0.11.1/application/tests/_ci_phpunit_test/patcher/Patcher/FunctionPatcher.php#L27).
882882

883883
~~~php
884884
public function test_index()
@@ -891,7 +891,7 @@ So by default we can replace only a dozen pre-defined functions in [FunctionPatc
891891

892892
[MonkeyPatch::patchFunction()](FunctionAndClassReference.md#monkeypatchpatchfunctionfunction-return_value-class_method) replaces PHP native function `mt_rand()` in `Welcome::index` method, and it will return `100` in the test method.
893893

894-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Patching_on_function_test.php).
894+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Patching_on_function_test.php).
895895

896896
**Note:** If you call `MonkeyPatch::patchFunction()` without 3rd argument, all the functions (located in `include_paths` and not in `exclude_paths`) called in the test method will be replaced. So, for example, a function in CodeIgniter code might be replaced and it results in unexpected outcome.
897897

@@ -924,11 +924,11 @@ You could change return value of patched function using PHP closure:
924924
);
925925
~~~
926926

927-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Patching_on_function_test.php#L59-L80).
927+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Patching_on_function_test.php#L59-L80).
928928

929929
**Patch on Other Functions**
930930

931-
If you want to patch other functions, you can add them to [functions_to_patch](https://github.com/kenjis/ci-phpunit-test/blob/v0.11.0/application/tests/Bootstrap.php#L323) in `MonkeyPatchManager::init()`.
931+
If you want to patch other functions, you can add them to [functions_to_patch](https://github.com/kenjis/ci-phpunit-test/blob/v0.11.1/application/tests/Bootstrap.php#L323) in `MonkeyPatchManager::init()`.
932932

933933
But there are a few known limitations:
934934

@@ -953,13 +953,13 @@ This patcher allows replacement of methods in user-defined classes.
953953

954954
[MonkeyPatch::patchMethod()](FunctionAndClassReference.md#monkeypatchpatchmethodclassname-params) replaces `get_category_list()` method in `Category_model`, and it will return `[(object) ['name' => 'Nothing']]` in the test method.
955955

956-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.0/application/tests/controllers/Patching_on_method_test.php).
956+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.11.1/application/tests/controllers/Patching_on_method_test.php).
957957

958958
### More Samples
959959

960960
Want to see more tests?
961961

962-
* https://github.com/kenjis/ci-app-for-ci-phpunit-test/tree/v0.11.0/application/tests
962+
* https://github.com/kenjis/ci-app-for-ci-phpunit-test/tree/v0.11.1/application/tests
963963
* https://github.com/kenjis/codeigniter-tettei-apps/tree/develop/application/tests
964964

965965
### Third Party Libraries
@@ -1036,7 +1036,7 @@ And if you copy sample api controllers, you must change `require` statement to `
10361036

10371037
If you require `REST_Controller.php` more than once, you get `Fatal error: Cannot redeclare class REST_Controller`.
10381038

1039-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/tree/v0.11.0/application/tests/controllers/api).
1039+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/tree/v0.11.1/application/tests/controllers/api).
10401040

10411041
#### [Modular Extensions - HMVC](https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc)
10421042

0 commit comments

Comments
 (0)