Reputation: 2710
I am preparing php library and decided to reorganize directory structure a bit.
Everything was working and from this structure:
I decided to move into:
I regenerated autoload (php composer.phar dumpautoload), ran tests and got:
PHP Fatal error: Class 'Compa\Components\Finder\Objects' not found in /home/mrok/php/top/pac-b-test/tests/Finder/ObjectsTest.php on line 15
PHP Stack trace:
PHP 1. {main}() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/composer/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/composer/bin/phpunit:65
PHP 3. PHPUnit_TextUI_Command->run() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
PHP 5. PHPUnit_Framework_TestSuite->run() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:346
PHP 6. PHPUnit_Framework_TestSuite->run() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
PHP 7. PHPUnit_Framework_TestSuite->runTest() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
PHP 8. PHPUnit_Framework_TestCase->run() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
PHP 9. PHPUnit_Framework_TestResult->run() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:769
PHP 10. PHPUnit_Framework_TestCase->runBare() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
PHP 11. PHPUnit_Framework_TestCase->runTest() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:824
PHP 12. ReflectionMethod->invokeArgs() /home/mrok/php/top/pac-b-test/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:969
PHP 13. Compa\Components\Test\Finder\ObjectsTest->find() /home/mrok/php/top/pac-b-test/tests/Finder/ObjectsTest.php:0
autload_namespaces contains:
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Component\\Yaml' => $vendorDir . '/symfony/yaml/',
'Compa\\Components' => $baseDir . '/src/',
);
Any idea what could be wrong? Should I change include path? I do not think so, otherwise everyone who use this library will have to do the same.
Upvotes: 0
Views: 669
Reputation: 29462
To make it valid PSR-0, your file should be located in:
src/Compa/Components/Finder/Objects.php
but no idea why it was working with previous structure...
Upvotes: 1