ZendExpressive module fails when trying to use DataFactory with recreateApplicationBetweenTests set to true

Đang mở
#7 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
mysql, php
Lĩnh vực
backend, testing-qa

Hướng nghiên cứu

Bắt đầu tại dòng 94 của Codeception/Module/ZendExpressive.php và theo dõi các lệnh gọi từ Doctrine2 và DataFactory khi recreateApplicationBetweenTests là true. Tái hiện bằng lệnh Codeception và cấu hình suite được cung cấp, sau đó so sánh hành vi với thiết lập false. Hoàn thành khi đường dẫn DataFactory không còn gây ra lỗi null has(), trong khi việc tái tạo vẫn được bật.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

What are you trying to achieve?

I'm trying to use use FactoryMuffin for tests in my Zend Expressive application. With default setting recreateApplicationBetweenTests: true for ZendExpressive module tests don't work. I'm getting an exception. Changing config to recreateApplicationBetweenTests: false helps but I need to use recreateApplicationBetweenTests: true.

What do you get instead?
php vendor/bin/codecept run tests/api/Stores/CreateViewCest.php -vvv
Codeception PHP Testing Framework v3.1.0
Powered by PHPUnit 8.3.4 by Sebastian Bergmann and contributors.
Running with seed:

[Seed] 1069952343

  [Connecting To Db] {"config":{"populate":false,"cleanup":false,"reconnect":false,"waitlock":0,"dump":"tools/migration/giftcard_structure.sql","populator":null,"dsn":"mysql:host=127.0.0.1;dbname=test_giftcard_local;port=32768","user":"api_user","password":"api_user_pwd"},"options":[]}
  [Db] Connected to default test_giftcard_local
PHP Fatal error:  Uncaught Error: Call to a member function has() on null in /Users/local/Workspace/proj/vendor/codeception/codeception/src/Codeception/Module/ZendExpressive.php:94
Stack trace:
#0 /Users/local/Workspace/proj/vendor/codeception/codeception/src/Codeception/Module/Doctrine2.php(222): Codeception\Module\ZendExpressive->_getEntityManager()
Codeception/Codeception#1 /Users/local/Workspace/proj/vendor/codeception/codeception/src/Codeception/Module/Doctrine2.php(1011): Codeception\Module\Doctrine2->retrieveEntityManager()
Codeception/Codeception#2 /Users/local/Workspace/proj/vendor/codeception/codeception/src/Codeception/Module/DataFactory.php(178): Codeception\Module\Doctrine2->_getEntityManager()
Codeception/Codeception#3 /Users/local/Workspace/proj/vendor/codeception/codeception/src/Codeception/Module/DataFactory.php(158): Codeception\Module\DataFactory->getStore()
Codeception/Codeception#4 /Users/local/Workspace/proj/vendor/codeception/codeception/src/Codeception/Module/ZendExpressive.php on line 94
Details
  • Codeception version: 3.1.0
  • PHP Version: 7.1.3
  • Operating System: MacOS
  • Installation type: Composer
  • List of installed packages (composer show)
codeception/codeception 3.1.0
zendframework/zend-expressive 3.2.1
phpunit/phpunit 8.3.4
league/factory-muffin v3.0.1
  • Suite configuration:
    \Tests\Helper\Api extends \Codeception\Module\ZendExpressive
class_name: ApiTester
modules:
  enabled:
    - \Tests\Helper\Api
    - Asserts
    - Db
    - REST
    - DataFactory
  config:
    \Tests\Helper\Api:
      environment_file: .env.testing
      disable_exception_handling: false
      run_database_seeder: false
      cleanup: false
      recreateApplicationBetweenTests: true
    REST:
      depends: \Tests\Helper\Api
      part: Json
    DataFactory:
      factories: tests/_support/factories
      depends: Doctrine2
      cleanup: false
    Doctrine2:
      depends: \Tests\Helper\Api

Ngôn ngữ chính
PHP
Star
1
Fork
4
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Codeception/module-mezzio

Tất cả issue của Codeception/module-mezzio

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.