PHPUnit test files are createed near the source files instead of the test folder

Good day. Seems I have the same problem but that post was written 7 years ago. May be I am doing something wrong.

I have PhpStorm 2019.2 & Win7. In the settings I chose "tests" folder as tests:

But where I try to create test file default directory is the directory of source file: ...\project\app\Helpers\Json

If I mark unit directory as test

the test directory is ok: ...\project\tests\unit\App\Helpers\Json

(why App and not app?)

But after IDE restart the test directory setting reset back to first screenshot, and default test files folded is ...\project\app\Helpers\Json again...

Why? It's a IDE bug or it's my bug?

0

Why? It's a IDE bug or it's my bug?

Probably, your settings are being synced with composer.json.
One way to solve it would be updating composer.json to the actual state,
another - to disable sync at Settings | Languages & Frameworks | PHP | Composer | Synchronize IDE settings with composer.json.

0

composer.json (was)

 "autoload-dev": {
"psr-4": {
"Tests\\": "tests/",
}
}

I added a line

 "autoload-dev": {
"psr-4": {
"Tests\\": "tests/",
"Tests\\Unit\\": "tests/unit"
}
}

after that the "unit" folder become green

but nothing changes. The test files path is still near the source. If uncheck synced with composer.json, the problem goes away, but I would not want to do that. Is there any other solution? Why it happens?

0

https://youtrack.jetbrains.com/issue/WI-38128 I guess -- IDE still does not take it into a consideration.

0

请先登录再写评论。