Codeception Configuration


#1

Hello,

I am trying to set up codeception for our testing, however I am having problems setting the Pimcore environment for it

This is our codeception.yml

# tests/codeception.dist.yml

namespace: Tests
actor: Tester
paths:
    tests: .
    log: ./_output
    data: ./_data
    support: ./_support
    envs: ./_envs
settings:
    bootstrap: _bootstrap.php
    colors: true
params:
    - env
extensions:
    enabled:
        - Codeception\Extension\RunFailed

This is our _bootstrap.php file:

<?php

// tests/_bootstrap.php

use Pimcore\Tests\Util\Autoloader;

// define project root which will be used throughout the bootstrapping process
define('PIMCORE_PROJECT_ROOT', realpath(__DIR__ . '/..'));

// set the used pimcore/symfony environment
putenv('PIMCORE_ENVIRONMENT=test');
putenv('SYMFONY_DEPRECATIONS_HELPER=weak');

$startupFile = PIMCORE_PROJECT_ROOT . '/app/startup_cli.php';
if (file_exists($startupFile)) {
    include_once $startupFile;
}

// add the core pimcore test library to the autoloader - this could also be done in composer.json's autoload-dev section
// but is done here for demonstration purpose
require_once PIMCORE_PROJECT_ROOT . '/pimcore/tests/_support/Util/Autoloader.php';

Autoloader::addNamespace('Pimcore\Tests', PIMCORE_PROJECT_ROOT . '/pimcore/tests/_support');

require_once PIMCORE_PROJECT_ROOT . '/vendor/autoload.php';

if we comment connect_db: true on the unit we get:

If not, we get:

Somehow it is not grabbing the database configuration I guess…

Any help will be welcome.

Thanks!