{"id":7445,"date":"2018-05-09T17:46:56","date_gmt":"2018-05-09T08:46:56","guid":{"rendered":"https:\/\/www.agent-grow.com\/self20percent\/?p=7445"},"modified":"2018-05-09T17:46:56","modified_gmt":"2018-05-09T08:46:56","slug":"phpunit_testing_private_and_protected_methods","status":"publish","type":"post","link":"https:\/\/www.agent-grow.com\/self20percent\/2018\/05\/09\/phpunit_testing_private_and_protected_methods\/","title":{"rendered":"phpunit\u3067\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306bprivate\u3068protected\u306a\u30e1\u30bd\u30c3\u30c9\u3078\u7c21\u5358\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u30af\u30e9\u30b9\u3092\u4f5c\u3063\u3066\u307f\u305f"},"content":{"rendered":"<p>\u4e45\u3057\u3076\u308a\u306b\u6280\u8853\u30cd\u30bf\u304c\u3067\u304d\u305f\u306e\u3067\u6295\u7a3f\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u8fd1\u3001\u793e\u5185\u30b7\u30b9\u30c6\u30e0\u30c1\u30fc\u30e0\u3067\u3082\u300c\u54c1\u8cea\u5411\u4e0a\u306e\u305f\u3081\u306b\u81ea\u52d5\u30c6\u30b9\u30c8\u3092\u5c0e\u5165\u3057\u3066\u3044\u3053\u3046\u305c\u300d\u3068\u3044\u3046\u6d41\u308c\u306b\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u4e2d\u3067private\u3068protected\u306e\u30e1\u30bd\u30c3\u30c9\u3092public\u306e\u3082\u306e\u3067\u3042\u308b\u304b\u306e\u3088\u3046\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u30af\u30e9\u30b9\u3092\u7528\u610f\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u7d50\u69cb\u4f7f\u3044\u3084\u3059\u3044\u4ee3\u7269\u306b\u306a\u3063\u305f\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u3061\u3087\u3063\u3068\u66f8\u3044\u3066\u304a\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h1>\u3069\u3046\u3057\u3066\u3053\u3093\u306a\u3053\u3068\u3092\u3084\u308d\u3046\u3068\u3057\u305f\u306e\u304b\uff1f<\/h1>\n<p>\u5b9f\u306f\u4eca\u307e\u3067\u793e\u5185\u30b7\u30b9\u30c6\u30e0\u306b\u306f\u81ea\u52d5\u30c6\u30b9\u30c8\u304c\u307b\u3068\u3093\u3069\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u3044\u307e\u306f\u3060\u3044\u305f\u3044\u306e\u6a5f\u80fd\u3092\u628a\u63e1\u3057\u3066\u3044\u308b\u306e\u3067\u4f55\u3068\u304b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u4eca\u5f8c\u6a5f\u80fd\u304c\u5897\u3048\u3066\u3044\u304f\u3068\u304d\u306b\u3069\u3046\u8003\u3048\u3066\u3082\u5f71\u97ff\u7bc4\u56f2\u304c\u308f\u304b\u3089\u306a\u304f\u306a\u3063\u3066\u8f9b\u304f\u306a\u3063\u3066\u3044\u304f\u672a\u6765\u304c\u898b\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u5c11\u3057\u305a\u3064\u3067\u3082phpunit\u3092\u4f7f\u3063\u3066\u81ea\u52d5\u30c6\u30b9\u30c8\u3092\u4f5c\u3063\u3066\u3044\u304f\u3053\u3068\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u624b\u59cb\u3081\u306b\u3044\u307e\u4f5c\u3063\u3066\u3044\u308b\u3068\u3053\u308d\u304b\u3089\u9806\u306b\u4f5c\u3063\u3066\u3044\u3053\u3046\u3068\u601d\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u79c1\u306e\u601d\u60f3\u7684\u306a\u30a2\u30ec\u3067\u3044\u308d\u3093\u306a\u51e6\u7406\u3092private\u3084protected\u306a\u30e1\u30bd\u30c3\u30c9\u306b\u304a\u9858\u3044\u3059\u308b\u3088\u3046\u306a\u4f5c\u308a\u65b9\u3092\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u308c\u3089\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u30c6\u30b9\u30c8\u3059\u308b\u5fc5\u8981\u306b\u8feb\u3089\u308c\u307e\u3057\u305f\u3002<\/p>\n<h2>\u4f55\u304c\u554f\u984c\u306a\u306e\uff1f<\/h2>\n<p>private\u3068protected\u306a\u30e1\u30bd\u30c3\u30c9\u306f\u901a\u5e38\u306e\u65b9\u6cd5\u3067\u306f\u5916\u304b\u3089\u547c\u3079\u306a\u3044\u305f\u3081\u3001phpunit\u306a\u3069\u3067\u30c6\u30b9\u30c8\u3092\u3059\u308b\u969b\u306b\u7d50\u69cb\u9762\u5012\u3067\u3059\u3002<\/p>\n<p>\u203b \u4ee5\u4e0b\u306e\u8aac\u660e\u3067\u306f\u4ee5\u4e0b\u306e\u30af\u30e9\u30b9\u3092\u30c6\u30b9\u30c8\u3059\u308b\u5834\u5408\u3092\u60f3\u5b9a\u3057\u307e\u3059<\/p>\n<pre><code>class YourTestTargetClass{\n\n    private function somePrivateMethod($some_data)\n    {\n        return $some_data !== '';\n    }\n\n}\n<\/code><\/pre>\n<p>\u3061\u3087\u3063\u3068\u8abf\u3079\u308b\u3068\u3053\u3093\u306a\u611f\u3058\u3067\u3084\u308c\u3070\u5927\u4e08\u592b\u3060\u3088\uff01\u3068\u3044\u3046\u60c5\u5831\u304c\u898b\u3064\u304b\u308a\u307e\u3059\u3002<\/p>\n<pre><code>$target = new YourTestTargetClass();\n\n\/\/ \u3053\u3053\u304b\u3089private\/protected\u306a\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3079\u308b\u3088\u3046\u306b\u3059\u308b\u304a\u307e\u3058\u306a\u3044\n$reflection = new \\ReflectionClass('YourTestTargetClass');\n$method = $reflection-&gt;getMethod('somePrivateMethod');\n$method-&gt;setAccessible(true);\n\n$argument = 'hogehoge';\n\n\/\/ private\u306a\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3076\necho $method-&gt;invokeArgs($target, [$argument]);\n<\/code><\/pre>\n<p>\u3053\u3093\u306a\u306e\u6bce\u56de\u3084\u3063\u3066\u3089\u308c\u306a\u3044\u306a\u3041\u3068\u3044\u3046\u306e\u304c\u6b63\u76f4\u306a\u611f\u60f3\u3067\u3057\u305f\u3002<\/p>\n<h1>\u3068\u3044\u3046\u308f\u3051\u3067\u697d\u306b\u3084\u308b\u5b50\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f<\/h1>\n<p>\u3053\u306e\u30af\u30e9\u30b9\u3092\u4f7f\u3046\u3068\u30a2\u30af\u30bb\u30b9\u5236\u9650\u3092\u7121\u8996\u3057\u3066\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u610f\u56f3\u3057\u306a\u3044\u4f7f\u3044\u65b9\u304c\u5897\u3048\u308b\u3053\u3068\u3067\u4fdd\u5b88\u8981\u56e0\u304b\u3089\u6b7b\u4eba\u304c\u51fa\u308b\u53ef\u80fd\u6027\u304c\u9ad8\u304f\u306a\u308b\u306e\u3067\u3001\u4f7f\u3046\u306e\u306f\u30c6\u30b9\u30c8\u306e\u6642\u304f\u3089\u3044\u306b\u3057\u3066\u304a\u304f\u3053\u3068\u3092\u5f37\u304f\u30aa\u30b9\u30b9\u30e1\u3057\u307e\u3059\u3002<\/p>\n<p>private\u306a\u30e1\u30bd\u30c3\u30c9\u3082\u30c6\u30b9\u30c8\u3059\u308b\u30af\u30e9\u30b9<\/p>\n<pre><code>class MethodTester\n{\n    \/** @var object \u30c6\u30b9\u30c8\u51e6\u7406\u3092\u5b9f\u884c\u3059\u308b\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9 *\/\n    protected $___target_instance;\n\n    \/** @var object ReflectionClass\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 *\/\n    protected $___reflect_obj;\n\n    \/**\n     * MethodTester constructor.\n     *\n     * @param object $target_instance private, protected\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3079\u308b\u3088\u3046\u306b\u3059\u308b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\n     * @throws \\ReflectionException\n     *\/\n    public function __construct($target_instance)\n    {\n        $this-&gt;___target_instance = $target_instance;\n        $this-&gt;___reflect_obj     = new \\ReflectionClass($target_instance);\n    }\n\n    public function __get($name)\n    {\n        $property = $this-&gt;___reflect_obj-&gt;getProperty($name);\n        $property-&gt;setAccessible(true);\n        return $property-&gt;getValue($this-&gt;___target_instance);\n    }\n\n    public function __set($name, $value)\n    {\n        $property = $this-&gt;___reflect_obj-&gt;getProperty($name);\n        $property-&gt;setAccessible(true);\n        $property-&gt;setValue($this-&gt;___target_instance, $value);\n    }\n\n    public function __call($name, $arguments)\n    {\n        $method = $this-&gt;___reflect_obj-&gt;getMethod($name);\n        $method-&gt;setAccessible(true);\n        return $method-&gt;invokeArgs($this-&gt;___target_instance, $arguments);\n    }\n}\n<\/code><\/pre>\n<h2>\u4f7f\u3044\u65b9<\/h2>\n<p>\u5148\u307b\u3069\u306eYourTestTargetClass\u30af\u30e9\u30b9\u3092\u4f55\u3082\u8003\u3048\u305a\u306b\u30c6\u30b9\u30c8\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u5f53\u7136\u5b9f\u884c\u6642\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059<span class=\"footnote_referrer\"><a role=\"button\" tabindex=\"0\" onclick=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_1');\" onkeypress=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_1');\" ><sup id=\"footnote_plugin_tooltip_7445_1_1\" class=\"footnote_plugin_tooltip_text\">1)<\/sup><\/a><span id=\"footnote_plugin_tooltip_text_7445_1_1\" class=\"footnote_tooltip\">\u8f9b\u3044\u3067\u3059\u306d\u3002<\/span><\/span><script type=\"text\/javascript\"> jQuery('#footnote_plugin_tooltip_7445_1_1').tooltip({ tip: '#footnote_plugin_tooltip_text_7445_1_1', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top center', relative: true, offset: [10, 10], });<\/script><\/p>\n<pre><code>\/\/ \u666e\u901a\u306b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3057\u3066\u30c6\u30b9\u30c8\u3057\u3088\u3046\u3068\u3057\u3066\u307f\u308b\n$target = new YourTestTargetClass();\n$correct_data = 'hogehoge';\n\n\/\/ \u5916\u304b\u3089private\u30e1\u30bd\u30c3\u30c9\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u306e\u3067\u30a8\u30e9\u30fc\u767a\u751f\necho $target-&gt;somePrivateMethod($correct_data);\n<\/code><\/pre>\n<p>\u305d\u3053\u3067\u4eca\u56de\u4f5c\u6210\u3057\u305fMethodTester\u3092\u4f7f\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u4e0b\u306e\u3088\u3046\u306b\u4f7f\u3046\u3053\u3068\u3067private\u3068protected\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><code>\/\/ MethodTester \u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306bprivate\u30e1\u30bd\u30c3\u30c9\u306e\u30c6\u30b9\u30c8\u3092\u3057\u305f\u3044\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u6e21\u3057\u307e\u3059\u3002\n$target = new MethodTester(new YourTestTargetClass());\n$correct_data = 'hogehoge';\n\n\/\/ $target\u304cYourTestTargetClass\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u3042\u308b\u304b\u306e\u3088\u3046\u306b\u4f7f\u3046\u3068\n\/\/ private\u30e1\u30bd\u30c3\u30c9\u304cpublic\u30e1\u30bd\u30c3\u30c9\u3067\u3042\u308b\u304b\u306e\u3088\u3046\u306b\u547c\u3079\u307e\u3059\necho $target-&gt;somePrivateMethod($correct_data);\n<\/code><\/pre>\n<p>phpunit\u3067\u30c6\u30b9\u30c8\u3059\u308b\u5834\u5408\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4f7f\u3048\u3070\u5927\u4e08\u592b\u306a\u30cf\u30ba\u3067\u3059<\/p>\n<pre><code>class YourTestTargetClassTest extends TestCase\n{\n    public function test_somePrivateMethod()\n    {\n        $target = new MethodTester(new YourTestTargetClass());\n        $this-&gt;assertTrue($target-&gt;somePrivateMethod('hogehoge'));\n        $this-&gt;assertNotTrue($target-&gt;somePrivateMethod(''));\n    }\n}\n<\/code><\/pre>\n<h1>\u3053\u3053\u306b\u3053\u3060\u308f\u3063\u3066\u4f5c\u308a\u307e\u3057\u305f\uff08\u30c9\u30e4\u30a1<\/h1>\n<p>\u3061\u3087\u3063\u3068\u8abf\u3079\u308b\u3068\u540c\u69d8\u306e\u30af\u30e9\u30b9\u306f\u305f\u304f\u3055\u3093\u898b\u3064\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u3082\u308f\u3056\u308f\u3056\u81ea\u4f5c\u3057\u305f\u306e\u306f\u3001\u304b\u306a\u308a\u500b\u4eba\u7684\u306a\u8da3\u5473\u306e\u305f\u3081\u3067\u3059\u3002<\/p>\n<p>\u79c1\u306f\u3053\u3046\u3044\u3046\u4fbf\u5229\u30af\u30e9\u30b9\u3092\u4f7f\u3046\u6642\u306b\u300c\u3044\u304b\u306b\u3082\u30a2\u30c0\u30d7\u30bf\u3063\u307d\u3044\u30af\u30e9\u30b9\u3092\u4f7f\u3063\u3066\u307e\u3059\u3088\u30fc\u300d\u3068\u3044\u3046\u4f7f\u3044\u65b9\u3092\u3057\u306a\u3051\u308c\u3070\u3044\u3051\u306a\u3044\u3064\u304f\u308a\u306f\u3042\u307e\u308a\u597d\u304d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u306a\u306e\u3067\u30a2\u30c0\u30d7\u30bf\u3063\u307d\u3044\u30af\u30e9\u30b9\u3092\u610f\u8b58\u3057\u306a\u3044\u3067\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3053\u3063\u305d\u308a\u3068private\/protected\u306a\u30e1\u30f3\u30d0\u5909\u6570\u306b\u3064\u3044\u3066\u3082\u5916\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u4f5c\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>\u52d5\u304d\u3092\u7c21\u5358\u306b\u89e3\u8aac\u3057\u307e\u3059<\/h1>\n<p>\u3082\u306e\u3059\u3054\u304f\u7c21\u5358\u306b\u8aac\u660e\u3059\u308b\u3068\u3001\u30e1\u30bd\u30c3\u30c9\u30b3\u30fc\u30eb\u306e\u30de\u30b8\u30c3\u30af\u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3057\u3066\u3001\u30af\u30e9\u30b9\u5916\u304b\u3089\u5bfe\u8c61\u30e1\u30bd\u30c3\u30c9\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u3066\u304b\u3089\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<span class=\"footnote_referrer\"><a role=\"button\" tabindex=\"0\" onclick=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_2');\" onkeypress=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_2');\" ><sup id=\"footnote_plugin_tooltip_7445_1_2\" class=\"footnote_plugin_tooltip_text\">2)<\/sup><\/a><span id=\"footnote_plugin_tooltip_text_7445_1_2\" class=\"footnote_tooltip\">\u30e1\u30f3\u30d0\u5909\u6570\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3082\u540c\u69d8\u3067\u3059<\/span><\/span><script type=\"text\/javascript\"> jQuery('#footnote_plugin_tooltip_7445_1_2').tooltip({ tip: '#footnote_plugin_tooltip_text_7445_1_2', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top center', relative: true, offset: [10, 10], });<\/script><\/p>\n<h2>\u3082\u3046\u3061\u3087\u3063\u3068\u3061\u3083\u3093\u3068\u3057\u305f\u89e3\u8aac<\/h2>\n<p>\u4ee5\u4e0b\u6280\u8853\u7684\u306a\u8a71\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u8208\u5473\u304c\u306a\u3044\u65b9\u306f\u8aad\u307f\u98db\u3070\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u4e3b\u5f79\u306f\u30a2\u30a6\u30c8\u30ed\u30fc\u306aReflectionClass<\/h3>\n<p>\u4eca\u56de\u306e\u4e3b\u5f79\u306f ReflectionClass \u3061\u3083\u3093\u3067\u3059\u3002\uff08<a href=\"http:\/\/jp2.php.net\/manual\/ja\/class.reflectionclass.php\">PHP.net\u306eReflectionClass\u30da\u30fc\u30b8<\/a>\uff09<\/p>\n<p>\u3053\u306e\u5b50\u306f\u30af\u30e9\u30b9\u306e\u69cb\u9020\u3092\u3054\u306b\u3087\u3054\u306b\u3087\u3067\u304d\u308b\u30a2\u30a6\u30c8\u30ed\u30fc\u306a\u30af\u30e9\u30b9\u3067\u3059\u3002<span class=\"footnote_referrer\"><a role=\"button\" tabindex=\"0\" onclick=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_3');\" onkeypress=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_3');\" ><sup id=\"footnote_plugin_tooltip_7445_1_3\" class=\"footnote_plugin_tooltip_text\">3)<\/sup><\/a><span id=\"footnote_plugin_tooltip_text_7445_1_3\" class=\"footnote_tooltip\">\u500b\u4eba\u7684\u306b\u306fc\u306evoid\u30dd\u30a4\u30f3\u30bf\u304f\u3089\u3044\u30a2\u30a6\u30c8\u30ed\u30fc\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/span><\/span><script type=\"text\/javascript\"> jQuery('#footnote_plugin_tooltip_7445_1_3').tooltip({ tip: '#footnote_plugin_tooltip_text_7445_1_3', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top center', relative: true, offset: [10, 10], });<\/script><\/p>\n<p>ReflectionClass\u306egetMethod\u3092\u4f7f\u3048\u3070\u30e1\u30bd\u30c3\u30c9\u306e\u30a2\u30af\u30bb\u30b9\u5236\u9650\u3092\u5909\u66f4\u3057\u305f\u5f8c\u306b\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u666e\u901a\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d44\u3093\u3067\u3044\u308b\u3068\u304d\u306b\u306f\u307b\u307c\u304a\u76ee\u306b\u304b\u304b\u308b\u3053\u3068\u306f\u306a\u3044\u30af\u30e9\u30b9\u3067\u3059\u306d\u3002<span class=\"footnote_referrer\"><a role=\"button\" tabindex=\"0\" onclick=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_4');\" onkeypress=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_4');\" ><sup id=\"footnote_plugin_tooltip_7445_1_4\" class=\"footnote_plugin_tooltip_text\">4)<\/sup><\/a><span id=\"footnote_plugin_tooltip_text_7445_1_4\" class=\"footnote_tooltip\">\u79c1\u306f\u5e78\u904b\u306b\u3082\u4eca\u307e\u3067\u898b\u305f\u3053\u3068\u304c\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f<\/span><\/span><script type=\"text\/javascript\"> jQuery('#footnote_plugin_tooltip_7445_1_4').tooltip({ tip: '#footnote_plugin_tooltip_text_7445_1_4', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top center', relative: true, offset: [10, 10], });<\/script><\/p>\n<h3>\u3082\u3046\u4e00\u4eba\u306e\u4e3b\u5f79\u306f\u30de\u30b8\u30c3\u30af\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>MethodTester \u3067\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3057\u3066\u3044\u308b __call \u3084 __get \u306fphp\u304c\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u308b\u30de\u30b8\u30c3\u30af\u30e1\u30bd\u30c3\u30c9\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002\uff08<a href=\"http:\/\/php.net\/manual\/ja\/language.oop5.magic.php\">php.net\u306e\u30de\u30b8\u30c3\u30af\u30e1\u30bd\u30c3\u30c9\u30da\u30fc\u30b8<\/a>\uff09<\/p>\n<p>PHP.net\u3055\u3093\u3044\u308f\u304f<\/p>\n<blockquote><p>__call() \u306f\u3001 \u30a2\u30af\u30bb\u30b9\u4e0d\u80fd\u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3067\u5b9f\u884c\u3057\u305f\u3068\u304d\u306b\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p><\/blockquote>\n<p>\u3068\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>MethodTester \u3067\u306f\u72ec\u81ea\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5ba3\u8a00\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u6e21\u3057\u305f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u5c5e\u3057\u3066\u3044\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3076\u5834\u5408\u306b\u6bce\u56de\u547c\u3070\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001__call\u306e\u4e2d\u3067\u30a2\u30af\u30bb\u30b9\u5236\u9650\u3092\u5916\u3057\u3066\u304b\u3089\u5bfe\u8c61\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3076\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3046\u3059\u308c\u3070\u5916\u304b\u3089\u306f\u666e\u901a\u306b\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3076\u3060\u3051\u3067\u3001private\u3084protected\u306e\u30a2\u30af\u30bb\u30b9\u5236\u9650\u3092\u7121\u8996\u3057\u3066\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3079\u308b\u3088\u3046\u306b\u306a\u308b\u308f\u3051\u3067\u3059\u3002<span class=\"footnote_referrer\"><a role=\"button\" tabindex=\"0\" onclick=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_5');\" onkeypress=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_5');\" ><sup id=\"footnote_plugin_tooltip_7445_1_5\" class=\"footnote_plugin_tooltip_text\">5)<\/sup><\/a><span id=\"footnote_plugin_tooltip_text_7445_1_5\" class=\"footnote_tooltip\">\u30c1\u30a7\u30c3\u30af\u3059\u308b\u306e\u304c\u9762\u5012\u306a\u306e\u3067public\u306a\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3076\u5834\u5408\u3082\u30a2\u30af\u30bb\u30b9\u5236\u9650\u3092\u5909\u66f4\u3057\u3066\u3044\u307e\u3059\u3002<\/span><\/span><script type=\"text\/javascript\"> jQuery('#footnote_plugin_tooltip_7445_1_5').tooltip({ tip: '#footnote_plugin_tooltip_text_7445_1_5', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top center', relative: true, offset: [10, 10], });<\/script><\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>static\u306a\u30e1\u30bd\u30c3\u30c9\u306f\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3068\u304b\u3067\u306f\u56de\u907f\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u4eca\u56de\u306f\u5bfe\u5fdc\u3092\u898b\u9001\u308a\u307e\u3057\u305f\u3002\u3044\u3044\u65b9\u6cd5\u3042\u308a\u305d\u3046\u306a\u3093\u3067\u3059\u3051\u3069\u306d\u3002<\/p>\n<p>\u3053\u308c\u3092\u4f7f\u3048\u3070private\/protected\u30e1\u30bd\u30c3\u30c9\u306emock\u3082\u4f5c\u308c\u308b\u3088\u3046\u306b\u306a\u308b\u3060\u308d\u3046\u3068\u601d\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u6642\u9593\u3092\u898b\u3064\u3051\u3066\u3084\u3063\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<span class=\"footnote_referrer\"><a role=\"button\" tabindex=\"0\" onclick=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_6');\" onkeypress=\"footnote_moveToReference_7445_1('footnote_plugin_reference_7445_1_6');\" ><sup id=\"footnote_plugin_tooltip_7445_1_6\" class=\"footnote_plugin_tooltip_text\">6)<\/sup><\/a><span id=\"footnote_plugin_tooltip_text_7445_1_6\" class=\"footnote_tooltip\">\u3044\u307e\u306f\u516c\u5f0f\u3067\u7528\u610f\u3057\u3066\u3044\u308b\u65b9\u6cd5\u3067\u306f\u3067\u304d\u306a\u3044\u3093\u3067\u3059\u3088\u306d\u3047\u30fb\u30fb\u30fb<\/span><\/span><script type=\"text\/javascript\"> jQuery('#footnote_plugin_tooltip_7445_1_6').tooltip({ tip: '#footnote_plugin_tooltip_text_7445_1_6', tipClass: 'footnote_tooltip', effect: 'fade', predelay: 0, fadeInSpeed: 200, delay: 400, fadeOutSpeed: 200, position: 'top center', relative: true, offset: [10, 10], });<\/script><\/p>\n<p>\u305d\u308c\u3082\u3046\u307e\u304f\u3044\u3063\u305f\u3089phpunit\u306egithub\u306b\u5165\u308c\u3066\u3082\u3089\u3046\u3088\u3046issue\u5207\u3063\u305f\u308a\u3057\u3066\u52d5\u3044\u3066\u307f\u3088\u3046\u304b\u306a\u3041\u306a\u3093\u3066\u5984\u60f3\u3092\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u306f\u82f1\u8a9e\u3067issue\u66f8\u304f\u306e\u304c\u4e00\u756a\u306e\u30cf\u30fc\u30c9\u30eb\u3067\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u307e\u3067\u8aad\u3093\u3067\u3044\u305f\u3060\u304d\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\u3002<\/p>\n<div class=\"speaker-mute footnotes_reference_container\"> <div class=\"footnote_container_prepare\"><p><span role=\"button\" tabindex=\"0\" class=\"footnote_reference_container_label pointer\" onclick=\"footnote_expand_collapse_reference_container_7445_1();\">\u6ce8\u8a33\u306f\u3053\u3061\u3089<\/span><span role=\"button\" tabindex=\"0\" class=\"footnote_reference_container_collapse_button\" style=\"display: none;\" onclick=\"footnote_expand_collapse_reference_container_7445_1();\">[<a id=\"footnote_reference_container_collapse_button_7445_1\">+<\/a>]<\/span><\/p><\/div> <div id=\"footnote_references_container_7445_1\" style=\"\"><table class=\"footnotes_table footnote-reference-container\"><caption class=\"accessibility\">\u6ce8\u8a33\u306f\u3053\u3061\u3089<\/caption> <tbody> \r\n\r\n<tr class=\"footnotes_plugin_reference_row\"> <th scope=\"row\" class=\"footnote_plugin_index_combi pointer\"  onclick=\"footnote_moveToAnchor_7445_1('footnote_plugin_tooltip_7445_1_1');\"><a id=\"footnote_plugin_reference_7445_1_1\" class=\"footnote_backlink\"><span class=\"footnote_index_arrow\">&#8593;<\/span>1<\/a><\/th> <td class=\"footnote_plugin_text\">\u8f9b\u3044\u3067\u3059\u306d\u3002<\/td><\/tr>\r\n\r\n<tr class=\"footnotes_plugin_reference_row\"> <th scope=\"row\" class=\"footnote_plugin_index_combi pointer\"  onclick=\"footnote_moveToAnchor_7445_1('footnote_plugin_tooltip_7445_1_2');\"><a id=\"footnote_plugin_reference_7445_1_2\" class=\"footnote_backlink\"><span class=\"footnote_index_arrow\">&#8593;<\/span>2<\/a><\/th> <td class=\"footnote_plugin_text\">\u30e1\u30f3\u30d0\u5909\u6570\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3082\u540c\u69d8\u3067\u3059<\/td><\/tr>\r\n\r\n<tr class=\"footnotes_plugin_reference_row\"> <th scope=\"row\" class=\"footnote_plugin_index_combi pointer\"  onclick=\"footnote_moveToAnchor_7445_1('footnote_plugin_tooltip_7445_1_3');\"><a id=\"footnote_plugin_reference_7445_1_3\" class=\"footnote_backlink\"><span class=\"footnote_index_arrow\">&#8593;<\/span>3<\/a><\/th> <td class=\"footnote_plugin_text\">\u500b\u4eba\u7684\u306b\u306fc\u306evoid\u30dd\u30a4\u30f3\u30bf\u304f\u3089\u3044\u30a2\u30a6\u30c8\u30ed\u30fc\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/td><\/tr>\r\n\r\n<tr class=\"footnotes_plugin_reference_row\"> <th scope=\"row\" class=\"footnote_plugin_index_combi pointer\"  onclick=\"footnote_moveToAnchor_7445_1('footnote_plugin_tooltip_7445_1_4');\"><a id=\"footnote_plugin_reference_7445_1_4\" class=\"footnote_backlink\"><span class=\"footnote_index_arrow\">&#8593;<\/span>4<\/a><\/th> <td class=\"footnote_plugin_text\">\u79c1\u306f\u5e78\u904b\u306b\u3082\u4eca\u307e\u3067\u898b\u305f\u3053\u3068\u304c\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f<\/td><\/tr>\r\n\r\n<tr class=\"footnotes_plugin_reference_row\"> <th scope=\"row\" class=\"footnote_plugin_index_combi pointer\"  onclick=\"footnote_moveToAnchor_7445_1('footnote_plugin_tooltip_7445_1_5');\"><a id=\"footnote_plugin_reference_7445_1_5\" class=\"footnote_backlink\"><span class=\"footnote_index_arrow\">&#8593;<\/span>5<\/a><\/th> <td class=\"footnote_plugin_text\">\u30c1\u30a7\u30c3\u30af\u3059\u308b\u306e\u304c\u9762\u5012\u306a\u306e\u3067public\u306a\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3076\u5834\u5408\u3082\u30a2\u30af\u30bb\u30b9\u5236\u9650\u3092\u5909\u66f4\u3057\u3066\u3044\u307e\u3059\u3002<\/td><\/tr>\r\n\r\n<tr class=\"footnotes_plugin_reference_row\"> <th scope=\"row\" class=\"footnote_plugin_index_combi pointer\"  onclick=\"footnote_moveToAnchor_7445_1('footnote_plugin_tooltip_7445_1_6');\"><a id=\"footnote_plugin_reference_7445_1_6\" class=\"footnote_backlink\"><span class=\"footnote_index_arrow\">&#8593;<\/span>6<\/a><\/th> <td class=\"footnote_plugin_text\">\u3044\u307e\u306f\u516c\u5f0f\u3067\u7528\u610f\u3057\u3066\u3044\u308b\u65b9\u6cd5\u3067\u306f\u3067\u304d\u306a\u3044\u3093\u3067\u3059\u3088\u306d\u3047\u30fb\u30fb\u30fb<\/td><\/tr>\r\n\r\n <\/tbody> <\/table> <\/div><\/div><script type=\"text\/javascript\"> function footnote_expand_reference_container_7445_1() { jQuery('#footnote_references_container_7445_1').show(); jQuery('#footnote_reference_container_collapse_button_7445_1').text('\u2212'); } function footnote_collapse_reference_container_7445_1() { jQuery('#footnote_references_container_7445_1').hide(); jQuery('#footnote_reference_container_collapse_button_7445_1').text('+'); } function footnote_expand_collapse_reference_container_7445_1() { if (jQuery('#footnote_references_container_7445_1').is(':hidden')) { footnote_expand_reference_container_7445_1(); } else { footnote_collapse_reference_container_7445_1(); } } function footnote_moveToReference_7445_1(p_str_TargetID) { footnote_expand_reference_container_7445_1(); var l_obj_Target = jQuery('#' + p_str_TargetID); if (l_obj_Target.length) { jQuery( 'html, body' ).delay( 0 ); jQuery('html, body').animate({ scrollTop: l_obj_Target.offset().top - window.innerHeight * 0.2 }, 380); } } function footnote_moveToAnchor_7445_1(p_str_TargetID) { footnote_expand_reference_container_7445_1(); var l_obj_Target = jQuery('#' + p_str_TargetID); if (l_obj_Target.length) { jQuery( 'html, body' ).delay( 0 ); jQuery('html, body').animate({ scrollTop: l_obj_Target.offset().top - window.innerHeight * 0.2 }, 380); } }<\/script>","protected":false},"excerpt":{"rendered":"<p>\u4e45\u3057\u3076\u308a\u306b\u6280\u8853\u30cd\u30bf\u304c\u3067\u304d\u305f\u306e\u3067\u6295\u7a3f\u3057\u307e\u3059\u3002 \u6700\u8fd1\u3001\u793e\u5185\u30b7\u30b9\u30c6\u30e0\u30c1\u30fc\u30e0\u3067\u3082\u300c\u54c1\u8cea\u5411\u4e0a\u306e\u305f\u3081\u306b\u81ea\u52d5\u30c6\u30b9\u30c8\u3092\u5c0e\u5165\u3057\u3066\u3044\u3053\u3046\u305c\u300d\u3068\u3044\u3046\u6d41\u308c\u306b\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u3002 \u305d\u306e\u4e2d\u3067private\u3068protected\u306e\u30e1\u30bd\u30c3\u30c9\u3092public\u306e\u3082 [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":7769,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[13,334,332,333],"class_list":["post-7445","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-php","tag-phpunit","tag-reflectionclass","tag-333"],"jetpack_featured_media_url":"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2018\/05\/phpunit.png","jetpack_shortlink":"https:\/\/wp.me\/p7Bq4F-1W5","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/7445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/comments?post=7445"}],"version-history":[{"count":0,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/7445\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media\/7769"}],"wp:attachment":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media?parent=7445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/categories?post=7445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/tags?post=7445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}