Skip to content

Commit

Permalink
Merge branch 'register-interactions' into alpha-4
Browse files Browse the repository at this point in the history
  • Loading branch information
tienvx committed Oct 9, 2023
2 parents 4c88a91 + d76230f commit 77cf0e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/PhpPact/Consumer/Driver/Interaction/InteractionDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ public function verifyInteractions(): bool
return $this->mockServer->verify();
}

public function registerInteraction(Interaction $interaction): bool
public function registerInteractions(Interaction ...$interactions): bool
{
$this->pactDriver->setUp();
$this->interactionRegistry->registerInteraction($interaction);
foreach ($interactions as $interaction) {
$this->interactionRegistry->registerInteraction($interaction);
}
$this->mockServer->start();

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

interface InteractionDriverInterface
{
public function registerInteraction(Interaction $interaction): bool;
public function registerInteractions(Interaction ...$interactions): bool;

public function verifyInteractions(): bool;
}
3 changes: 2 additions & 1 deletion src/PhpPact/Consumer/InteractionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ public function with(ConsumerRequest $request): self
public function willRespondWith(ProviderResponse $response): bool
{
$this->interaction->setResponse($response);
$this->driver->registerInteractions($this->interaction);

return $this->driver->registerInteraction($this->interaction);
return true;
}

/**
Expand Down

0 comments on commit 77cf0e2

Please sign in to comment.