From d2766c82657528c099430f3bda406145181693fa Mon Sep 17 00:00:00 2001 From: Sebastian Molenda Date: Wed, 19 Jun 2024 22:49:05 +0200 Subject: [PATCH] Test fixes --- tests/integrational/HistoryTest.php | 38 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/tests/integrational/HistoryTest.php b/tests/integrational/HistoryTest.php index d7a10fdf..b4571d8b 100644 --- a/tests/integrational/HistoryTest.php +++ b/tests/integrational/HistoryTest.php @@ -11,12 +11,8 @@ use Tests\Helpers\Stub; use Tests\Helpers\StubTransport; - -class TestPubNubHistory extends \PubNubTestCase +class HistoryTest extends \PubNubTestCase { - const COUNT = 5; - const TOTAL = 7; - /** * @group history * @group history-integrational @@ -131,10 +127,11 @@ public function testAuthSuccess() */ public function testEncryptedSuccess() { - $history = new HistoryExposed($this->pubnub); - - $this->pubnub->getConfiguration()->setUseRandomIV(false); - $this->pubnub->getConfiguration()->setCipherKey("cipherKey"); + $config = $this->config->clone(); + $config->setUseRandomIV(false); + $config->setCipherKey("cipherKey"); + $pubnub = new PubNub($config); + $history = new HistoryExposed($pubnub); $history->stubFor("/v2/history/sub-key/demo/channel/niceChannel") ->withQuery([ @@ -161,10 +158,11 @@ public function testEncryptedSuccess() public function testEncryptedWithPNOtherSuccess() { - $history = new HistoryExposed($this->pubnub); - - $this->pubnub->getConfiguration()->setUseRandomIV(false); - $this->pubnub->getConfiguration()->setCipherKey("hello"); + $config = $this->config->clone(); + $config->setUseRandomIV(false); + $config->setCipherKey("hello"); + $pubnub = new PubNub($config); + $history = new HistoryExposed($pubnub); $history->stubFor("/v2/history/sub-key/demo/channel/niceChannel") ->withQuery([ @@ -401,9 +399,12 @@ public function xtestSuperCallWithChannelOnly() { $ch = "history-php-ch-.*|@#"; - $this->pubnub_pam->getConfiguration()->setUuid("history-php-uuid-.*|@#"); + $config = $this->config_pam->clone(); + $config->setUuid("history-php-uuid-.*|@#"); + + $pubnub_pam = new PubNub($config); - $result = $this->pubnub_pam->history()->channel($ch)->sync(); + $result = $pubnub_pam->history()->channel($ch)->sync(); $this->assertInstanceOf(PNHistoryResult::class, $result); } @@ -411,10 +412,12 @@ public function xtestSuperCallWithChannelOnly() public function testSuperCallWithAllParams() { $ch = "history-php-ch"; + $config = $this->config_pam->clone(); + $config->setUuid("history-php-uuid"); - $this->pubnub_pam->getConfiguration()->setUuid("history-php-uuid"); + $pubnub_pam = new PubNub($config); - $result = $this->pubnub_pam->history() + $result = $pubnub_pam->history() ->channel($ch) ->count(2) ->includeTimetoken(true) @@ -434,6 +437,7 @@ public function testSuperCallTest() } } +// phpcs:ignore PSR1.Classes.ClassDeclaration class HistoryExposed extends History { protected $transport;