Roger
Roger

Reputation: 101

PHPUnit 5.2.12 Testcase not found and PHPUnit 5.5.4 does

Before writing this I search for this topic with no results about my specific question.

I recently starting using PHPunit. My IDE (PHPED from Nusphere) only supports Phpunit up to version 5.2.12. Something is not working fine because from command line the PHPunit reports an error:

Fatal error: Class 'PHPUNIT\Framework\TestCase' not found in C:\Users\myuser\myproject\testunit\ConfigTest_stackoverflow.php on line 7

The same test with version 5.5.4 works fine. for debuging purpose I use a minimal code (no autoload, no dependences with other files, etc.) I try it with autoload, of course and with version 5.5.4 works fine. the code is the following:

use PHPUNIT\Framework\TestCase;


class StackTest extends testcase
{ 
    public function testMod0001T00010_Createconfigfiles() 
    {
       //Here my tests
    }
} 
**For PHPunit 5.5.4 this is the output
PHPUnit 5.5.4 by Sebastian Bergmann and contributors.
.                                                                   1 / 1 (100%)
Time: 491 ms, Memory: 15.25MB
OK (1 test, 0 assertions)**

Which is the expected.

so, I guess the class definition for test is different for each version of PHPUnit. At the end I can use command line but it is more confortable use it via IDE.

thank you.

Upvotes: 0

Views: 65

Answers (1)

Shivam Mathur
Shivam Mathur

Reputation: 2703

This should work.

use PHPUnit\Framework\TestCase;


class StackTest extends PHPUNIT_Framework_TestCase
{ 
    public function testMod0001T00010_Createconfigfiles() 
    {
       //Here my tests
    }
} 

Upvotes: 0

Related Questions