Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reporters config owerrite by default in included suites #4667

Closed
bscheshirwork opened this issue Dec 7, 2017 · 1 comment
Closed

reporters config owerrite by default in included suites #4667

bscheshirwork opened this issue Dec 7, 2017 · 1 comment

Comments

@bscheshirwork
Copy link
Contributor

What are you trying to achieve?

I try to use redefine printer (may be resolve some problem on php 7.2)

<?php

namespace common\tests;


/**
 * Class Report overrides \Codeception\PHPUnit\ResultPrinter\Report constructor
 * to change default output to STDOUT and prevent some tests from fail when
 * they can not be executed after headers have been sent.
 */
class Report extends \Codeception\PHPUnit\ResultPrinter\Report
{
    /**
     * Report constructor.
     * @inheritdoc
     * @param null $out
     * @param array $groups
     * @param array $excludeGroups
     */
    public function __construct($out = null, array $groups = [], array $excludeGroups = [])
    {
        if ($out === null) {
            $out = STDOUT;
        }

        parent::__construct($out, $groups, $excludeGroups);
    }

    /**
     * @inheritdoc
     */
    public function flush()
    {
        if ($this->out !== STDOUT) {
            parent::flush();
        }
    }
}

in yii2-app-advanced...

I set into common config codeception.yml

# global codeception file to run tests from all apps
include:
    - common
    - frontend
    - backend
paths:
    log: console/runtime/logs
settings:
    colors: true
reporters:
    report: common\tests\Report

I want to use this in included suites...

What do you get instead?

Code of redefine printer newer use.

I try to trace it.

In

$config = Configuration::config($current_dir);

config will be load from included suite, i.e. from backend/codeception.yml

namespace: backend\tests
actor: Tester
paths:
    tests: tests
    log: tests/_output
    data: tests/_data
    helpers: tests/_support
settings:
    bootstrap: _bootstrap.php
    colors: true
    memory_limit: 1024M
modules:
    config:
        Yii2:
            configFile: 'config/test-local.php'

and some strange merged: in

$configContents = "";
if (file_exists($configFile)) {
$configContents = file_get_contents($configFile);
$tempConfig = self::mergeConfigs($tempConfig, self::getConfFromContents($configContents, $configFile));
}
self::prepareParams($tempConfig);
// load config using params
$config = self::mergeConfigs(self::$defaultConfig, self::getConfFromContents($distConfigContents, $configDistFile));
$config = self::mergeConfigs($config, self::getConfFromContents($configContents, $configFile));

my definition of reporters: report: ignored. Catch default value and
in

self::$config = $config;

share it global instead reporters from top-level(global) config.

This is correct?

Details

  • Codeception version: Codeception PHP Testing Framework v2.3.6
    Powered by PHPUnit 6.2.4 by Sebastian Bergmann and contributors.
  • PHP Version:7.2.0
  • Operating System:debian scratch
  • Installation type: Composer
  • List of installed packages (composer show)
  • Suite configuration:
# paste suite config here
@Naktibalda
Copy link
Member

Fixed in Codeception 4.2.0 by #5978

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants