Codeception / Codeception/module-doctrine

`haveInRepository` gives constructor parameter missing?

Offen
#5 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
4
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

```
/**
* @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?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.