title: PHPUnit's code coverage does not cover executed method
body: <p>I apologize in advance for the possibly wrong use of terminology.</p>
  
  <p>I'm currently experimenting with unit tests in order to apply them to my work, but now I've encountered a problem, if it is one at all.</p>
  
  <p>In the object to be tested a method is executed which is not marked as tested by the code coverage although it is executed and the test passed successfully.</p>
  
  <p>I've already tried whether it may be due to the visibility of the methods (it's protected) or the callback passed as a parameter which may cause this "error" by changing the visibility as well as the parameters, but this doesn't seem to be the cause.</p>
  
  <p>I use the following setup</p>
  
  <ul>
  <li>php-code-coverage <b>6.1.4</b></li>
  <li>PHP <b>7.1.10</b></li>
  <li>Xdebug <b>2.6.1</b></li>
  <li>PHPUnit <b>7.5.7</b></li>
  </ul>
  
  <hr>
  
  <p>The following code section calls the extend method and passes an anonymous function.</p>
  
  <pre class="lang-php prettyprint-override"><code>$this-&gt;values[$key] = $this-&gt;extend($key, function ($previous, ContainerInterface $container) use ($extensionFactory) {
      return call_user_func($extensionFactory, $container, $previous);
  });
  </code></pre>
  
  <p>And this is the test in which the mentioned methods are executed</p>
  
  <pre class="lang-php prettyprint-override"><code>public function testContainerRegistersExtensions()
  {
      /** mocking provider... */
  
      $this-&gt;assertEquals(['foo', 'bar'], (new Container([$provider]))-&gt;get('value'));
  }
  </code></pre>
  
  <p><br>
  <s>As you can see</s> in the following <s>pictures</s> code snippets (my reputation doesn't allow the use of images), the code is marked as covered (green), but the method extend is not (red), although it is executed during the test:</p>
  
  <pre class="lang-php prettyprint-override"><code>$this-&gt;values[$key] = $this-&gt;extend($key, function ($previous, ContainerInterface $container) use ($extensionFactory) {
      return call_user_func($extensionFactory, $container, $previous);
  });
  </code></pre>
  
  <pre class="lang-php prettyprint-override"><code>protected function extend($id, $callable)
  {  
      $factory = $this-&gt;values[$id];
  
      $extended = function (ContainerInterface $container) use ($callable, $factory) {
      # if the entry to extend is not a callable, we pass it as is
      $previous = is_callable($factory) ? $factory($container) : $factory;
          return $callable($previous, $container);
      };
  
      $this-&gt;values[$id] = $extended;
  
      return $this-&gt;values[$id];
  }
  </code></pre>
  
  <p><hr>
  The result after performing the tests is as follows</p>
  
  <pre><code>PHPUnit 7.5.7 by Sebastian Bergmann and contributors.
  
  
  Time: 260 ms, Memory: 6.00 MB
  
  OK (11 tests, 12 assertions)
  
  Generating code coverage report in HTML format ... done
  </code></pre>
  
  <p>Now I'm wondering if I may have forgotten something or done something wrong, or if this might be a bug?</p>