0
I’m having a problem with the Composer on 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 defined autoload as follows:
"autoload": {
"psr-4": {
"Simpla\\": [
"src/",
"tests/"
]
}
}
My test was set 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, while trying to test my application occurs the error below in CMD with the command vendor bin phpunit tests:
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 the require in my test file Elementtest.php for
'./src/Simpla/Html/Element.php';
the test wheel normally.
Am I doing something wrong on my autoload?
I had tried this option before and the same mistake continues.
– robertaodj