Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Fixture builder: accept a PageBuilder or PageDataBuilder as the target of linkRoute(), linkIri() and redirect(to:)

Đã đóng
#471 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Một pull request liên quan đã được merge.

  • #474 của @silverbackdan — đã merge

Đá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
15/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php, symfony
Lĩnh vực
backend, testing

Hướng nghiên cứu

Start with the open pull request #474 to see what it already covers before writing anything. The payload names linkRoute(), linkIri() and redirect(to:) on the fixture builder, PageBuilder and PageDataBuilder, and getRoute() for kept pages in --append loads. Done means CwaFixtureBuilderTest and CwaFixtureBuilderAppendTest pass with a builder target resolving to its generated route, including about-1, and a route-less builder throwing.

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

Mô tả

Follow-up to #452. A hand-written scaffold has to refer to a route by name, in linkRoute(property, routeName:), linkIri(..., route:) and $cwa->redirect(path, to:). That means it has to know the name generated for a page, even when the page was declared a few lines earlier and the builder is in hand.

Proposal: let these calls take the PageBuilder or PageDataBuilder itself as well as a route name.

  • linkRoute('route', page: $about), with $about being a PageBuilder or PageDataBuilder.
  • $cwa->redirect('/old', to: $about).
  • It resolves to that builder's route once routes exist, which is the same moment linkRoute() resolves today, so it adds no flush.
  • A builder with no route (withoutRoute(), a template page, untitled) throws, naming the page and the caller.
  • A kept page in an --append load resolves to its existing route, as getRoute() already does.

The generator keeps writing route names, because it always knows them. This is a convenience for scaffolds written by hand.

Proposed tests:

  • CwaFixtureBuilderTest: a builder target resolves to the generated route, including a suffixed one (about-1), with no extra flush. A builder with no route throws.
  • CwaFixtureBuilderAppendTest: a kept page resolves to its existing route.
Ngôn ngữ chính
PHP
Star
32
Fork
8
Merge trung bình
56 phút
Pull request đã merge (30 ngày)
164

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 components-web-app/api-components-bundle

Tất cả issue của components-web-app/api-components-bundle

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.