3
votes

When run codeception i got a lots fo errors: DeepCopy\DeepCopy::recursiveCopy.

This is a problem so confuse me!

  1. I use codeception play well when i have only 4 unit test case: enter image description here
  2. When i still full up the unit test case story happen..
  3. There is 5 unit test in my test class then i got this: enter image description here

Here is the code :

public function testGetComplexItemNeeds() {
    $this->specify('[getComplexItemNeeds] : ', function($expected) {
        $actual = \common\services\ConfigService::getComplexItemNeeds('300001');

        expect('getComplexItemNeeds', $actual)->equals($expected);
    }, ['examples' => [
            [0 => [
                    'gold' => 1,
                    'list' => [
                        300018 => 1,
                    ],
                ]
            ],
    ]]);
}

php_error.log:

PHP 195. DeepCopy\DeepCopy::copyArray($array = array ('0000000025e4802e0000000050ab4f11' => class tests\codeception\frontend\UnitTester { protected $scenario = class Codeception\Scenario { ... }; protected $friends = array (...) }, '0000000025e480490000000050ab4f11' => class Codeception\Scenario { protected $test = class tests\codeception\frontend\service\ConfigServiceTest { ... }; protected $steps = array (...);

xdebug: i use xdebug to trace the problem found that when the function specifyCloneProperties deep copy the unitTester the php script down.

1

1 Answers

6
votes

You can turn off deep clone in your bootstrap.php file:

<?php
// disable deep cloning of properties inside specify block
\Codeception\Specify\Config::setDeepClone(false);
?>

Or turn on/off in the test. It's also increased performance of your tests.