diff --git a/src/PhpPact/Consumer/Driver/Interaction/InteractionDriver.php b/src/PhpPact/Consumer/Driver/Interaction/InteractionDriver.php index d9fbde151..8fb2ce7d6 100644 --- a/src/PhpPact/Consumer/Driver/Interaction/InteractionDriver.php +++ b/src/PhpPact/Consumer/Driver/Interaction/InteractionDriver.php @@ -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; diff --git a/src/PhpPact/Consumer/Driver/Interaction/InteractionDriverInterface.php b/src/PhpPact/Consumer/Driver/Interaction/InteractionDriverInterface.php index fe5a3e076..fcb9a5189 100644 --- a/src/PhpPact/Consumer/Driver/Interaction/InteractionDriverInterface.php +++ b/src/PhpPact/Consumer/Driver/Interaction/InteractionDriverInterface.php @@ -6,7 +6,7 @@ interface InteractionDriverInterface { - public function registerInteraction(Interaction $interaction): bool; + public function registerInteractions(Interaction ...$interactions): bool; public function verifyInteractions(): bool; } diff --git a/src/PhpPact/Consumer/InteractionBuilder.php b/src/PhpPact/Consumer/InteractionBuilder.php index 000a08aeb..073e6d77e 100644 --- a/src/PhpPact/Consumer/InteractionBuilder.php +++ b/src/PhpPact/Consumer/InteractionBuilder.php @@ -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; } /**