I also found this: Running tests using OXID testing library | PHP For Us - here is written that I need to install my testing library in /source directory of my OXID instance.
I have also fresh install of OXID Eshop 6.1.1 EE.
â[Exception]
Shop directory structure is not setup properly. Edition could not be detectedâ
So now if I try to run eg. (from source dir) command: ./vendor/bin/runtests I also get an error:
PHP Fatal error: Uncaught Exception: Shop directory structure is not setup properly. Edition could not be detected in /var/www/oxideshop/source/vendor/oxid-esales/oxideshop-facts/src/Edition/EditionSelector.php:139
I have all those needed files in /source/vendor/⊠but I get an errorâŠ
Can someone help me with test library configuration, please?
The tutorial you found uses OXID 4.8.5, which does not use composer itself, that is why testing library is installed in source dir. In Oxid 6.1.1 testing library is in require-dev, it is installed by default if you run âcomposer updateâ in project directory (the root directory which contains source and vendor). Here is a basic tutorial: https://oxidforge.org/en/run-module-tests-in-oxid-eshop-6.html
But when I run the tests command: vendor/bin/runtests the tests for module of course runs
but after my tests - there is running the shop tests and it takes very much time!
I disabled the shop_test: false in my test_config.yml fileâŠ
Maybe someone know what is happend with this situation?
I have one more question with workflow with this tests library⊠When I do this tests my database was removed, so for restore I need to do vendor/bin/reset-shop.
When I want to do the tests on my development machine I donât want to delete all information from databaseâŠ
I try to set install_shop to false, but it did not help.
I saw that I can specify other database to run tests but I also create this databse and set the test_database_name to db_tests (which I created before on the same server and for the same user). Now I reset the shop and again run tests. And I get errors like:
Failed to install shop with message: PDO error code: 42S22 in function query â Unknown column âoxserialâ in âfield listâ â update oxshops set oxserial = â⊠serial here âŠâ
Maybe you will bring me closer to workflow with this testing library?
A lot of thanks to you for your previous help!
===== EDIT
Ok I change: database_restoration_class: LocalDatabaseRestorer
and: restore_shop_after_tests_suite: true
And I think the database was restored to previous state after testsâŠ
But still I am interesting with your workflow with testing library
Now I have other problem - after installation (new VM and new, clear project) when I run ./vendor/bin/reset-shop and then ./vendor/bin/runtests the output which I get it is a bash script from file runtests:
#!/usr/bin/env sh
dir=$(cd â${0%[/\]*}â > /dev/null; cd ââŠ/oxid-esales/testing-library/binâ && pwd)
if [ -d /proc/cygdrive ] && [[ $(which php) == $(readlink -n /proc/cygdrive)/* ]]; then
# We are in Cgywin using Windows php, so the path must be translated
dir=$(cygpath -m â$dirâ);
fi
â${dir}/runtestsâ â$@â
It looks like the passthru() inside runSuite() inside the runtests file function returns this output, but I donât know whyâŠ
I try to debug something, and the parameters which are passed to passthru():
Sorry, the output which I get after running ./vendor/bin/reset-shop and then ./vendor/bin/runtests :
â${dir}/phpunitâ â$@â
dir=$(cd â${0%[/\]*}â > /dev/null; cd ââŠ/phpunit/phpunitâ && pwd)
if [ -d /proc/cygdrive ] && [[ $(which php) == $(readlink -n /proc/cygdrive)/* ]]; then #We are in Cgywin using Windows php, so the path must be translated
dir=$(cygpath -m â$dirâ);
fi
This condition do something wrong, because when I change âphpâ to empty string the tests running correctâŠ
I can only guess that is something wrong with variable PHPBINâŠ
This variable doesnât exist, so always scripts are running as PHP⊠sometimes the scripts should run as normal bash script without âphpââŠ
Ich habe noch das Problem, dass die Tests extrem unzuverlÀssig durchlaufen.
Das Problem des ungenĂŒgenden Speichers habe ich jetzt gelöst, indem ich die leere Testdatenbank erstellt und eingebunden habe. Nun bekomme ich aber hĂ€ufiger beim Starten von runtests (nicht zuverlĂ€ssig reproduzierbar, manchmal gehtâs!) die Meldung:
[exception] [type OxidEsales\Eshop\Core\Exception\StandardException] [code 0] [file /var/www/html/oxid_b2c/vendor/oxid-esales/oxideshop-ce/source/Core/UtilsObject.php] [line 231] [message Fehler: Modul nicht aktiviert.<br />In einem Shop oder Sub-Shop mĂŒssen SchĂŒssel und Werte fĂŒr âcontrollersâ eindeutig sein.
AuĂerdem ist die Performance des Tools sehr, sehr mau, aber das wurde hier ja schon hĂ€ufiger angesprochen. Gibt es hier weitere Erfahrungen zu den genannten Themen? Bin wirklich fĂŒr jeden Hinweis dankbar.
Your problem that excteption occurred is because you should manually turn on your tested module on testing databaseâŠ
I have the same problem and it solve the problem. Also I add some clearing cache always before running tests in additional.inc.php file (in Test dir in module):
<?php
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Registry;