Skip to content

Namespace and path inconsistencies with Yii2 Testing documentation #155

Open
@vercotux

Description

@vercotux

This is not a question. It is an issue pointing out the inconsistencies between this project, the yii2 testing documentation and other yii2 components, which have resulted in costing developers dozens of workhours trying to figure out.

In the Yii2 Testing Documentation the namespace for codeception unit tests is shown as:
namespace app\tests\unit\models;

Meanwhile in yii2-app-basic (which also uses codeception) the namespace for codeception unit tests is: namespace tests\models;.

Which convention are we supposed to follow? Why are they different?

The whole thing becomes even more confusing when you try to figure out fixtures.
According to Yii2 Testing Documentation, test fixtures are supposed to be located under the following namespace:
app\tests\fixtures

But then the same documentation says:

By default fixtures will be searched under tests\unit\fixtures namespace

This seems to match the default path for fixtures generated by yii2-faker which is
@tests/unit/fixtures/data

However, the Yii2 Testing Documentation then gives an example of the data path as:

// fixture data located in tests/_data/user.php
'dataFile' => codecept_data_dir() . 'user.php'

Why? That is not where yii2-faker puts the generated data by default and the documentation does not explain why it is different.

Could we please do something about it? IMO the template apps and other related components should accurately reflect what is described in the documentation, not implement it in their own unique way.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions