Skip to content

Commit

Permalink
PubNub SDK v4.1.6 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
client-engineering-bot committed Aug 21, 2020
1 parent 4e5e1a5 commit d1bb04f
Show file tree
Hide file tree
Showing 22 changed files with 198 additions and 161 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**/*.php.temp
**/*.txt
**/*.iml
!git_sync_excluded.txt

# composer vendor dir
/vendor
Expand Down
8 changes: 7 additions & 1 deletion .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: php
version: 4.1.5
version: 4.1.6
schema: 1
scm: github.com/pubnub/php
changelog:
- version: v4.1.6
date: Aug 20, 20
changes:
-
text: "Remove hard coded keys from tests."
type: improvement
- version: 4.1.5
date: Oct 22, 2019
changes:
Expand Down
51 changes: 37 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
language: php
dist: xenial
sudo: false
php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
os: linux

install:
- composer self-update && composer --version
- composer install --prefer-dist
script:
- vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
after_success:
- bash <(curl -s https://codecov.io/bash)
notifications:
flowdock:
secure: kOxa/6eB6+bQumvYSh7yf/uPNQ5xRastjSkRbUrqVbYEiMiguCuoe8xkmU5JJxmNMpvFjYL9yowPo9LELMceVsWVflNEEWFQE5sJe9qifZu/SpOD8RUWfHmZ2jZBELmnLSDSAIxaAjQMb1LEedkBHGMVJknbb+DRs4fT31ilMUM=


stages:
- name: "test"
if: |
type != pull_request \
AND tag IS blank
- name: "code coverage"
if: |
type == pull_request
jobs:
include:
- stage: "test"
name: 'PHP 5.6'
php: '5.6'
script: vendor/bin/phpunit --verbose
- name: 'PHP 7.0'
php: '7.0'
script: vendor/bin/phpunit --verbose
- name: 'PHP 7.1'
php: '7.1'
script: vendor/bin/phpunit --verbose
- name: 'PHP 7.2'
php: '7.2'
script: vendor/bin/phpunit --verbose
- name: 'PHP 7.3'
php: '7.3'
script: vendor/bin/phpunit --verbose
- stage: "code coverage"
name: 'Test & Code coverage'
php: '7.3'
script: vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
after_success:
- bash <(curl -s https://codecov.io/bash)
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [v4.1.6](https://github.com/pubnub/php/releases/tag/v4.1.6)
August-20-2020

- ⭐️️ Remove hard coded keys from tests.

## [v4.1.5](https://github.com/pubnub/php/tree/v4.1.5)
October-22-2019

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ please use the [master_3x](https://github.com/pubnub/php/tree/master_3x) branch

## Communication

- If you **need help** or have a **general question**, contact <support@pubnub.com>
- If you **need help** or have a **general question**, contact <support@pubnub.com>
4 changes: 2 additions & 2 deletions composer.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["api", "real-time", "realtime", "real time", "ajax", "push"],
"homepage": "http://www.pubnub.com/",
"license": "MIT",
"version": "4.1.5",
"version": "4.1.6",
"authors": [
{
"name": "PubNub",
Expand All @@ -25,7 +25,7 @@
},
"autoload": {
"psr-0": {
"PubNub\\": "src/"
"PubNub\": "src/"
}
},
"autoload-dev": {
Expand Down
42 changes: 21 additions & 21 deletions src/PubNub/PubNub.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,34 @@
use Monolog\Logger;
use PubNub\Builders\SubscribeBuilder;
use PubNub\Callbacks\SubscribeCallback;
use PubNub\Endpoints\Access\Audit;
use PubNub\Endpoints\Access\Grant;
use PubNub\Endpoints\Access\Revoke;
use PubNub\Endpoints\ChannelGroups\AddChannelToChannelGroup;
use PubNub\Endpoints\ChannelGroups\ListChannelsInChannelGroup;
use PubNub\Endpoints\ChannelGroups\RemoveChannelFromChannelGroup;
use PubNub\Endpoints\ChannelGroups\RemoveChannelGroup;
use PubNub\Endpoints\History;
use PubNub\Endpoints\HistoryDelete;
use PubNub\Endpoints\MessageCount;
use PubNub\Endpoints\Presence\GetState;
use PubNub\Endpoints\Presence\HereNow;
use PubNub\Endpoints\Presence\SetState;
use PubNub\Endpoints\Presence\WhereNow;
use PubNub\Endpoints\PubSub\Publish;
use PubNub\Endpoints\Push\AddChannelsToPush;
use PubNub\Endpoints\Push\ListPushProvisions;
use PubNub\Endpoints\Push\RemoveChannelsFromPush;
use PubNub\Endpoints\Push\RemoveDeviceFromPush;
use PubNub\Endpoints\Time;
use PubNubndpoints\Access\Audit;
use PubNubndpoints\Access\Grant;
use PubNubndpoints\Access\Revoke;
use PubNubndpoints\ChannelGroups\AddChannelToChannelGroup;
use PubNubndpoints\ChannelGroups\ListChannelsInChannelGroup;
use PubNubndpoints\ChannelGroups\RemoveChannelFromChannelGroup;
use PubNubndpoints\ChannelGroups\RemoveChannelGroup;
use PubNubndpoints\History;
use PubNubndpoints\HistoryDelete;
use PubNubndpoints\MessageCount;
use PubNubndpoints\Presence\GetState;
use PubNubndpoints\Presence\HereNow;
use PubNubndpoints\Presence\SetState;
use PubNubndpoints\Presence\WhereNow;
use PubNubndpoints\PubSub\Publish;
use PubNubndpoints\Push\AddChannelsToPush;
use PubNubndpoints\Push\ListPushProvisions;
use PubNubndpoints\Push\RemoveChannelsFromPush;
use PubNubndpoints\Push\RemoveDeviceFromPush;
use PubNubndpoints\Time;
use PubNub\Managers\BasePathManager;
use PubNub\Managers\SubscriptionManager;
use PubNub\Managers\TelemetryManager;


class PubNub
{
const SDK_VERSION = "4.1.5";
const SDK_VERSION = "4.1.6";
const SDK_NAME = "PubNub-PHP";

public static $MAX_SEQUENCE = 65535;
Expand Down
28 changes: 13 additions & 15 deletions tests/PubNubTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,11 @@

abstract class PubNubTestCase extends TestCase
{
const PUBLISH_KEY = 'pub-c-139c0366-9b6a-4a3f-ac03-4f8d31c86df2';
const SUBSCRIBE_KEY = 'sub-c-8f18abdc-a7d7-11e5-8231-02ee2ddab7fe';

const PUBLISH_KEY_PAM = "pub-c-8fd20085-4084-4c0f-9097-a2e6645c5b2c";
const SUBSCRIBE_KEY_PAM = "sub-c-031868ac-8b32-11e8-85ee-866938e9174c";
const SECRET_KEY_PAM = "sec-c-OTFhMDAwNTAtYzkyMi00MTlhLTljZmEtYTFiZThhNjZiMDA0";

const CIPHER_KEY = "enigma";

const SPECIAL_CHARACTERS = "-.,_~:/?#[]@!$&'()*+;=`|";
const SPECIAL_CHANNEL = "-._~:/?#[]@!$&'()*+;=`|";


/** @var Pubnub pubnub */
protected $pubnub;

Expand All @@ -43,21 +35,27 @@ abstract class PubNubTestCase extends TestCase

public function setUp()
{
$publishKey = getenv("PUBLISH_KEY");
$subscribeKey = getenv("SUBSCRIBE_KEY");
$publishKeyPam = getenv("PUBLISH_PAM_KEY");
$subscribeKeyPam = getenv("SUBSCRIBE_PAM_KEY");
$secretKeyPam = getenv("SECRET_PAM_KEY");

parent::setUp();

$this->config = new PNConfiguration();
$this->config->setSubscribeKey(static::SUBSCRIBE_KEY);
$this->config->setPublishKey(static::PUBLISH_KEY);
$this->config->setSubscribeKey($subscribeKey);
$this->config->setPublishKey($publishKey);

$this->config_enc = new PNConfiguration();
$this->config_enc->setSubscribeKey(static::SUBSCRIBE_KEY);
$this->config_enc->setPublishKey(static::PUBLISH_KEY);
$this->config_enc->setSubscribeKey($subscribeKey);
$this->config_enc->setPublishKey($publishKey);
$this->config_enc->setCipherKey(static::CIPHER_KEY);

$this->config_pam = new PNConfiguration();
$this->config_pam->setSubscribeKey(static::SUBSCRIBE_KEY_PAM);
$this->config_pam->setPublishKey(static::PUBLISH_KEY_PAM);
$this->config_pam->setSecretKey(static::SECRET_KEY_PAM);
$this->config_pam->setSubscribeKey($subscribeKeyPam);
$this->config_pam->setPublishKey($publishKeyPam);
$this->config_pam->setSecretKey($secretKeyPam);

$this->pubnub = new PubNub($this->config);
$this->pubnub_enc = new PubNub($this->config_enc);
Expand Down
12 changes: 6 additions & 6 deletions tests/functional/MessageCountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testSyncDisabled()
"subscribe key.Login to your PubNub Dashboard Account and enable Storage & Playback.Contact support " .
"@pubnub.com if you require further assistance.\",0,0]";

$messageCount->stubFor("/v3/history/sub-key/". parent::SUBSCRIBE_KEY . "/message-counts/my_channel")
$messageCount->stubFor("/v3/history/sub-key/". $this->pubnub->getConfiguration()->getSubscribeKey() . "/message-counts/my_channel")
->withQuery([
"timetoken" => "10000",
"pnsdk" => $this->encodedSdkName,
Expand All @@ -50,7 +50,7 @@ public function testSingleChannel_withSingleTimestamp()
$payload = "{\"status\": 200, \"error\": false, \"error_message\": \"\", " .
"\"channels\": {\"my_channel\":19}}";

$messageCount->stubFor("/v3/history/sub-key/". parent::SUBSCRIBE_KEY . "/message-counts/my_channel")
$messageCount->stubFor("/v3/history/sub-key/". $this->pubnub->getConfiguration()->getSubscribeKey() . "/message-counts/my_channel")
->withQuery([
"timetoken" => "10000",
"pnsdk" => $this->encodedSdkName,
Expand Down Expand Up @@ -92,7 +92,7 @@ public function testMultiChannel_withSingleTimestamp()
$payload = "{\"status\": 200, \"error\": false, \"error_message\": \"\", " .
"\"channels\": {\"my_channel\":19, \"new_channel\":5}}";

$messageCount->stubFor("/v3/history/sub-key/". parent::SUBSCRIBE_KEY . "/message-counts/my_channel,new_channel")
$messageCount->stubFor("/v3/history/sub-key/". $this->pubnub->getConfiguration()->getSubscribeKey() . "/message-counts/my_channel,new_channel")
->withQuery([
"timetoken" => "10000",
"pnsdk" => $this->encodedSdkName,
Expand Down Expand Up @@ -127,7 +127,7 @@ public function testMultiChannel_withMultiTimestamp()
$payload = "{\"status\": 200, \"error\": false, \"error_message\": \"\", " .
"\"channels\": {\"my_channel\":19, \"new_channel\":5}}";

$messageCount->stubFor("/v3/history/sub-key/". parent::SUBSCRIBE_KEY . "/message-counts/my_channel,new_channel")
$messageCount->stubFor("/v3/history/sub-key/". $this->pubnub->getConfiguration()->getSubscribeKey() . "/message-counts/my_channel,new_channel")
->withQuery([
"channelsTimetoken" => PubNubUtil::joinitems(["10000", "20000"]),
"pnsdk" => $this->encodedSdkName,
Expand Down Expand Up @@ -195,7 +195,7 @@ public function testChannel_withMultiEmptyToken()

$messageCount = new MessageCountExposed($this->pubnub);

$messageCount->stubFor("/v3/history/sub-key/". parent::SUBSCRIBE_KEY . "/message-counts/my_channel")
$messageCount->stubFor("/v3/history/sub-key/". $this->pubnub->getConfiguration()->getSubscribeKey() . "/message-counts/my_channel")
->withQuery([
"channelsToken" => PubNubUtil::joinitems([]),
"pnsdk" => $this->encodedSdkName,
Expand All @@ -216,7 +216,7 @@ public function testChannel_withMultiNullToken()

$messageCount = new MessageCountExposed($this->pubnub);

$messageCount->stubFor("/v3/history/sub-key/". parent::SUBSCRIBE_KEY . "/message-counts/my_channel")
$messageCount->stubFor("/v3/history/sub-key/". $this->pubnub->getConfiguration()->getSubscribeKey() . "/message-counts/my_channel")
->withQuery([
"timetoken" => null,
"pnsdk" => $this->encodedSdkName,
Expand Down
14 changes: 8 additions & 6 deletions tests/integrational/AddChannelChannelGroupEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function testSuccess()
{
$addChannelChannelGroup = new AddChannelChannelGroupExposed($this->pubnub);

$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/sub-c-8f18abdc-a7d7-11e5-8231-02ee2ddab7fe/channel-group/gr%7CoupA")
$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/demo/channel-group/gr%7CoupA")
->withQuery([
"pnsdk" => $this->encodedSdkName,
"uuid" => "myUUID",
Expand All @@ -38,7 +38,7 @@ public function testGroupMissing()

$addChannelChannelGroup = new AddChannelChannelGroupExposed($this->pubnub);

$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/sub-c-8f18abdc-a7d7-11e5-8231-02ee2ddab7fe/channel-group/gr%7CoupA")
$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/demo/channel-group/gr%7CoupA")
->withQuery([
"pnsdk" => $this->encodedSdkName,
"uuid" => "myUUID",
Expand All @@ -58,7 +58,7 @@ public function testGroupIsEmpty()

$addChannelChannelGroup = new AddChannelChannelGroupExposed($this->pubnub);

$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/sub-c-8f18abdc-a7d7-11e5-8231-02ee2ddab7fe/channel-group/gr%7CoupA")
$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/demo/channel-group/gr%7CoupA")
->withQuery([
"pnsdk" => $this->encodedSdkName,
"uuid" => "myUUID",
Expand All @@ -78,7 +78,7 @@ public function testChannelMissing()

$addChannelChannelGroup = new AddChannelChannelGroupExposed($this->pubnub);

$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/sub-c-8f18abdc-a7d7-11e5-8231-02ee2ddab7fe/channel-group/groupA")
$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/demo/channel-group/groupA")
->withQuery([
"pnsdk" => $this->encodedSdkName,
"uuid" => "myUUID"
Expand All @@ -94,7 +94,7 @@ public function testIsAuthRequiredSuccess()
{
$addChannelChannelGroup = new AddChannelChannelGroupExposed($this->pubnub);

$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/sub-c-8f18abdc-a7d7-11e5-8231-02ee2ddab7fe/channel-group/groupA")
$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/demo/channel-group/groupA")
->withQuery([
"pnsdk" => $this->encodedSdkName,
"uuid" => "myUUID",
Expand All @@ -115,7 +115,7 @@ public function testErrorBodyForbidden()

$addChannelChannelGroup = new AddChannelChannelGroupExposed($this->pubnub);

$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/sub-c-8f18abdc-a7d7-11e5-8231-02ee2ddab7fe/channel-group/groupA")
$addChannelChannelGroup->stubFor("/v1/channel-registration/sub-key/demo/channel-group/groupA")
->withQuery([
"pnsdk" => $this->encodedSdkName,
"uuid" => "myUUID",
Expand All @@ -139,6 +139,8 @@ public function testSuperCallTest()
// :&*+;
$channelCharacters = "-.,_~[]@!$'()=`|";

$this->expectException(PubNubServerException::class);

$this->pubnub_pam->addChannelToChannelGroup()
->channels($channelCharacters)
->channelGroup($groupCharacters)
Expand Down
Loading

0 comments on commit d1bb04f

Please sign in to comment.