Reputation: 1936
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.
Upvotes: 0
Views: 893
Reputation: 8326
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
.
Upvotes: 3