Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
seba-aln committed Jun 19, 2024
1 parent 3d1d212 commit d2766c8
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions tests/integrational/HistoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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([
Expand All @@ -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([
Expand Down Expand Up @@ -401,20 +399,25 @@ 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);
}

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)
Expand All @@ -434,6 +437,7 @@ public function testSuperCallTest()
}
}

// phpcs:ignore PSR1.Classes.ClassDeclaration
class HistoryExposed extends History
{
protected $transport;
Expand Down

0 comments on commit d2766c8

Please sign in to comment.