I am running the example from https://docs.phalconphp.com/en/latest/reference/unit-testing.html I did all configuration but I am facing with
C:\xampp\htdocs\myproject>phpunit tests/UnitTest.php
Fatal error: Class 'UnitTestCase' not found in C:\xampp\htdocs\myproject\tests\Unit Test.php on line 16
Line 16 is
class UnitTest extends \UnitTestCase {
You need to run your test inside tests
folder. As mentioned in that tutorial:
This will run any tests under the tests/ directory.
As you can see from PHPunit.xml file
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./TestHelper.php"
backupGlobals="false"
backupStaticAttributes="false"
verbose="true"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="true">
<testsuite name="Phalcon - Testsuite">
<directory>./</directory>
</testsuite>
</phpunit>
Directory is set to current one <directory>./</directory>
So run tests like this:
C:\xampp\htdocs\myproject\tests>phpunit UnitTest.php