From d3843a4e9170920d3bd0bfa3969664c32a829996 Mon Sep 17 00:00:00 2001 From: Adrian Parker Date: Sat, 6 Jan 2018 11:49:46 -0500 Subject: [PATCH] Add test for checking proxy disabling. --- src/Test/AssertionHelpers.php | 3 +-- tests/ToxiproxyTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Test/AssertionHelpers.php b/src/Test/AssertionHelpers.php index ee43c36..6e3fbbf 100644 --- a/src/Test/AssertionHelpers.php +++ b/src/Test/AssertionHelpers.php @@ -49,8 +49,7 @@ public function assertConnection(array $options, $message = null) ->then(function (ConnectionInterface $conn) use ($clientLoop) { $conn->close(); return true; - }, function (\Exception $e) { - throw $e; + }, function () { return false; }); $clientLoop->run(); diff --git a/tests/ToxiproxyTest.php b/tests/ToxiproxyTest.php index adb9617..c5209d9 100644 --- a/tests/ToxiproxyTest.php +++ b/tests/ToxiproxyTest.php @@ -129,4 +129,18 @@ public function testUpdate() $toxiproxy->delete($updatedProxy); } + + public function testUpdateDisabled() + { + $toxiproxy = $this->createToxiproxy(); + + $proxy = $this->createProxy($toxiproxy); + $this->assertProxyAvailable($proxy); + + $proxy->setEnabled(false); + $proxy = $toxiproxy->update($proxy); + $this->assertProxyUnavailable($proxy); + + $toxiproxy->delete($proxy); + } }