while running the phpunit project am getting error like "cannot open file src/autoload.php".

i tried with this reference https://phpunit.de/getting-started.html. In cmd i used the below command line

phpunit --bootstrap src/autoload.php tests/MoneyTest

please anyone help me to solve this issue.

Recommended Answers

All 4 Replies

Well first thing that comes to mind: did you check if src/autoload.php points at something that exists from the directory you're in? :p And do you have permission to read it?

Yes its is in the folder itself. And i have one doubt where we will mention the project folder path.It means inside the "C:\wamp\www\SebastianBergmann" path "src/autoload.php" i mentioned.

but in console we are directly calling "src/autoload.php" file how?

Ok because I do not fully understand from which directory you are calling your scripts, let's make clear we're on the same line here :).

So let's say you have directory C:\wamp\www\x. In x, you have src\autoload.php, i.e. C:\wamp\www\x\src\autoload.php. So when you are now inside directory x in your terminal, calling phpunit --bootstrap src/autoload.php tests/MoneyTest directs to folder src in your current folder, and to autoload.php in the src folder. Is this what you are trying, and is this where you are getting your "autoload.php cannot be opened" message?

Problem solved. i was getting error in command prompt. so i gave full path C:\wamp\www\SebastianBergmann\src\autoload.php instead of src/autoload.php
Thank you minitauros for your valuable time..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.