Unable to use `Examples` attribute

Đang mở
#882 1 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
php
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu bằng việc xem cách sử dụng thuộc tính Examples trong issue và lỗi tại vendor/codeception/codeception/src/Codeception/Lib/Di.php:122, sau đó so sánh với hành vi mong đợi được mô tả trong #867. Được xem là hoàn thành khi Cest được hiển thị có thể nhận dữ liệu Codeception\Example và thực thi mà không có InjectionException.

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

Mô tả

I recently updated to codeception v5 - which works like a charm 😊
I just wanted to try out the new Examples Attribute. Unfortunately I get this:

use Codeception\Attribute\Examples;
use Codeception\Example;
use Symfony\Component\HttpFoundation\Response;
use Tests\Support\FunctionalTester;

final class LegacySeriesRedirectControllerCest
{
    #[Examples(url: '/de/series/index', expected: 'asdf')]
    public function foo(FunctionalTester $I, Example $example): void
    {
        $I->followRedirects(false);
        $I->amOnPage($example['url']);
        $I->seeRedirectTo($example['expected'], Response::HTTP_FOUND);
    }
}
 LegacySeriesRedirectControllerCest: Foo
 Test  tests/Functional/App/Controller/Frontend/LegacySeriesRedirectControllerCest.php:foo
                                                                                                                                                                                                                                            
  [InjectionException] Failed to inject dependencies in instance of 'Functional\App\Controller\Frontend\LegacySeriesRedirectControllerCest'. Failed to create instance of 'Codeception\Example'. Parameter 'data' must have default value.  
                                                                                                                                                                                                                                            
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/Lib/Di.php:122
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/Test/Cest.php:184
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/Test/Cest.php:200
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/Test/Cest.php:129
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/Test/Test.php:168
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/Suite.php:130
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/SuiteManager.php:151
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/Codecept.php:260
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/Codecept.php:216
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/Command/Run.php:435
/path/to/project/okto/website/vendor/symfony/console/Command/Command.php:326
/path/to/project/okto/website/vendor/symfony/console/Application.php:1078
/path/to/project/okto/website/vendor/symfony/console/Application.php:324
/path/to/project/okto/website/vendor/symfony/console/Application.php:175
/path/to/project/okto/website/vendor/codeception/codeception/src/Codeception/Application.php:112
/path/to/project/okto/website/vendor/codeception/codeception/app.php:45
/path/to/project/okto/website/vendor/codeception/codeception/app.php:46
/path/to/project/okto/website/vendor/codeception/codeception/codecept:7
/path/to/project/okto/website/vendor/bin/codecept:119
$ symfony composer info codeception/*
codeception/codeception      5.1.2 BDD-style testing framework
codeception/lib-asserts      2.1.0 Assertion methods used by Codeception core and Asserts module
codeception/lib-innerbrowser 4.0.5 Parent library for all Codeception framework modules and PhpBrowser
codeception/lib-web          1.0.6 Library containing files used by module-webdriver and lib-innerbrowser or module-phpbrowser
codeception/lib-xml          1.0.3 Files used by module-rest and module-soap
codeception/module-asserts   3.0.0 Codeception module containing various assertions
codeception/module-doctrine  3.1.0 Doctrine module for Codeception
codeception/module-rest      3.4.0 REST module for Codeception
codeception/module-symfony   3.5.0 Codeception module for Symfony framework
codeception/module-webdriver 4.0.2 WebDriver module for Codeception
codeception/stub             4.1.3 Flexible Stub wrapper for PHPUnit's Mock Builder

According to #867 this should work. What am I doing wrong?

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

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

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/codeception.github.com

Tất cả issue của Codeception/codeception.github.com

Issue tương tự

Thêm issue về Testing & QA

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.