I'm having a problem with Composer in Windows 7.
I developed a project with the following structure:
Simpla_HTML
|--/src
| |--/Simpla
| |--/Html
| |--/Element.php
/---tests
| |--/Simpla
| |--/Html
| |--/ElementTest.php
|----Vendor
|---...
And in Composer.json I set the autoload as follows:
"autoload": {
"psr-4": {
"Simpla\": [
"src/",
"tests/"
]
}
}
My test was defined like this:
<?php
require './vendor/autoload.php';
use PHPUnit_Framework_TestCase as PHPUnit;
use Simpla\Html\Element;
class ElementTest extends PHPUnit{
public function testElementoPai() {
$actual = Element::tag('html');
return $this->assertEquals('<html></html>', $actual->render());
}
}
However, when trying to test my application the following error occurs in the CMD with the vendor \ bin \ phpunit tests command:
Fatal error: Class 'Simpla\Html\Element' not found in C:\EasyPHP\data\localweb\estudo\Simpla\tests\Simpla\Html\ElementTest.php on line 12
PHP Fatal error: Class 'Simpla\Html\Element' not found in C:\EasyPHP\data\localweb\estudo\Simpla\tests\Simpla\Html\ElementTest.php on line 12
But if I change require in my test file ElementTest.php by% with% test normally runs.
Am I doing something wrong in my autoload?