I created a suite of php scripts, which perform a number of 'Memcached' operations, and I have written phpunit tests for this suite. The name of the test suite is Memcached
, and the phpunit.xml.dist
file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
<testsuites>
<testsuite name="Memcached">
<directory>./test</directory>
</testsuite>
</testsuites>
</phpunit>
However, when I run this test suite with the --testsuite=Memcached
flag, I receive the following error:
PHP Fatal error: Uncaught PHPUnit\Framework\Exception: Class "Memcached" does not extend PHPUnit\Framework\TestCase.
The error presumably occurs because php already has a class called Memcached
.
If I rename the testsuite to MemcachedTest
in the XML file, and run the tests with the --testsuite=MemcachedTest
flag, the unit tests run and complete with zero errors.
I would rather name the test suite Memcached
, as this would match the formatting of our other test suites.
Can test suites for 'phpunit' be named the same as an existing class?
Test
appended. For example:MemcachedTest
,ParserTest
, and so on. Even without any unit tests in the suite, the suite still fails due to the suite being namedMemcached
. – Leo Galleguillos