[英]No tests found in class “AlliancesObjectTest” when PHPUnit testing
I'm keep getting No tests found in class "AlliancesObjectTest".
我一直No tests found in class "AlliancesObjectTest".
I tried it to run on vm and my machine but it doesn't work.我尝试在 vm 和我的机器上运行它,但它不起作用。
This are the contents of tests\\AlliancesObjectTest
这是tests\\AlliancesObjectTest
的内容
<?php
use \phpunit\framework\TestCase;
class AlliancesObjectTest extends TestCase
{
/** @test */
public function testPushAndPop()
{
$stack = [];
$this->assertEquals(0, count($stack));
array_push($stack, 'foo');
$this->assertEquals('foo', $stack[count($stack)-1]);
$this->assertEquals(1, count($stack));
$this->assertEquals('foo', array_pop($stack));
$this->assertEquals(0, count($stack));
}
}
Contents of phpunit.xml
phpunit.xml
内容
<phpunit bootstrap="./tests/phpunit.php">
<testsuite name="unit">
<directory>./tests</directory>
</testsuite>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
contents of tests\\phpunit.php
tests\\phpunit.php
内容tests\\phpunit.php
<?php
require_once __DIR__ . '/../vendor/autoload.php';
Full response in terminal:终端中的完整响应:
vagrant@homestead:~/xxxxxxx$ phpunit -v
PHPUnit 5.4.2 by Sebastian Bergmann and contributors.
Runtime: PHP 7.0.2-4+deb.sury.org~trusty+1 with Xdebug 2.4.0RC3
Configuration: /home/vagrant/xxxxxxx/phpunit.xml
W 1 / 1 (100%)
Time: 225 ms, Memory: 4.00MB
There was 1 warning:
1) Warning
No tests found in class "AlliancesObjectTest".
WARNINGS!
Tests: 1, Assertions: 0, Warnings: 1.
Generating code coverage report in Clover XML format ... done
PHPUnit 5.4.4 版本修复了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.