Certification Starter Package: Is tests_4.7.x_5.x incompatible with OXID 4.9.2?

Hey,

i updated from OXID [B]4.8.7[/B] to [B]4.9.2[/B]. After that, i updated (simply file override) the [B]tests[/B]-folder of my module with the new files from [B]tests_4.7.x_5.x.zip[/B] (Got it from https://www.oxid-esales.com/fileadmin/files/Produkte/Zertifizierung/OXID_Module_Certification_Starter_Package.zip)

But my tests suite does not run anymore and quit with

./runtests.sh
PHP Fatal error:  Call to undefined method oxConfig::getInstance() in /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php on line 585
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:619
PHP   3. PHPUnit_TextUI_Command->run() phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:129
PHP   4. PHPUnit_TextUI_Command->handleArguments() phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:138
PHP   5. PHPUnit_TextUI_Command->handleBootstrap() phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:548
PHP   6. PHPUnit_Util_Fileloader::checkAndLoad() phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:778
PHP   7. PHPUnit_Util_Fileloader::load() phar:///usr/bin/phpunit/phpunit/Util/Fileloader.php:76
PHP   8. include_once() phar:///usr/bin/phpunit/phpunit/Util/Fileloader.php:92
PHP   9. require_once() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/bootstrap.php:18
PHP  10. oxDb::getDb() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_config.inc.php:64
PHP  11. oxDb::getInstance() /home/k00ni/Documents/biz/mzss/core/oxdb.php:457
PHP  12. modInstances::getMod() /home/k00ni/Documents/biz/mzss/core/oxdb.php:221
PHP  13. oxClassCacheKey() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php:831
PHP  14. modConfig::getInstance() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php:72
PHP  15. modConfig->modAttach() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php:571
PHP  16. modOXID->modAttach() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php:554
PHP  17. modConfig->cleanup() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php:432

Fatal error: Call to undefined method oxConfig::getInstance() in /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php on line 585

Call Stack:
    0.0012     170052   1. {main}() /usr/bin/phpunit:0
    0.0393     430652   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:619
    0.0394     430776   3. PHPUnit_TextUI_Command->run() phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:129
    0.0394     430992   4. PHPUnit_TextUI_Command->handleArguments() phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:138
    0.0402     453668   5. PHPUnit_TextUI_Command->handleBootstrap() phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:548
    0.0404     458848   6. PHPUnit_Util_Fileloader::checkAndLoad() phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:778
    0.0404     458992   7. PHPUnit_Util_Fileloader::load() phar:///usr/bin/phpunit/phpunit/Util/Fileloader.php:76
    0.0405     464032   8. include_once('/home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/bootstrap.php') phar:///usr/bin/phpunit/phpunit/Util/Fileloader.php:92
    0.0408     477552   9. require_once('/home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_config.inc.php') /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/bootstrap.php:18
    0.0529    1009792  10. oxDb::getDb() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_config.inc.php:64
    0.0529    1010300  11. oxDb::getInstance() /home/k00ni/Documents/biz/mzss/core/oxdb.php:457
    0.0529    1010408  12. modInstances::getMod() /home/k00ni/Documents/biz/mzss/core/oxdb.php:221
    0.0529    1010476  13. oxClassCacheKey() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php:831
    0.0529    1010588  14. modConfig::getInstance() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php:72
    0.0529    1011008  15. modConfig->modAttach() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php:571
    0.0529    1011084  16. modOXID->modAttach() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php:554
    0.0529    1011100  17. modConfig->cleanup() /home/k00ni/Documents/biz/mzss/modules/inspirito/order/tests/unit/test_utils.php:432

Whats wrong here?

Regards

Hi @k00ni,

I’m not pretty sure where you got the information about the certification package from. All I know about certifications is this page:
http://wiki.oxidforge.org/Certification/Modules

As for the tests, I’d rather go for the tests provided along with the OXID eShop version at GitHub, for example:

And yes, looks like you try to run tests for another shop version. I have to admit that I am really not familiar with tests…

Best!

Hi Marco,

thanks for the reply. Your first link i already know and your second link leads me to the OXID eShop tests itself, for the shop and not for the modules.

The funny thing is, after upgrading the shop to [B]4.9.3[/B] and copy latest tests-files from Certification-package to my modules tests folder to override them, there are fatal errors like posted before.

PHP Fatal error:  Call to undefined method oxConfig::getInstance() in /home/.../modules/inspirito/order/tests/unit/test_utils.php on line 585

Maybe your certification starter package 05 is not compatible with [B]4.9.x[/B]. Can you check that please?

Thanks

This issue was discussed on the developers mailinglist today.

Hey Martin,

thanks for the quick reply.

The developer on the mailing list made this statement:

Current testing library is not working with 5.2 version of the shop, as deprecated methods (getInstance()) was removed from the shop.

After i read that, i tried his version of the new module-test from Github, but had problems all around.

So i switch back and started to replace faulty code. For instance replacing oxSession::getVar() with oxRegistry::getSession->getVariable(). This way i was able to restore my test cases for OXID eShop 4.9.3! :slight_smile:

I added my adapted version of the faulty tests folder from the Certification Starter Package, in case anyone needs it.