Answer the question
In order to leave comments, you need to log in
Why doesn't PHP find the class in a separate file?
The Laravel project has a phpunit test that works great.
<?php
class FooBar { }
class ExampleTest extends TestCase {
...
new FooBar();
>ls tests
ExampleTest.php FooBar.php
Answer the question
In order to leave comments, you need to log in
In order for use and namespacY to work, you need to first load the file with the class into the project. It can be done by hand through require / include, or by a semi-automatic composer through its autoload.
Most likely it will be necessary to correctly throw this file into the source folder (src) and do composer dump-autoload . Then check that the compositor loader file is loaded during the phpunit test
Have you tried including the file with the class (include 'FooBar.php')?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question