PHPUnit cannot open file

I began to learn how to use PHPUnit. However, I ran into a problem that I don’t know how to solve.

I have a folder with a name lessonsand inside there is composer.jsonone with which I installed PHPUnit. The output was a folder with a name vendorand a subfolder with a name binin which there is a phpunit file.

As cmdI typed: cd c:/xampp/htdocs/lessons/vendor/bin. Now the cmd folder is installed in the same folder as phpunit. I created a directory in lessonswhich I called tests( lessons/tests), which stores all my tests. I created a file with a name PracticeTest.phpwith a very simple test script in it,

When I get back to cmdand dial phpunit tests, I get cannot open file tests.php. When I try to enter phpunit PracticeTest, I get cannot open file PracticeTest.php. When I try phpunit tests/PracticeTest(with .phpor without), I get the same error that the file cannot be opened.

My suspicion is that this has something to do with the person who cmdpoints to the directory lessons/vendor/bin, but I'm not sure if this is really a problem or how to fix it.

to arrange the paths:

  • lessons\vendor\bin\
  • lessons\tests\
  • lessons\tests\PracticeTest.php

Thanks in advance!

+4
source share
2 answers

Go to the project path:

D:\>cd www
D:\wwww>cd lessons

And do:

D:\www\lessons>vendor\bin\phpunit tests

PHPUnit 4.8.27 by Sebastian Bergmann and contributors.
.....E.
Time: 1.34 seconds, Memory: 5.50MB
There was 1 error:
1) UserTest::it_should_be_able_to_construct
PHPUnit_Framework_Exception: Argument #1 (No Value) of PHPUnit_Framework_Assert
:assertInstanceOf() must be a class or interface name
D:\www\lessons\tests\UserTest.php:10
FAILURES!
Tests: 7, Assertions: 4, Errors: 1.

It works!!!!

+1
source

I had sections include_pathseparated by commas. It must be a semicolon in Windows.

0
source

All Articles