Reputation: 381
I am running the example from the documentation: http://docs.phalconphp.com/en/latest/reference/unit-testing.html#sample-unit-test
I want to create an abstract unit test from Phalcon\Test\UnitTestCase as in the documentation. However when I run my test I become:
PHP Fatal error: Class 'Phalcon\Test\UnitTestCase' not found
I have followed the exact documentation steps. Did anyone have the same problem and solved it?
Upvotes: 11
Views: 5114
Reputation: 1112
I figure it out.
Basically we have to do 2 things.
is whats in the @twistedxtra's answer. (setting up the path to where the incubator is)
in the testsTestUnitTest.php
we created, it has the following line
class UnitTest extends \UnitTestCase {
we have to change that line to
class UnitTest extends \Phalcon\Test\UnitTestCase {
What we did was set the proper namespace so that the code knows where the UnitTestCase
class is.
Thats it. Cheers...!!!
Upvotes: 3
Reputation: 56
Make sure you run phpunit command in tests folder. It's very important.
Don't run something like phpunit tests/
Upvotes: 1
Reputation: 2699
This class is part of the incubator: https://github.com/phalcon/incubator
$loader = new Phalcon\Loader();
$loader->registerNamespaces(array(
'Phalcon' => '/path/to/incubator/Library/Phalcon/'
));
$loader->register();
Upvotes: 14