Skip to content

Commit

Permalink
fix(compatibility-suite): Clean up mock server
Browse files Browse the repository at this point in the history
  • Loading branch information
tienvx committed Oct 20, 2024
1 parent e79f314 commit 2e556c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compatibility-suite/tests/Service/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ public function getPort(): int
{
return $this->config->getPort();
}

public function __destruct()
{
// Clean up mock server
$this->getVerifyResult();
}
}
3 changes: 3 additions & 0 deletions src/PhpPact/Consumer/Driver/Pact/PactDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public function __construct(

public function cleanUp(): void
{
if (!$this->pact) {
return;
}
$success = $this->client->freePactHandle($this->getPact()->handle) === 0;
if (!$success) {
trigger_error('Can not free pact handle. The handle is not valid or does not refer to a valid Pact. Could be that it was previously deleted.', E_USER_WARNING);
Expand Down

0 comments on commit 2e556c4

Please sign in to comment.