Tests
CoreShop Headless comes with a full test-suite. We use Behat for our Graphql Query and Mutations-Tests.
Running Tests Locally
Psalm
vendor/bin/psalm
PHPStan
SYMFONY_ENV=test vendor/bin/phpstan analyse -c phpstan.neon src -l 3 --memory-limit=-1
BEHAT
- create database
coreshop4__behat
Install Pimcore and CoreShop in Test Env
APP_ENV=test PIMCORE_TEST_DB_DSN=mysql://root:ROOT@coreshop_headless_db/coreshop4__behat PIMCORE_INSTALL_ADMIN_USERNAME=admin PIMCORE_INSTALL_ADMIN_PASSWORD=admin PIMCORE_INSTALL_MYSQL_HOST_SOCKET=coreshop_headless_db PIMCORE_INSTALL_MYSQL_USERNAME=root PIMCORE_INSTALL_MYSQL_PASSWORD=ROOT PIMCORE_INSTALL_MYSQL_DATABASE=coreshop4__behat PIMCORE_INSTALL_MYSQL_PORT=3306 PIMCORE_KERNEL_CLASS=Kernel vendor/bin/pimcore-install --env=test --skip-database-config -n
APP_ENV=test PIMCORE_CLASS_DIRECTORY=var/tmp/behat/var/classes PIMCORE_TEST_DB_DSN=mysql://root:ROOT@coreshop_headless_db/coreshop4__behat bin/console coreshop:install
APP_ENV=test PIMCORE_CLASS_DIRECTORY=var/tmp/behat/var/classes PIMCORE_TEST_DB_DSN=mysql://root:ROOT@coreshop_headless_db/coreshop4__behat bin/console pimcore:bundle:install PimcoreDataHubBundle
APP_ENV=test PIMCORE_CLASS_DIRECTORY=var/tmp/behat/var/classes PIMCORE_TEST_DB_DSN=mysql://root:ROOT@coreshop_headless_db/coreshop4__behat bin/console datahub:graphql:rebuild-definitions
BEHAT GraphQL
# OUTSIDE CONTAINER
# Run Symfony Server
export JWT_SECRET_KEY=config/jwt/private.pem
export JWT_PUBLIC_KEY=config/jwt/public.pem
export JWT_PASSPHRASE=
export APP_ENV=test
export PIMCORE_TEST_DB_DSN=mysql://root:ROOT@127.0.0.1:3308/coreshop4__behat
symfony server:start --port=9080 --dir=public --no-tls
# Run Behat
export CORESHOP_SKIP_DB_SETUP=1
export PIMCORE_TEST_DB_DSN=mysql://root:ROOT@127.0.0.1:3308/coreshop4__behat
php -d memory_limit=-1 vendor/bin/behat -c behat.yml.dist -vvv