Exception or error:
I have file tests/Feature/InvoicePaymentTest.php, he contains are three tests. First and second are tests is executed correctly. Third test has return “No tests executed!”, and not return error.
My code scheme
<?php
namespace Tests\Feature;
// use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class SubscriptionInvoicePaymentTest extends TestCase
{
public function testFirst()
{
// this test correctly exeqted
}
public function testSecond()
{
// this test correctly exeqted
}
public function nextPaymentTest()
{
// this test return "No tests executed!" as seen in the screenshot
}
}
My 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>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="BROADCAST_DRIVER" value="fake"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="MAIL_DRIVER" value="array"/>
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_DATABASE" value="dbName"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>
What could be the problem? Thank you in advance
How to solve:
In phpunit a method should be either prefixed with test
or have the @test
annotation in order to be run.