Answer the question
In order to leave comments, you need to log in
Phpunit not finding class from neighbor project?
Hello everyone, please tell me about the class loading
setting
.
namespace Helper;
class Crypt
{
}
"autoload": {
"psr-4": {
"Helper\\": "library/Helper/"
}
}
<?php
use Helper\Crypt;
use PHPUnit\Framework\TestCase;
class CryptTest extends TestCase
{
public function testSuccess(): void
{
$res = Crypt::get()->crypt(42144);
var_dump($res);
}
}
{
"autoload": {
"psr-4": {
"Helper\\": "../../library/Helper/"
}
},
"require-dev": {
"phpunit/phpunit": "^9.5"
}
}
<phpunit bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
stopOnFailure="false">
<testsuites>
<testsuite name="Tests">
<directory>test</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">app</directory>
</whitelist>
</filter>
</phpunit>
Answer the question
In order to leave comments, you need to log in
Hmm, I don't know why, but the answer was deleted or deleted itself. Daria Motorina what kind of magic?
Basically, you're on the wrong path. You must specify the full path from the root, not relative.
"autoload": {
"psr-4": {
"Spaceatmoon\\": "src/",
"Mue\\": "src/hue/mue"
}
},
php composer.phar dump-autoload
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question