[dev] Autoloading problems when running tests inside horde git tree

Luis Felipe Marzagao lfbm.andamentos at gmail.com
Wed May 13 20:40:12 UTC 2015



On 13-05-2015 04:27, Jan Schneider wrote:
>
> Zitat von Luis Felipe Marzagao <lfbm.andamentos at gmail.com>:
>
>> Hello:
>>
>> I cannot run framework packages tests under a cloned horde git tree.
>>
>> This install is web-accessible under /var/www/html/horde and is working.
>>
>> I do not have any pear horde package installed globally, except 
>> horde_role.
>>
>> All the framework packages live inside the cloned horde git tree and 
>> are linked to /var/www/html/horde/libs via install_dev script.
>>
>> If I try to run the tests I get, for example:
>>
>> duli at i5:~/NetBeansProjects/horde/framework/Rdo/test/Horde/Rdo$ 
>> phpunit AllTests.php
>>
>> PHP Warning:  require_once(Horde/Test/Bootstrap.php): failed to open 
>> stream: No such file or directory in 
>> /home/duli/NetBeansProjects/horde/framework/Rdo/test/Horde/Rdo/bootstrap.php 
>> on line 2
>> PHP Stack trace:
>> PHP   1. {main}() /usr/bin/phpunit:0
>> PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
>> PHP   3. PHPUnit_TextUI_Command->run() 
>> /usr/share/php/PHPUnit/TextUI/Command.php:129
>> PHP   4. PHPUnit_TextUI_Command->handleArguments() 
>> /usr/share/php/PHPUnit/TextUI/Command.php:138
>> PHP   5. PHPUnit_TextUI_Command->handleBootstrap() 
>> /usr/share/php/PHPUnit/TextUI/Command.php:606
>> PHP   6. PHPUnit_Util_Fileloader::checkAndLoad() 
>> /usr/share/php/PHPUnit/TextUI/Command.php:778
>> PHP   7. PHPUnit_Util_Fileloader::load() 
>> /usr/share/php/PHPUnit/Util/Fileloader.php:76
>> PHP   8. include_once() /usr/share/php/PHPUnit/Util/Fileloader.php:92
>> PHP Fatal error:  require_once(): Failed opening required 
>> 'Horde/Test/Bootstrap.php' 
>> (include_path='.:/usr/share/php:/usr/share/pear') in 
>> /home/duli/NetBeansProjects/horde/framework/Rdo/test/Horde/Rdo/bootstrap.php 
>> on line 2
>> PHP Stack trace:
>> PHP   1. {main}() /usr/bin/phpunit:0
>> PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
>> PHP   3. PHPUnit_TextUI_Command->run() 
>> /usr/share/php/PHPUnit/TextUI/Command.php:129
>> PHP   4. PHPUnit_TextUI_Command->handleArguments() 
>> /usr/share/php/PHPUnit/TextUI/Command.php:138
>> PHP   5. PHPUnit_TextUI_Command->handleBootstrap() 
>> /usr/share/php/PHPUnit/TextUI/Command.php:606
>> PHP   6. PHPUnit_Util_Fileloader::checkAndLoad() 
>> /usr/share/php/PHPUnit/TextUI/Command.php:778
>> PHP   7. PHPUnit_Util_Fileloader::load() 
>> /usr/share/php/PHPUnit/Util/Fileloader.php:76
>> PHP   8. include_once() /usr/share/php/PHPUnit/Util/Fileloader.php:92
>>
>>
>> Then if I add /var/www/html/horde/libs to /etc/php5/cli/php.ini 
>> include_path, the tests begin, but then I experiment some autoloading 
>> problem, because it can't find the test classes:
>>
>> duli at i5:~/NetBeansProjects/horde/framework/Rdo/test/Horde/Rdo$ 
>> phpunit AllTests.php
>> PHPUnit 3.7.28 by Sebastian Bergmann.
>>
>> SSSSSSSSSSSSSSSSSSSSSSSSSS
>>
>> Time: 39 ms, Memory: 4.50Mb
>>
>> OK, but incomplete or skipped tests!
>> Tests: 26, Assertions: 0, Skipped: 26.
>> PHPUnit 3.7.28 by Sebastian Bergmann.
>>
>> Class 'Horde_Rdo_Sql_Pdo_SqliteTest' could not be found in 
>> '/home/duli/NetBeansProjects/horde/framework/Rdo/test/Horde/Rdo/AllTests.php'.
>>
>>
>> What am I doing wrong? Any pointers would help.
>>
>> Thanks.
>>
>> -- 
>> dev mailing list
>> Frequently Asked Questions: http://wiki.horde.org/FAQ
>> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>
> Try either
>
> php AllTests.php
>
> or
>
> phpunit SingleTest.php
>

It was late in the night and I didn't catch the subtle difference, which 
by the way is duly noted in the wiki.

I've added a warning in the wiki to prevent others from making the same 
mistake.

http://wiki.horde.org/Doc/Dev/Test#toc9

Thanks a lot.


More information about the dev mailing list