stuartherbert / sublime-phpunit

PHPUnit Support for Sublime Text 2
https://github.com/stuartherbert/sublime-phpunit
Other
103 stars 20 forks source link

Unable to Find Namespace Class #45

Closed kublaios closed 9 years ago

kublaios commented 10 years ago

Hi all,

I'm following this tutorial to get the PHPUnit running: https://jtreminio.com/2013/03/unit-testing-tutorial-part-2-assertions-writing-a-useful-test-and-dataprovider/

For a simple start, I've declared just a class and its tester. As it was told in the tutorial (part 1), I have installed PHPUnit via Composer. My tests work just fine when I use the PHPUnit like:

$ ./vendor/bin/phpunit

However, when I try to run tests from Sublime Text 3 command palette or like $ phpunit, I get the following error:

Fatal error: Class 'MyNamespace\MyClass' not found in /Users/k/Sites/Project/MyNamespace/Test/MyClassTest.php on line 14

No errors when I include the class file with require_once.

Global instance of PHPUnit is under /usr/local/bin. Is there a way to force the plugin to use phpunit command from the project root, like /vendor/bin/phpunit?

stuartherbert commented 9 years ago

Hi,

I've just added support for this. The plugin will now look for vendor/bin/phpunit, and use that if it is present.

I've also just fixed a bug where the plugin could end up using the wrong phpunit.xml[.dist] file. Chances are that this bug was causing your problem.

Can you let me know if you still have problems after updating, please?

Best regards, Stu