Codeception / Codeception/module-doctrine

`haveInRepository` gives constructor parameter missing?

Đang mở
#5 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
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ả

```
/**
* @ORM\Entity
* @ORM\Table("processes")
*/
class Process extends Entity
{
/**
* @ORM\ManyToOne(inversedBy="processes")
* @ORM\JoinColumn(nullable=false)
*/
private QueueItem $queueItem;

public function __construct(QueueItem $queueItem)
{
$this->queueItem = $queueItem;
}
}
```

In test:
```
$processId = $this->tester->haveInRepository(Process::class, [
'queueItem' => ['name' => 'queue item name']
]);
```

Throws exception:

`InvalidArgumentException : Constructor parameter "queueItem" missing`

If I read the documentation correctly for `haveInRepository`:

> Alternatively, constructor arguments can be passed by name. Given User constructor signature is __constructor($arg), the example above could be rewritten like this: `$I->haveInRepository(User::class, ['arg' => $arg, 'name' => 'davert']);`

It should actually instantiate the `QueueItem` and pass it as the argument into the `Process` constructor or does it only work with scalar types?

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

Start at the haveInRepository implementation and trace how named constructor arguments are resolved for the Process and QueueItem example. Reproduce the reported case in a focused test and inspect the existing constructor-argument tests. Done means the behavior matches the documented example, or the documentation clearly states the supported limitation.

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

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.