{"id":853,"date":"2017-10-05T22:52:27","date_gmt":"2017-10-05T13:52:27","guid":{"rendered":"http:\/\/chiekoubou.orz.hm\/kataware\/?p=853"},"modified":"2017-10-05T11:03:23","modified_gmt":"2017-10-05T02:03:23","slug":"phpunit-%e3%80%90%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%83%84%e3%83%bc%e3%83%ab%e3%80%91","status":"publish","type":"post","link":"https:\/\/blog.chiekoubou.com\/?p=853","title":{"rendered":"phpunit \u3010\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u30c4\u30fc\u30eb\u3011"},"content":{"rendered":"<p>\u300c\u3048\uff1fphpunit\u4f7f\u3063\u305f\u3053\u3068\u306a\u3044\u3068\u304b\u30de\u30b8\u3059\u304b\uff01\uff1f\u300d<\/p>\n<p>\u3063\u3066\u8ab0\u304b\u306b\u8a00\u308f\u308c\u305f\u6c17\u304c\u3059\u308b\u306e\u3067\u6025\u3044\u3067\u52c9\u5f37\u958b\u59cb\u3002<br \/>\n(\u5148\u65e5\u3068\u540c\u3058\u59cb\u307e\u308a\u65b9)<\/p>\n<p>\u4e8b\u306e\u767a\u7aef\u306f\u3001\u54c1\u8cea\u306e\u78ba\u4fdd\u306b\u3064\u3044\u3066\u8003\u3048\u3055\u305b\u3089\u308c\u305f\u3068\u304d\u3002<br \/>\n\u6b63\u76f4\u81ea\u5206\u304c\u66f8\u3044\u305f\u30b3\u30fc\u30c9\u306e\u30c6\u30b9\u30c8\u3063\u3066\u3001\u3042\u307e\u308a\u3084\u308b\u6c17\u3067\u306a\u3044\u3058\u3083\u306a\u3044\u3067\u3059\u304b\u3002<br \/>\n\u4ed6\u4eba\u306e\u7c97\u635c\u3057\u306f\u305d\u3093\u306a\u306b\u5acc\u3044\u3058\u3083\u306a\u3044\u3051\u3069\u3001\u81ea\u5206\u306e\u306f\u5acc\u3058\u3083\u306a\u3044\u3067\u3059\u304b\u3002<\/p>\n<p>\u4ed6\u4eba\u306b\u3001\u30d0\u30b0\u3058\u3083\u306d\u30fc\u304b\u3001\u3063\u3066\u8a00\u308f\u308c\u308b\u3068\u6bba\u610f\u304c\u308f\u304d\u307e\u3059\u304c<br \/>\n\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u6012\u3089\u308c\u308b\u306a\u3089\u554f\u984c\u306a\u3057\u3002<br \/>\n\u3060\u3063\u3066\u3001\u3053\u3044\u3064\u3089\u306f\u50d5\u306e\u5473\u65b9\u3060\u3082\u3093\u3001\u88cf\u5207\u3089\u306a\u3044\u3082\u3093\u3002<\/p>\n<p>\u5b9f\u306fTDD\u304c\u4e3b\u6d41\u3060\u3063\u305f\u3053\u308d\u306e\u7523\u7269\u3067<br \/>\n\u6642\u4ee3\u306fBDD\u7528\u306ephpSpec\u304c\u4e3b\u6d41\u3089\u3057\u3044\uff1f<br \/>\n\u304c\u3001\u6642\u4ee3\u9045\u308c\u306e\u50d5\u306f\u307e\u305aphpunit\u304b\u3089\u52c9\u5f37\u3092\u59cb\u3081\u308b\u306e\u3067\u3059\u3002<br \/>\n\u65b0\u3057\u3044\u3082\u306e\u306f\u7121\u6761\u4ef6\u3067\u3088\u3044\u3068\u3044\u3046\u308f\u3051\u3067\u306f\u306a\u304f\u3001<br \/>\n\u69cb\u60f3\u3084\u6c42\u3081\u308b\u3082\u306e\u304c\u9055\u3046\u306a\u3089\u4e21\u65b9\u77e5\u3063\u3066\u304a\u3044\u3066\u4f7f\u3044\u5206\u3051\u308b\u3079\u304d\uff01<\/p>\n<p>\u3068\u3044\u3046\u4e8b\u3067\u3055\u3063\u305d\u304f\u3084\u3063\u3066\u307f\u3088\u3046\u3002<\/p>\n<p>\u3055\u3063\u305d\u304fcomposer\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3060\uff01<br \/>\n\u73fe\u6642\u70b9\u3067\u306fVer6\u307e\u3067\u51fa\u3066\u308b\u307f\u305f\u3044\u3067\u3059\u304c\u3001PHP7\u4ee5\u4e0a\u306a\u306e\u3067<br \/>\n\u3044\u307e\u3060\u306bPHP5.6\u7cfb\u304b\u3089\u629c\u3051\u51fa\u305b\u306a\u3044\u6642\u4ee3\u9045\u308c\u306e\u50d5\u306f 5\u3067\u30ac\u30de\u30f3\u3002<br \/>\n\u3067\u3082\u3001phpunit\u5165\u9580\u3067\u30b0\u30b0\u308b\u3068 3\u7cfb\u306e\u8a18\u4e8b\u304c\u305f\u304f\u3055\u3093\u30d2\u30c3\u30c8\u3059\u308b\u3002<br \/>\n\u3055\u3089\u306b\u66f8\u304b\u308c\u305f\u306e\u304c2007\u5e74\u306e\u8a18\u4e8b\u3068\u304b\u3067\u3059\u3002<br \/>\n\u50d5\u306f10\u5e74\u524d\u304b\u3089\u73fe\u4ee3\u306b\u5411\u304b\u3063\u3066\u5168\u529b\u75be\u8d70\u3057\u3066\u3044\u308b\u3068\u3044\u3046\u4e8b\u3067\u3059\u306d\uff01<\/p>\n<p>\u516c\u5f0f\u306e\u65e5\u672c\u8a9e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u898b\u3064\u3051\u305f\u3082\u306e\u306e\u3001\u3044\u307e\u3044\u3061\u308f\u304b\u308a\u306b\u304f\u3044\u3002<br \/>\n\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u3042\u308b\u3082\u306e\u306e\u3001<br \/>\n\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u3068\u304b\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u624b\u9806\u3068\u304b\u304c\u898b\u5f53\u305f\u3089\u305a\u3002<\/p>\n<p>\u5e78\u3044phpunit5\u306e\u8a18\u4e8b\u3082\u307f\u3064\u3051\u305f\u306e\u3067\u3001<br \/>\n\u305d\u308c\u306b\u7fd2\u3063\u3066\u5b9f\u9a13\u958b\u59cb\uff01<br \/>\n\u3084\u306f\u308aSE\u306f\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u306a\u3093\u307c\u3002\u30c8\u30e9\u30a4\uff06\u30a8\u30e9\u30fc\u4e07\u6b73\uff01<\/p>\n<p>\uff1d\uff1d\u3000\u524d\u63d0\u3000\uff1d\uff1d<br \/>\ncomposer\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<br \/>\n\u3000(composer\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f)<\/p>\n<p>\uff1d\uff1d\u3000\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u9020\u3000\uff1d\uff1d<\/p>\n<pre>\r\nc:\\vhosts\\phpunit <= \u30c6\u30b9\u30c8\u306b\u4f7f\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\r\n                 \\classes <= \u691c\u8a3c\u3055\u308c\u308b\u30af\u30e9\u30b9\u306e\u683c\u7d0d\u5834\u6240\r\n                 \\case <= \u691c\u8a3c\u7528\u306e\u30af\u30e9\u30b9\u306e\u683c\u7d0d\u5834\u6240\r\n<\/pre>\n<p>\u5b9f\u969b\u306f\u691c\u8a3c\u3055\u308c\u308b\u30af\u30e9\u30b9\u306e\u683c\u7d0d\u5834\u6240\u3001\u306a\u3093\u3066\u3044\u3089\u3093\u304b\u3082\u306d\u3002<br \/>\n\u65e2\u306b\u5b58\u5728\u3057\u3066\u3044\u3066\u7d76\u5bfe\u30d1\u30b9\u304b\u4f55\u304b\u3067\u547c\u3073\u51fa\u3057\u305d\u3046\u3060\u3057\u3002<\/p>\n<p>1. \u307e\u305a\u306f composer.json \u3092\u66f8\u304f\u3088<br \/>\n  c:\\vhosts\\phpunit\\composer.json \u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u3063\u3066<br \/>\n\u2193\u306e\u5185\u5bb9\u3067\u4fdd\u5b58<\/p>\n<pre>\r\n{\r\n    \"name\":\"hogehoge\/phpunittest\",\r\n    \"config\": {\r\n        \"platform\":{\r\n            \"php\": \"5.6.23\"\r\n        }\r\n    },\r\n    \"require\": {\r\n        \"phpunit\/phpunit\": \"*\"\r\n    }\r\n}\r\n<\/pre>\n<p>name \u306e\u3068\u3053\u308d\u306f\u81ea\u5206\u306e\u597d\u304d\u306a\u540d\u524d\u306b\u5909\u3048\u3066\u3082\u3044\u3044\u3057\u3001\u7121\u304f\u3057\u3066\u3082\u3044\u3044\u3002<br \/>\nphp\u306e\u3068\u3053\u308d\u306f\u81ea\u5206\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u5408\u308f\u305b\u3066\u306d<br \/>\nphp\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u66f8\u304f\u3068\u3001\u305d\u308c\u306b\u5408\u3063\u305f\u4e2d\u3067\u4e00\u756a\u65b0\u3057\u3044\u306e\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u308b\u307f\u305f\u3044\u3002<br \/>\n\u3044\u3044\u52a0\u6e1bphp7\u306b\u79fb\u884c\u3057\u308d\u3088\u3063\u3066\u8a71\u304b\u3082\u3067\u3059\u304c\u3001\u3044\u308d\u3044\u308d\u4e8b\u60c5\u304c\u306d\uff57<\/p>\n<p>2. composer \u3092\u4f7f\u3063\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3060<\/p>\n<pre>\r\n  cd c:\\vhosts\\phpunit\r\n  composer install \r\n<\/pre>\n<p>\u3068\u30b3\u30de\u30f3\u30c9\u3092\u6253\u3061\u307e\u3059\u3002<br \/>\n\u6012\u3089\u308c\u305f\u3089composer.json\u3092\u78ba\u8a8d\u3057\u305f\u308a\u3001php.ini\u3092\u78ba\u8a8d\u3057\u305f\u308a\uff1f<br \/>\n\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u82f1\u8a9e\u3067\u3059\u304c\u3001\u3061\u3083\u3093\u3068\u308f\u304b\u308a\u3084\u3059\u304f\u66f8\u3044\u3066\u308b\u3063\u307d\u3044\u306e\u3067<br \/>\n\u8aad\u3080\u304b\u3001\u7ffb\u8a33\u306b\u304b\u3051\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>3. \u691c\u8a3c\u3055\u308c\u308b\u30af\u30e9\u30b9\u3092\u66f8\u304f\u3088<\/p>\n<p>c:\\vhosts\\phpunit\\classes\\Hoge.php \u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u308a<br \/>\n\u4e0b\u306e\u5185\u5bb9\u3092\u66f8\u3044\u3066\u4fdd\u5b58<\/p>\n<pre>\r\n<?php\r\n\r\n\tclass Hoge{\r\n\r\n\t\t\/**\r\n\t\t * \u5165\u529b\u3055\u308c\u305f\u6587\u5b57\u5217\u3092\u5927\u6587\u5b57\u306b\u3057\u3066\u8fd4\u3059\r\n\t\t *\/\r\n\t\r\n\t\tfunction toOomoji($str){\r\n\t\t\treturn strToUpper($str);\r\n\t\t}\r\n\t\t\r\n\t\t\/**\r\n\t\t * \u5165\u529b\u3055\u308c\u305f\u6587\u5b57\u5217\u3092\u5c0f\u6587\u5b57\u306b\u3057\u3066\u8fd4\u3059\r\n\t\t * \u203b\u3067\u3082hoge\u3063\u3066\u5165\u529b\u3055\u308c\u308b\u3068hage\u3063\u3066\u8fd4\u3059\u300c\u3000\u30d0\u3000\u30b0\u3000\u300d\u304c\u3042\u308b\r\n\t\t *\/\r\n\t\tfunction toKomoji($str){\r\n\t\t\tif($str =='hoge')return 'hage';\r\n\t\t\treturn strToLower($str);\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}\r\n\t\r\n?>\r\n<\/pre>\n<p>\u5165\u529b\u3055\u308c\u305f\u6587\u5b57\u3092\u5927\u6587\u5b57\u306b\u305d\u308d\u3048\u305f\u308a\u5c0f\u6587\u5b57\u306b\u305d\u308d\u3048\u305f\u308a\u3059\u308b\u30af\u30e9\u30b9\u3067\u3059\u3002<br \/>\n\u3067\u3082\u3001\u30d0\u30b0\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\ntoKomoji\u306bhoge \u3092\u5165\u308c\u308b\u3068 hoge \u304c\u8fd4\u3063\u3066\u304f\u308b\u306f\u305a\u306a\u306e\u306b\u3001\u306a\u305c\u304bhage \u304c\u8fd4\u3063\u3066\u304f\u308b\u3068\u3044\u3046\u30d0\u30b0\u3067\u3059\u3002<br \/>\n\u3053\u308c\u306f\u4ed5\u69d8\u3067\u306f\u306a\u304f\u30d0\u30b0\u3067\u3059\u3002<br \/>\n\u591a\u5206\u3001\u4f1a\u793e\u304c\u5acc\u306b\u306a\u3063\u3066\u8f9e\u3081\u308b\u76f4\u524d\u306b\u3042\u308a\u3063\u305f\u3051\u306e\u60aa\u610f\u3092\u53e9\u304d\u8fbc\u3093\u3060\u306e\u3067\u3057\u3087\u3046\u3002<br \/>\n\u3044\u3044\u5b50\u306e\u307f\u3093\u306a\u306f\u771f\u4f3c\u3057\u306a\u3044\u3067\u306d\uff01<\/p>\n<p>4. \u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u30c6\u30b9\u30c8\u3059\u308b\u3088\u3000\u305d\u306e1<\/p>\n<p>\u307f\u306a\u3055\u3093\u3001\u304a\u5f85\u3061\u304b\u306d\uff01<br \/>\n\u3084\u3063\u3068PhpUnit\u306e\u51fa\u756a\u3060\u3088\uff01<br \/>\n\u8907\u6570\u306e\u691c\u8a3c\u7528\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4e00\u767a\u3067\u8d70\u3089\u305b\u308b\u306e\u304c\u524d\u63d0\u3060\u3068\u601d\u3046\u306e\u3067<br \/>\n\u305d\u308c\u3063\u307d\u304f\u3059\u308b\u305f\u3081\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u4e8c\u3064\u4f5c\u308b\u3064\u3082\u308a\u3060\u3051\u3069<br \/>\n\u3068\u308a\u3042\u3048\u305a\u306f\u3072\u3068\u3064\u3060\u3051\u3001\u30c6\u30b9\u30c8\u304c\u6210\u529f\u3059\u308b\u30d1\u30bf\u30fc\u30f3\u3092\u66f8\u304f\u3088<\/p>\n<p>\u540d\u524d\u306e\u898f\u5247\u306f\u3068\u308a\u3042\u3048\u305a\u4e8c\u3064\u3042\u3063\u3066<br \/>\n\u3000\u30c6\u30b9\u30c8\u7528\u306e\u30af\u30e9\u30b9\u540d\u3068\u30d5\u30a1\u30a4\u30eb\u540d\u306f\u4e00\u7dd2\u306b\u3057\u306a\u3044\u3068\u30c0\u30e1\u307f\u305f\u3044\u3002<br \/>\n\u3063\u3066\u3044\u3046\u306e\u3068<br \/>\n\u3000\u30c6\u30b9\u30c8\u7528\u306e\u95a2\u6570\u306e\u540d\u524d\u306f test\u306a\u3093\u3068\u304b \u306b\u3057\u306a\u3044\u3068\u30c0\u30e1\u307f\u305f\u3044\u3002<br \/>\n\u3063\u3066\u3053\u3068\u3089\u3057\u3044\u3002<\/p>\n<p>\u4e00\u3064\u76ee<br \/>\nc:\\vhosts\\phpunit\\case\\SuccessTest.php \u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u3063\u3066\u4e0b\u306e\u5185\u5bb9\u3067\u4fdd\u5b58<\/p>\n<pre>\r\n<?php\r\nrequire_once __DIR__.'\/..\/classes\/hoge.php';\r\nclass SuccessTest extends PHPUnit_Framework_TestCase {\r\n\r\n    \/** \r\n     * @var Hoge \r\n     *\/\r\n    protected $obj;\r\n \r\n    \/** \r\n     * setUp\u306f\u5404\u30c6\u30b9\u30c8\u30e1\u30bd\u30c3\u30c9\u304c\u5b9f\u884c\u3055\u308c\u308b\u524d\u306b\u5b9f\u884c\u3055\u308c\u308b \r\n     *\/\r\n    protected function setUp() { \r\n        \/\/ \u30c6\u30b9\u30c8\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u751f\u6210\u3059\u308b\r\n        $this->obj = new Hoge();\r\n    }\r\n \r\n    \/**\r\n     * \u5927\u6587\u5b57\u5909\u63db\u306e\u30c6\u30b9\u30c8\r\n     *\/\r\n    public function testToOomoji() {\r\n\r\n        $this->assertEquals('ABC', $this->obj->toOomoji('abc'));\r\n        $this->assertEquals('ABC', $this->obj->toOomoji('ABC'));\r\n        $this->assertEquals('ABC', $this->obj->toOomoji('abC'));\r\n    }\r\n \r\n    \/**\r\n     * \u5c0f\u6587\u5b57\u5909\u63db\u306e\u30c6\u30b9\u30c8\r\n     *\/\r\n    public function testToKomoji() {\r\n\r\n        $this->assertEquals('abc', $this->obj->toKomoji('abc'));\r\n        $this->assertEquals('abc', $this->obj->toKomoji('ABC'));\r\n        $this->assertEquals('abc', $this->obj->toKomoji('abC'));\r\n    }\r\n\r\n}\r\n\r\n?>\r\n<\/pre>\n<p>\u4fdd\u5b58\u304c\u3067\u304d\u305f\u3089<br \/>\n\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u6253\u3063\u3066\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3060\uff01<\/p>\n<pre>\r\nc:\\vhosts\\phpunit\\vendor\\bin\\phpunit c:\\vhosts\\phpunit\\case\\SuccessTest.php\r\n<\/pre>\n<p>\u30b3\u30de\u30f3\u30c9\u304c\u9577\u3044\u306e\u306f \u30d1\u30b9\u3092\u901a\u3057\u305f\u308a cd\u3067\u79fb\u52d5\u3057\u305f\u308a\u3059\u308c\u3070\u89e3\u6c7a\u3059\u308b\u304b\u3082\u3060\u3051\u3069<br \/>\n\u305d\u3046\u3044\u3046\u8a2d\u5b9a\u306f\u81ea\u5206\u3067\u8003\u3048\u3066\u4f7f\u3044\u3084\u3059\u304f\u8abf\u6574\u3057\u3066\u307b\u3057\u3044\u3002<\/p>\n<p>\u3061\u3083\u3093\u3068\u52d5\u3044\u3066\u308c\u3070<\/p>\n<pre>\r\nc:\\vhosts\\phpunit>c:\\vhosts\\phpunit\\vendor\\bin\\phpunit c:\\vhosts\\phpunit\\case\\SuccessTest.php\r\nPHPUnit 5.7.22 by Sebastian Bergmann and contributors.\r\n\r\n..                                                                 2 \/ 2 (100%)\r\n\r\nTime: 71 ms, Memory: 2.00MB\r\n\r\nOK (2 tests, 6 assertions)\r\n<\/pre>\n<p>\u2191\u3053\u3093\u306a\u611f\u3058\u3067\u8868\u793a\u3055\u308c\u308b\u3068\u601d\u3046\u3002<\/p>\n<p>5. \u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u30c6\u30b9\u30c8\u3059\u308b\u3088\u3000\u305d\u306e2<\/p>\n<p>\u3093\u3058\u3083\u6b21\u306f\u3055\u3063\u304d\u306e\u60aa\u610f\u306e\u3042\u308b\u30b3\u30fc\u30c9\u3092\u5076\u7136\u306b\u3082\u8e0f\u3080\u30c6\u30b9\u30c8\u3092\u66f8\u3044\u3066\u307f\u308b\u3088\uff01<br \/>\n\u3053\u3046\u3057\u3066\u65e9\u671f\u767a\u898b\u3057\u305f\u30d0\u30b0\u306e\u72af\u4eba\u306f\u304d\u3063\u3068\u30a2\u30a4\u30c4\u3060\uff01<\/p>\n<p>c:\\vhosts\\phpunit\\case\\FailureTest.php \u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u3063\u3066\u4e0b\u306e\u5185\u5bb9\u3067\u4fdd\u5b58<\/p>\n<pre>\r\n<?php\r\nrequire_once __DIR__.'\/..\/classes\/hoge.php';\r\nclass FailureTest extends PHPUnit_Framework_TestCase {\r\n\r\n    \/** \r\n     * @var Hoge \r\n     *\/\r\n    protected $obj;\r\n \r\n    \/** \r\n     * setUp\u306f\u5404\u30c6\u30b9\u30c8\u30e1\u30bd\u30c3\u30c9\u304c\u5b9f\u884c\u3055\u308c\u308b\u524d\u306b\u5b9f\u884c\u3055\u308c\u308b \r\n     *\/\r\n    protected function setUp() { \r\n        \/\/ \u30c6\u30b9\u30c8\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u751f\u6210\u3059\u308b\r\n        $this->obj = new Hoge();\r\n    }\r\n \r\n    \/**\r\n     * \u5927\u6587\u5b57\u5909\u63db\u306e\u30c6\u30b9\u30c8\r\n     *\/\r\n    public function testToOomoji() {\r\n\r\n        $this->assertEquals('HOGE', $this->obj->toOomoji('hoge'));\r\n        $this->assertEquals('HOGE', $this->obj->toOomoji('HOGE'));\r\n        $this->assertEquals('HOGE', $this->obj->toOomoji('hoGE'));\r\n    }\r\n \r\n    \/**\r\n     * \u5c0f\u6587\u5b57\u5909\u63db\u306e\u30c6\u30b9\u30c8\r\n     *\/\r\n    public function testToKomoji() {\r\n\r\n        $this->assertEquals('hoge', $this->obj->toKomoji('hoge'));\r\n        $this->assertEquals('hoge', $this->obj->toKomoji('HOGE'));\r\n        $this->assertEquals('hoge', $this->obj->toKomoji('hoGE'));\r\n    }\r\n\r\n}\r\n\r\n?>\r\n<\/pre>\n<p>\u305d\u3057\u305f\u3089\u30c6\u30b9\u30c8\u3060\uff01<br \/>\n\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u4eca\u56de\u306f 4. \u3067\u4f5c\u3063\u305f SuccessTest.php \u3082\u4e00\u7dd2\u306b\u30c6\u30b9\u30c8<br \/>\n\u3068\u3044\u3046\u304b\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u5165\u3063\u3066\u308b\u3082\u306e\u307e\u3068\u3081\u3066\u30c6\u30b9\u30c8\u3059\u308b\u3088<br \/>\n\u524d\u56de\u30d5\u30a1\u30a4\u30eb\u540d\u3060\u3063\u3066\u3068\u3053\u308d\u3092\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u306b\u3057\u3066\u3084\u308c\u3070\u3044\u3044\u3060\u3051\u3001\u7c21\u5358\u3060\u306d\uff01<\/p>\n<pre>\r\nc:\\vhosts\\phpunit\\vendor\\bin\\phpunit c:\\vhosts\\phpunit\\case\r\n<\/pre>\n<p>\u4eca\u56de\u306e\u7d50\u679c\u306f\u30fb\u30fb\u30fb<\/p>\n<pre>\r\nc:\\vhosts\\phpunit>c:\\vhosts\\phpunit\\vendor\\bin\\phpunit c:\\vhosts\\phpunit\\case\r\nPHPUnit 5.7.22 by Sebastian Bergmann and contributors.\r\n\r\n.F..                                                               4 \/ 4 (100%)\r\n\r\nTime: 84 ms, Memory: 2.50MB\r\n\r\nThere was 1 failure:\r\n\r\n1) FailureTest::testToKomoji\r\nFailed asserting that two strings are equal.\r\n--- Expected\r\n+++ Actual\r\n@@ @@\r\n-'hoge'\r\n+'hage'\r\n\r\nC:\\vhosts\\phpunit\\case\\FailureTest.php:33\r\n\r\nFAILURES!\r\nTests: 4, Assertions: 10, Failures: 1.\r\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\uff01<br \/>\n\u30a8\u30e9\u30fc\u3060\u3063\u3066\u4e8b\u3082\u3001\u3069\u3093\u306a\u30a8\u30e9\u30fc\u304b\u3063\u3066\u306e\u3082\u306a\u3093\u3068\u306a\u304f\u96f0\u56f2\u6c17\u3067\u308f\u304b\u308b\u3068\u601d\u3046\u3002<br \/>\n\u30db\u30f3\u30c8\u306f\u82f1\u8a9e\u52c9\u5f37\u3057\u305f\u65b9\u304c\u3044\u3044\u3093\u3060\u308d\u3046\u306d\u3002orz<\/p>\n<p>6. \u3058\u3083\u3042\u3064\u3044\u3067\u3060\u304b\u3089\u30d0\u30b0\u76f4\u3057\u3066\u307f\u3088\u3046\u304b\u3002<\/p>\n<p>5\u306e\u30c6\u30b9\u30c8\u7d50\u679c\u3092\u898b\u308b\u3068<br \/>\nFailureTest.php\u306e33\u884c\u76ee\u306b\u66f8\u3044\u3066\u3042\u308b\u30c6\u30b9\u30c8\u3067<br \/>\nhoge\u304c\u8fd4\u3063\u3066\u304f\u308b\u3079\u304d\u95a2\u6570\u3067hage\u304c\u8fd4\u3063\u3066\u304d\u305f\u3088<br \/>\n\u3068\u3044\u3046\u306e\u304c\u308f\u304b\u308b\u306e\u3067<br \/>\n\u307e\u305a33\u884c\u76ee\u3092\u629c\u7c8b\u2193<br \/>\n$this->assertEquals('hage', $this->obj->toKomoji('hoge'));<br \/>\nobj\u306fHoge\u30af\u30e9\u30b9\u306a\u306e\u3067 Hoge->toKomiji() \u304c\u304a\u304b\u3057\u3044\u305e\u3001\u3068\u63a8\u7406\u3092\u50cd\u304b\u305b\u3066\u95a2\u6570\u306e\u4e2d\u8eab\u3092\u898b\u3066\u307f\u308b<\/p>\n<pre>\r\n\t\tfunction toKomoji($str){\r\n\t\t\tif($str =='hoge')return 'hage';\r\n\t\t\treturn strToLower($str);\r\n\t\t}\r\n<\/pre>\n<p>\u305d\u3057\u3066\u6c17\u304c\u4ed8\u304f\u3001\u306a\u3093\u3060\u3053\u308c\uff01\uff1f<\/p>\n<pre>\r\n\t\tfunction toKomoji($str){\r\n\t\t\tif($str =='hoge')return 'hage'; \/\/<=\u306a\u3093\u3060\u30b3\u30ec\uff01\uff1f\r\n\t\t\treturn strToLower($str);\r\n\t\t}\r\n<\/pre>\n<p>\u306a\u3093\u3060\u30b3\u30ec\uff01\uff1f\u306a\u30b3\u30fc\u30c9\u306e\u884c\u3092\u6d88\u3057\u3066\u304b\u3089\u518d\u5ea6\u30c6\u30b9\u30c8\u3059\u308b\u3068<\/p>\n<pre>\r\nc:\\vhosts\\phpunit>c:\\vhosts\\phpunit\\vendor\\bin\\phpunit c:\\vhosts\\phpunit\\case\r\nPHPUnit 5.7.22 by Sebastian Bergmann and contributors.\r\n\r\n....                                                               4 \/ 4 (100%)\r\n\r\nTime: 70 ms, Memory: 2.25MB\r\n\r\nOK (4 tests, 12 assertions)\r\n<\/pre>\n<p>\u7121\u4e8b\u306b\u30d0\u30b0\u304c\u7121\u304f\u306a\u308a<br \/>\n\u305d\u308c\u306f\u3001\u3064\u3044\u5148\u65e5\u5931\u8e2a\u3057\u305fK\u3055\u3093\u306e\u91ce\u671b\u306f\u6f70\u3048\u305f\u3053\u3068\u3092\u610f\u5473\u3059\u308b\u3002<br \/>\n\u5c1a\u3001\u7121\u80fd\u306a\u55b6\u696d\u306fK\u3055\u3093\u306b\u96fb\u8a71\u3092\u3057\u305f\u304c\u65e2\u306b\u4e0d\u901a\u3068\u306a\u3063\u3066\u3044\u305f\u3002<br \/>\n\u540c\u50da\u306f\u6068\u3080\u3067\u3082\u306a\u304f\u3001\u305f\u3060K\u3055\u3093\u306e\u5e78\u305b\u3092\u9858\u3046\u306e\u3067\u3042\u3063\u305f\u3002<\/p>\n<p>\u3068\u3001\u307e\u3041\u3053\u3093\u306a\u611f\u3058\u3067\u4f7f\u3046\u3089\u3057\u3044\u3002<br \/>\n\u3067\u3082\u3001\u3042\u304f\u307e\u3067\u57fa\u672c\u3002<br \/>\n\u3044\u308d\u3093\u306a\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u306e\u7528\u610f\u306e\u4ed5\u65b9\u3068\u304b\u3044\u308d\u3044\u308d\u3042\u308b\u306e\u3067<br \/>\n\u3082\u3063\u3068\u52c9\u5f37\u3057\u3066\u4f7f\u3044\u3053\u306a\u3059\u3079\u3057\u3001\u3063\u3066\u611f\u3058\u3067\u3059\u306d\u3002<\/p>\n<p>\u4eca\u65e5\u306f\u3053\u306e\u8fba\u3067\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300c\u3048\uff1fphpunit\u4f7f\u3063\u305f\u3053\u3068\u306a\u3044\u3068\u304b\u30de\u30b8\u3059\u304b\uff01\uff1f\u300d \u3063\u3066\u8ab0\u304b\u306b\u8a00\u308f\u308c\u305f\u6c17\u304c\u3059\u308b &hellip; <a href=\"https:\/\/blog.chiekoubou.com\/?p=853\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,25],"tags":[],"class_list":["post-853","post","type-post","status-publish","format-standard","hentry","category-php","category-se"],"_links":{"self":[{"href":"https:\/\/blog.chiekoubou.com\/index.php?rest_route=\/wp\/v2\/posts\/853"}],"collection":[{"href":"https:\/\/blog.chiekoubou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chiekoubou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chiekoubou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chiekoubou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=853"}],"version-history":[{"count":9,"href":"https:\/\/blog.chiekoubou.com\/index.php?rest_route=\/wp\/v2\/posts\/853\/revisions"}],"predecessor-version":[{"id":862,"href":"https:\/\/blog.chiekoubou.com\/index.php?rest_route=\/wp\/v2\/posts\/853\/revisions\/862"}],"wp:attachment":[{"href":"https:\/\/blog.chiekoubou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chiekoubou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chiekoubou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}