【发布时间】:2018-07-29 00:44:46
【问题描述】:
我有
错误:找不到类“app\Main”
我不知道怎么解决?
我使用 PHPSTORM 和 phpunit 最新版本。
Main.php
<?php
namespace app;
class Main
{
public function Calc()
{
return 1;
}
}
MainTest.php
<?php
namespace app;
use PHPUnit\Framework\TestCase;
class MainTest extends TestCase
{
public function testCalc()
{
$a = new Main();
}
}
phpunit.xml:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit verbose="true">
<testsuites>
<testsuite name="My Test Suite">
<directory suffix="Test.php" phpVersion="5.3.0" phpVersionOperator=">=">tests</directory>
<!-- <file phpVersion="5.3.0" phpVersionOperator=">=">/path/to/MyTest.php</file>-->
</testsuite>
</testsuites>
</phpunit>
composer.json
{
"autoload": {
"classmap": [
"src/"
]
},
"require": {
"phpunit/phpunit": "7.0.1"
}
}
【问题讨论】:
标签: php namespaces phpunit