title: PHPUnit Plugin in Netbeans 8.2 gives Fatal error: Class 'PHPUnit_Framework_TestSuite' not found when trying to run a test case
body: <p>When I try to run PHPUnit in Netbeans I face this error: </p>
  
  <pre><code>Fatal error: Class 'PHPUnit_Framework_TestSuite' not found in C:\Users\julian\AppData\Roaming\NetBeans\8.2\phpunit\NetBeansSuite.php on line 63
  Done.
  </code></pre>
  
  <p>This happens both in Netbeans and CLI. </p>
  
  <hr>
  
  <p>I started debugging this problem by navigating to this directory:  <code>C:\Users\julian\AppData\Roaming\NetBeans\8.2\phpunit\</code>. </p>
  
  <p>That directory contained one file: <code>NetBeansSuite.php</code>. I opened it to look for clues, and saw this line: </p>
  
  <pre><code>class NetBeansSuite extends PHPUnit_Framework_TestSuite {
  </code></pre>
  
  <p>What I didn't see is any concrete <code>PHPUnit_Framework_TestSuite</code> class. </p>
  
  <p>What's next is that the <code>NetBeansSuite.php</code> file doesn't have any <code>include</code> or <code>require</code> language constructs that may include the <code>PHPUnit_Framework_TestSuite</code> class. </p>
  
  <p>So, in order to fix the fatal error problem I should include the <code>PHPUnit_Framework_TestSuite</code> in <code>NetbeansSuite.php</code>.</p>
  
  <p>This is a problem because I'm not the author of <code>NetbeansSuite.php</code>.
  On top of that the author of <code>NetbeansSuite.php</code> wrote this in the comment section: </p>
  
  <pre><code> &lt;b&gt;WARNING: User changes to this file should be avoided.&lt;/b&gt;
  </code></pre>
  
  <hr>
  
  <p>I read further in the comments: </p>
  
  <pre><code> * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
  </code></pre>
  
  <p>I guess the <code>NetbeansSuite.php</code> file is outdated. </p>
  
  <hr>
  
  <p>Searching on the net brought me to this stackoverflow question: </p>
  
  <p><a href="https://stackoverflow.com/questions/6065730/why-fatal-error-class-phpunit-framework-testcase-not-found-in">Why, Fatal error: Class &#39;PHPUnit_Framework_TestCase&#39; not found in ...?</a></p>
  
  <p>They claim that using a namespaced version of PHPUnit_Framework_TestCase should fix the problem. So I did what they wrote. </p>
  
  <p>I stubbornly changed <code>NetBeansSuite.php</code>. 
  Old code: </p>
  
  <pre><code>class NetBeansSuite extends PHPUnit_Framework_TestSuite {
  </code></pre>
  
  <p>New code: </p>
  
  <pre><code>require_once 'PHPUnit/Autoload.php';
  
  use PHPUnit\Framework\TestCase;
  
  class NetBeansSuite extends TestCase {
  </code></pre>
  
  <p>I tried to run the test case again, and this was the unfortunately result:</p>
  
  <pre><code>Fatal error: Declaration of CalculatorTest::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp(): void in C:\wamp64\www\test\CalculatorTest.php on line 97
  </code></pre>
  
  <p>In other words, it gave me a new problem. </p>
  
  <p>My system: </p>
  
  <pre><code>Windows 10
  WAMP
  php 7.2.14
  PHPUnit 8.0.6
  Netbeans version 8.2 (Netbeans PHPUnit plugin installed through Tools &gt; Plugins. Version: 0.26.2)
  </code></pre>
  
  <hr>
  
  <p>My question is: does anybody know how the NetBeansSuite.php file should be like with the system described above? </p>
  
  <p><hr> 
  The setUp method in my test case: </p>
  
  <pre><code>protected function setUp()
  {
      $this-&gt;object = new Calculator;
  }
  </code></pre>
  
  <p><hr> 
  Update: The Skeleton Generator project is abandoned. 
  See link: <a href="https://github.com/sebastianbergmann/phpunit-skeleton-generator" rel="nofollow noreferrer">https://github.com/sebastianbergmann/phpunit-skeleton-generator</a>
  So in order to fix the <code>Declaration of CalculatorTest::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp()</code> error the corresponding return type declaration should be used in the test case. </p>
  
  <pre><code>// I added : void
  protected function setUp(): void
  {
      $this-&gt;object = new Calculator;
  }
  
  // : void needs to be added in the tearDown method as well
  protected function tearDown(): void
  </code></pre>
  
  <p>Unfortunately, this gave me new problems: </p>
  
  <pre><code>Warning: require_once(PHPUnit/Autoload.php): failed to open stream: No such file or directory in C:\wamp64\www\test\CalculatorTest.php on line 4
  
  Fatal error: require_once(): Failed opening required 'PHPUnit/Autoload.php' (include_path='.;C:\php\pear') in C:\wamp64\www\test\CalculatorTest.php on line 4
  </code></pre>
  
  <p>I solved this by manually installing PEAR and creating a new "PHPUnit" directory in <code>C:\php\PEAR</code>. Then I created a new <code>Autoload.php</code> file. I filled the content of <code>Autoload.php</code> with a <code>PSR-4</code> example file found at: <a href="https://www.php-fig.org/psr/psr-4/" rel="nofollow noreferrer">https://www.php-fig.org/psr/psr-4/</a>. </p>
  
  <p>This solved the Autoload problem, but I faced a new problem during the execution of a test case. </p>
  
  <pre><code>C:\wamp64\www\test&gt;phpunit CalculatorTest.php
  PHPUnit 8.0.6 by Sebastian Bergmann and contributors.
  
  
  
  Time: 170 ms, Memory: 10.00 MB
  
  No tests executed!
  </code></pre>
  
  <p>It shows <code>No tests executed!</code> but I have 5 tests. 
  I'll make a new question for this. 
  Here it is: <a href="https://stackoverflow.com/questions/55401857/phpunit-8-installed-on-windows-through-phar-shows-no-tests-are-executed/55402107#55402107">PHPUnit 8 installed on Windows through PHAR shows No tests are executed</a></p>