0
我得到這個警告,當我在命令行中運行的PHPUnit:PHPUnit的6.4.1沒有測試執行
PHPUnit 5.1.3 by Sebastian Bergmann and contributors.
Time: 114 ms, Memory: 4.00MB
No tests executed!
這裏是我的框架文件夾結構:
.
├── App
├── CHANGELOG
├── composer.json
├── composer.lock
├── Config
├── Database
├── local.env.php
├── phpunit.xml
├── public
├── README.md
├── robot.txt
├── silver
├── Storage
├── System
├── Tests
└── vendor
測試目錄:
Tests
└── Unit
└── ControllerTest.php
phpunit.xml:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./Tests/Unit</directory>
</testsuite>
</testsuites>
</phpunit>
composer.json文件:
"autoload-dev": {
"psr-4": {
"Tests\\": "Tests/"
}
}
controllerTest類:
<?php
namespace Tests\Unit;
use \PHPUnit\Framework\TestCase;
class ControllerTest extends TestCase
{
/** @test */
public function testFirstMethod()
{
$num = 20;
$this->assertEquals(22, $num);
}
}
任何建議或幫助將是非常讚賞的感謝。
它肯定適合我。我使用phpunit 5.5.7。 – akond
標題說PHPUnit的'6.4.1'和你的命令行說'5.1.3'?!? – bish
@bish是啊你是正確的供應商版本是6.4.1,而phpunit CLI版本是5.1.3我不知道這些應該是相同的,因爲在Linux上當你apt-get安裝phpunit你默認得到5.1.3! –