简体   繁体   中英

PHPUnit 6.4.1 no tests executed

I am getting this warning when i run phpunit on command line :

PHPUnit 5.1.3 by Sebastian Bergmann and contributors.

Time: 114 ms, Memory: 4.00MB

No tests executed!

here is my framework folders structure :

.
├── App
├── CHANGELOG
├── composer.json
├── composer.lock
├── Config
├── Database
├── local.env.php
├── phpunit.xml
├── public
├── README.md
├── robot.txt
├── silver
├── Storage
├── System
├── Tests
└── vendor

Test directory :

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 file :

"autoload-dev": {
    "psr-4": {
        "Tests\\": "Tests/"
    }
}

controllerTest class :

<?php

namespace Tests\Unit;

use \PHPUnit\Framework\TestCase;


class ControllerTest extends TestCase
{
    /** @test  */
    public function testFirstMethod()
    {
        $num = 20;

        $this->assertEquals(22, $num);
    }
}

Any suggestions or help would be very appreciated thanks.

It appears that you have different installations of PHPUnit mixed up.

For instance, you may have used Composer to install PHPUnit and have configured the autoloader generated by Composer as PHPUnit's bootstrap script but then you invoke PHPUnit using an executable other than vendor/bin/phpunit .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM