-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Symfony version(s) affected: 4.2.4
Description
I implemented a TestSuite based on this documentation with PHPUnit bridge on 4.2.4
https://symfony.com/doc/current/components/phpunit_bridge.html
But I tried to organize my tests class with some folders and abstract parent class
How to reproduce
Create a "tests" folder, with inside it a new "tools" folder.
Inside the "tests" folder create a class like this :
namespace App\Tests;
use App\Tests\Tools\PHPUnitFrameworkTestCaseTools;
class FormProductBusinessTestTools extends PHPUnitFrameworkTestCaseTools
{
........
Inside the "tools" folder create a class like this :
namespace App\Tests\Tools;
abstract class PHPUnitFrameworkTestCaseTools extends TypeTestCase
{
........
Possible Solution
Solution i found for the moment is to add extra bootstrap to include this tools class :
function testLoader($class_name) {
if(strpos($class_name, 'Tests\Tools') !== FALSE) {
require_once('tools/'.getName($class_name).'.php');
}
}
Additional context
stan@SERVER:/var/www/html/project_test$ php bin/phpunit
#!/usr/bin/env php
PHP Fatal error: Uncaught Error: Class 'App\Tests\Tools\PHPUnitFrameworkTestCaseTools' not found in /var/www/html/project_test/tests/FormProductTest.php:16
Stack trace:
#0 /var/www/html/clavat/project_test/bin/.phpunit/phpunit-6.5/src/Util/Fileloader.php(64): include_once()
#1 /var/www/html/project_test/bin/.phpunit/phpunit-6.5/src/Util/Fileloader.php(48): PHPUnit\Util\Fileloader::load('/var/www/html/c...')
#2 /var/www/html/project_test/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php(325): PHPUnit\Util\Fileloader::checkAndLoad('/var/www/html/c...')
#3 /var/www/html/project_test/bin/.phpunit/phpunit-6.5/src/Framework/TestSuite.php(403): PHPUnit\Framework\TestSuite->addTestFile('/var/www/html/c...')
#4 /var/www/html/project_test/bin/.phpunit/phpunit-6.5/src/Util/Configuration.php(1014): PHPUnit\Framework\TestSuite->addTestFiles(Array)
#5 /var/www/html/project_test/bin/.phpunit/phpunit-6.5/src/Util/Configuration.php(910): PHPUnit\Util\Configuration->getTe in /var/www/html/project_test/tests/FormProductTest.php on line 16
Metadata
Metadata
Assignees
Labels
No labels