Skip to content

Commit 0044730

Browse files
committed
Update docs for release
1 parent f980f2f commit 0044730

File tree

3 files changed

+24
-24
lines changed

3 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.12.1 (Not Released)
3+
## v0.12.1 (2016/06/11)
44

55
### Fixed
66

docs/FunctionAndClassReference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ci-phpunit-test for CodeIgniter 3.0
22

3-
version: **v0.12.0** |
3+
version: **v0.12.1** |
44
[v0.11.3](https://github.com/kenjis/ci-phpunit-test/blob/v0.11.3/docs/FunctionAndClassReference.md) |
55
[v0.10.1](https://github.com/kenjis/ci-phpunit-test/blob/v0.10.1/docs/FunctionAndClassReference.md) |
66
[v0.9.1](https://github.com/kenjis/ci-phpunit-test/blob/v0.9.1/docs/FunctionAndClassReference.md) |

docs/HowToWriteTests.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ci-phpunit-test for CodeIgniter 3.0
22

3-
version: **v0.12.0** |
3+
version: **v0.12.1** |
44
[v0.11.3](https://github.com/kenjis/ci-phpunit-test/blob/v0.11.3/docs/HowToWriteTests.md) |
55
[v0.10.1](https://github.com/kenjis/ci-phpunit-test/blob/v0.10.1/docs/HowToWriteTests.md) |
66
[v0.9.1](https://github.com/kenjis/ci-phpunit-test/blob/v0.9.1/docs/HowToWriteTests.md) |
@@ -171,7 +171,7 @@ See [Controller with Hooks](#controller-with-hooks) for details.
171171

172172
ci-phpunit-test has an autoloader for class files.
173173

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

176176
~~~php
177177
CIPHPUnitTest::init([
@@ -255,7 +255,7 @@ class Inventory_model_test extends TestCase
255255
}
256256
~~~
257257

258-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/models/Category_model_test.php).
258+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/models/Category_model_test.php).
259259

260260
#### Database Seeding
261261

@@ -276,7 +276,7 @@ You can use them like below:
276276
}
277277
~~~
278278

279-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/models/Category_model_test.php).
279+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/models/Category_model_test.php).
280280

281281
#### Using PHPUnit Mock Objects
282282

@@ -341,7 +341,7 @@ If you don't know well about PHPUnit Mock Objects, see [Test Doubles](https://ph
341341
}
342342
~~~
343343

344-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/models/Category_model_mocking_db_test.php).
344+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/models/Category_model_mocking_db_test.php).
345345

346346
### Libraries
347347

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

384384
**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.
385385

386-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/sub/Sub_test.php).
386+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/sub/Sub_test.php).
387387

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

@@ -403,7 +403,7 @@ class Welcome_test extends TestCase
403403

404404
**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.
405405

406-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Welcome_test.php).
406+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Welcome_test.php).
407407

408408
#### REST Request
409409

@@ -441,7 +441,7 @@ You can set request header with [$this->request->setHeader()](FunctionAndClassRe
441441
}
442442
~~~
443443

444-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/api/Example_test.php).
444+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/api/Example_test.php).
445445

446446
#### Ajax Request
447447

@@ -456,7 +456,7 @@ You can use [$this->ajaxRequest()](FunctionAndClassReference.md#testcaseajaxrequ
456456
}
457457
~~~
458458

459-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Ajax_test.php).
459+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Ajax_test.php).
460460

461461
#### Request and Use Mocks
462462

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

487487
**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.
488488

489-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Mock_phpunit_test.php).
489+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Mock_phpunit_test.php).
490490

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

@@ -536,7 +536,7 @@ In this case, You can use [$this->request->setCallablePreConstructor()](Function
536536
}
537537
~~~
538538

539-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Auth_check_in_construct_test.php).
539+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Auth_check_in_construct_test.php).
540540

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

@@ -600,7 +600,7 @@ I recommend using PHPUnit mock objects. [$this->getDouble()](FunctionAndClassRef
600600
}
601601
~~~
602602

603-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Auth_test.php).
603+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Auth_test.php).
604604

605605
#### `redirect()`
606606

@@ -620,7 +620,7 @@ If you use `redirect()` in ci-phpunit-test, you can write tests like this:
620620

621621
[$this->assertRedirect()](FunctionAndClassReference.md#testcaseassertredirecturi-code--null) is a method in ci-phpunit-test.
622622

623-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Redirect_test.php).
623+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Redirect_test.php).
624624

625625
##### Upgrade Note for v0.4.0
626626

@@ -662,7 +662,7 @@ You can use [$this->assertResponseCode()](FunctionAndClassReference.md#testcasea
662662
}
663663
~~~
664664

665-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Nocontroller_test.php).
665+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Nocontroller_test.php).
666666

667667
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.
668668

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

715-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Hook_test.php).
715+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Hook_test.php).
716716

717717
#### Controller with Name Collision
718718

@@ -738,7 +738,7 @@ class sub_Welcome_test extends TestCase
738738
}
739739
~~~
740740

741-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/sub/Welcome_test.php).
741+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/sub/Welcome_test.php).
742742

743743
### Mock Libraries
744744

@@ -876,15 +876,15 @@ A test case could be like this:
876876
}
877877
~~~
878878

879-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Exit_to_exception_test.php).
879+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Exit_to_exception_test.php).
880880

881881
#### Patching Functions
882882

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

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

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

889889
~~~php
890890
public function test_index()
@@ -897,7 +897,7 @@ So by default we can replace only a dozen pre-defined functions in [FunctionPatc
897897

898898
[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.
899899

900-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Patching_on_function_test.php).
900+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Patching_on_function_test.php).
901901

902902
**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.
903903

@@ -930,11 +930,11 @@ You could change return value of patched function using PHP closure:
930930
);
931931
~~~
932932

933-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Patching_on_function_test.php#L59-L80).
933+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Patching_on_function_test.php#L59-L80).
934934

935935
**Patch on Other Functions**
936936

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

939939
But there are a few known limitations:
940940

@@ -959,7 +959,7 @@ This patcher allows replacement of methods in user-defined classes.
959959

960960
[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.
961961

962-
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.0/application/tests/controllers/Patching_on_method_test.php).
962+
See [working sample](https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v0.12.1/application/tests/controllers/Patching_on_method_test.php).
963963

964964
#### Patching Constants
965965

0 commit comments

Comments
 (0)