dachcom-digital / pimcore-codeception-framework
Pimcore Codeception Framework
Installs: 4 397
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 11
Forks: 0
Open Issues: 0
README
This Package allows you to create fast and simple testing environments. It's also used by all pimcore Bundles created by DACHCOM.DIGITAL.
Support Table
Upgrade Notes
3.0.0
- Yaml extension changed from
yml
toyaml
_support
path has changed toSupport
. AllDachcom\Codeception\*
namespaces have changed toDachcom\Codeception\Support\*
- Using rsync for
setup_files
so you need to adjust yoursetup_files
stack accordingly (see example below) - You need to define PIMCORE
config_location
in your ci configuration (See section "Configuration Location" below) - You have to add additional PIMCORE Bundles to the
bundles
config section (see example below) - [SECURITY]
\Pimcore\Bundle\AdminBundle\EventListener\CsrfProtectionListener
is disabled while executing tests Pimcore\Model\DataObject
namespace changed from_output/var/classes/DataObject/DataObject
to_output/var/classes/DataObject
- TestKernel Class can be defined via
TEST_KERNEL_CLASS
env var
Configuration
All test files need to be stored in /tests
.
Environment Variables
Bootstrap
Create a file called _bootstrap.php
in tests/_bootstrap.php
<?php $frameworkPath = getenv('PIMCORE_CODECEPTION_FRAMEWORK'); $bundleTestPath = getenv('TEST_BUNDLE_TEST_DIR'); $bootstrap = sprintf('%s/src/_bootstrap.php', $frameworkPath); include_once $bootstrap;
Setup File
Create a file called config.yaml
in tests/_etc/config.yaml
.
bundles: - { namespace: \MyTestBundle\MyTestBundle } - { namespace: \Pimcore\Bundle\SeoBundle\PimcoreSeoBundle, priority: 0, execute_installer: true } # if you need the seo bundle setup_files: - { path: app/config.yaml, dest: ./config/ } - { path: app/system_settings.yaml, dest: ./var/config/system_settings/ } - { path: app/controller/DefaultController.php, dest: ./src/Controller/ } - { path: app/templates/default.html.twig, dest: ./templates/default/ } - { path: app/templates/snippet.html.twig, dest: ./templates/default/ } preload_files: - { path: Services/MySpecialTestService.php } additional_composer_packages: - { package: pimcore/admin-ui-classic-bundle, version: ^1.0 } # this one is most likely needed - { package: vendor/foo-bar, version: ^1.0} # additional packages
Configuration Location
In your app/config.yaml
you should move all config locations to settings-store
,
see pimcore ci example
Attention! Do not set
system_settings
tosettings-store
!
Setup File Parameters
- bundles (required): At least your test bundle should be registered here. Add more, if needed
- setup_files (optional): All your template files which should to be available during test cycles. These files need to be
stored under
/tests/_etc/config
- preload_files (optional): These files will be included at kernel setup. Since these files are not included via composer autoload, we need to define them here
- additional_composer_packages (optional): Install additional composer packages which are not available in root composer.json
Bundle Configuration Files
This Framework allows you to use multiple (bundle) configuration setups. You need to add at least one default config file
called default_config.yaml
and store it in /tests/_etc/config/bundle
.
Using Bundle Configuration Files
TBD
Classes
If you want to provide some classes to install, all the definitions need to stored at /tests/_etc/classes
.