Answer the question
In order to leave comments, you need to log in
Why is there a problem when testing unit tests if there are several methods?
Hello!
The project is being unit tested on yii2 using codeception.
Command in progress: php codecept.phar run --debug unit ExampleTest
Test code:
<?php
class ExampleTest extends \Codeception\Test\Unit
{
/**
* @var \UnitTester
*/
protected $tester;
protected function _before()
{
}
protected function _after()
{
}
// tests
public function testSomeFeature()
{
}
public function testSomeFeature2()
{
}
}
- ExampleTest: Some feature
[Database] Transaction started
+ ExampleTest: Some feature (0.01s)
[Database] Transaction cancelled; all changes reverted.
- ExampleTest: Some feature2
Fatal error: Cannot declare class Yii, because the name is already in use in C:\OSPanel\domains\yii2tests.loc\vendor\yiisoft\yii2\Yii.php on line 21
# Codeception Test Suite Configuration
# suite for unit (internal) tests.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name: UnitTester
modules:
enabled:
- Asserts
- Yii2:
configFile: 'tests/config/unit.php'
part: [orm, email]
<?php
/**
* Application configuration for acceptance tests
*/
require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
return yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../config/web.php'),
require(__DIR__ . '/config.php'),
[]
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question