Codeception / Codeception/module-doctrine
Different results if I run one test and all test in same time
- Ngôn ngữ chính
- PHP
- Star
- 4
- Fork
- 2
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
#### What are you trying to achieve?
Right now, I have some strange behaviour while running functional tests. If I run one file `codecept run functional /FunctionalFolder/Services/ServiceOneCest`, all tests are success - as expected. But in secound case, when I run all created tests `codecept run functional /FunctionalFolder`, some tests are finished as expected, while some others are failed.
Somehow, in _before() section, are not executed all dependeces.
```
class ServiceOneCest
{
public function _before(FunctionalTester $I)
{
$this->entityManager = $I->grabServiceFromContainer(EntityManager::class);
$this->entity = $this->entityManager->getRepository(Entity::class)
->findOneBy([
'name' => 'test'
]);
if (!$this->entity) {
$this->entity = $I->have(Entity::class, ['name' => 'test']);
}
}
public function testSomething(FunctionalTester $I)
{
$I->assertEquals('test', $this->entity->getName());
// here I catch error message [Error] Call to a member function getName() on null
// it only happend when I run more then one test file
}
}
//also exist some other test file
class ServiceTwoCest
{
}
```
I expect same results if I run one test file or more. I need to say, don't have any dependece between test data created in `_before()`
Please, if you see any reason or my bad code/configuration anything, give me handsup. If you have some other questions, please feel free to contact me.
### Details
* Codeception version: 2.5.1
* PHP Version:PHP 7.1.25
* Operating System: ubuntu16.04.1 (on vagrant)
* Installation type: Phar || Composer
* List of installed packages (`composer show`)
* Suite configuration:
```
actor: FunctionalTester
modules:
enabled:
- ZF2
- Asserts
- \Helper\Functional
- Doctrine2:
depends: ZF2
- DataFactory:
depends: Doctrine2
- \Helper\Factories
config:
Doctrine2:
cleanup: true
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Tái hiện vấn đề bằng cách chạy các lệnh kiểm thử chức năng Codeception cho một tệp đơn và cho toàn bộ thư mục được nêu trong báo cáo. Đọc các phương thức _before() của Cest và cấu hình ZF2, Doctrine2, DataFactory cũng như phần dọn dẹp. Hoàn tất khi cùng một bộ kiểm thử cho kết quả nhất quán khi chạy riêng lẻ hoặc dưới dạng một suite.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- database, testing
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100