Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
language: php

php:
- 7.0
- 7.1
- 7.3
- 7.4
- 8.0

before_script:
- travis_retry composer self-update
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": "^7.1",
"php": "^7.1 || ^8.0",
"illuminate/support": "^5.5|^6.0|^7.0",
"illuminate/console": "^5.5|^6.0|^7.0",
"thruway/client": "^0.5",
Expand All @@ -20,7 +20,7 @@
"phpunit/phpunit": "^7|^8|^9",
"mockery/mockery": "0.9.*|^1.0",
"squizlabs/php_codesniffer": "^3.2",
"friendsofphp/php-cs-fixer": "^2.11"
"friendsofphp/php-cs-fixer": "^3.0"
},
"autoload": {
"psr-0": {
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="unit">
Expand Down
3 changes: 1 addition & 2 deletions src/Vinelab/Minion/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function onSessionStart($session, $transport)
// also no longer a method on the Client class.
// Shush the logs.
// $this->getManager()->setQuiet(true);

// Boot up providers
$this->bootProviders();
}
Expand Down Expand Up @@ -252,7 +252,6 @@ public function wrapWithProxy($callback, $isFunction = false)
// We will wrap the callback with a Closure so that we can format the kwArgs that we receive
// into our proprietary Dictionary instance to make things safer.
return function ($args, $kwArgs, $details) use ($callback, $isFunction, $provider) {

if (is_string($callback) && !$isFunction && $provider instanceof Provider) {
$callback = [$provider, $callback];
}
Expand Down
7 changes: 3 additions & 4 deletions src/Vinelab/Minion/Minion.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function run($options = [], LoopInterface $loop = null)

/**
* Get a new Client instance.
*
*
* @param \React\EventLoop\LoopInterface $loop
*
* @return \Vinelab\Minion\Client
Expand Down Expand Up @@ -113,10 +113,9 @@ public function transportUrl()
{
$proto = $this->getConfig('tls') ? 'wss' : 'ws';
$port = intval($this->getConfig('port'));
if($port>0) {
if ($port>0) {
$port = ':'.$port;
}
else {
} else {
$port = '';
}
return $proto.'://'.$this->getConfig('host').$port.$this->getConfig('path');
Expand Down
2 changes: 1 addition & 1 deletion tests/UnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
class UnitTestCase extends PHPUnit\Framework\TestCase
{
public function test_running()
public function test_running(): void
{
$this->asserttrue(true);
}
Expand Down
42 changes: 21 additions & 21 deletions tests/unit/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
*/
class ClientTest extends UnitTestCase
{
public function setUp()
public function setUp(): void
{
parent::setUp();

$this->client = M::mock(new Client('i.the.divine', []));
}

public function tearDown()
public function tearDown(): void
{
M::close();
}

public function test_initializing_sets_providers()
public function test_initializing_sets_providers(): void
{
$providers = ['prov1', 'prov2'];
$c = new Client('julia.dream', $providers);
$this->assertEquals($providers, $c->getProviders());
}

public function test_on_session_start_boots_providers()
public function test_on_session_start_boots_providers(): void
{
$called = [];

Expand All @@ -49,7 +49,7 @@ public function test_on_session_start_boots_providers()
$this->assertInstanceOf('Vinelab\Minion\Client', $called['andMe']);
}

public function test_preparing_topic()
public function test_preparing_topic(): void
{
$this->client->setTopicPrefix('some.topic.prefix.');

Expand All @@ -59,7 +59,7 @@ public function test_preparing_topic()
$this->assertEquals('some.topic.prefix.', $this->client->getTopicPrefix());
}

public function test_subscribing_with_provider_method()
public function test_subscribing_with_provider_method(): void
{
$session = M::mock('Thruway\ClientSession');
$promise = M::mock('React\Promise\Promise');
Expand All @@ -79,7 +79,7 @@ public function test_subscribing_with_provider_method()
$this->assertEquals($promise, $got);
}

public function test_subscribing_with_options()
public function test_subscribing_with_options(): void
{
$session = M::mock('Thruway\ClientSession');
$promise = M::mock('React\Promise\Promise');
Expand All @@ -96,7 +96,7 @@ public function test_subscribing_with_options()
$this->assertEquals($promise, $got);
}

public function test_registering_with_options()
public function test_registering_with_options(): void
{
$session = M::mock('Thruway\ClientSession');

Expand All @@ -115,7 +115,7 @@ public function test_registering_with_options()
$this->assertEquals($promise, $got);
}

public function test_registering_with_function()
public function test_registering_with_function(): void
{
$session = M::mock('Thruway\ClientSession');

Expand All @@ -135,7 +135,7 @@ public function test_registering_with_function()
$this->assertEquals($promise, $got);
}

public function test_registering_prepares_topic()
public function test_registering_prepares_topic(): void
{
$session = M::mock('Thruway\ClientSession');

Expand All @@ -155,7 +155,7 @@ public function test_registering_prepares_topic()
$this->assertEquals($promise, $got);
}

public function test_calling_simple()
public function test_calling_simple(): void
{
$session = M::mock('Thruway\ClientSession');
$promise = M::mock('React\Promise\Promise');
Expand All @@ -171,7 +171,7 @@ public function test_calling_simple()
$this->assertEquals($promise, $got);
}

public function test_calling_full()
public function test_calling_full(): void
{
$topic = 'pub.topic';
$arguments = ['dddddata' => 'hhhhhere'];
Expand All @@ -190,7 +190,7 @@ public function test_calling_full()
$this->assertEquals($promise, $got);
}

public function test_calling_prepares_topic()
public function test_calling_prepares_topic(): void
{
$topic = 'pub.topic';
$prefixed = 'test.test.pub.test.pub.topic';
Expand All @@ -211,7 +211,7 @@ public function test_calling_prepares_topic()
$this->assertEquals($promise, $got);
}

public function test_registering_with_provider_method()
public function test_registering_with_provider_method(): void
{
$session = M::mock('Thruway\ClientSession');

Expand All @@ -231,7 +231,7 @@ public function test_registering_with_provider_method()
$this->assertEquals($promise, $got);
}

public function test_registering_with_closure()
public function test_registering_with_closure(): void
{
$session = M::mock('Thruway\ClientSession');

Expand All @@ -253,7 +253,7 @@ public function test_registering_with_closure()
$this->assertEquals($promise, $got);
}

public function test_publishing_prepares_topic()
public function test_publishing_prepares_topic(): void
{
$topic = 'pub.topic';
$prefixed = 'test.test.pub.test.pub.topic';
Expand All @@ -274,7 +274,7 @@ public function test_publishing_prepares_topic()
$this->assertEquals($promise, $got);
}

public function test_publishing_simple()
public function test_publishing_simple(): void
{
$session = M::mock('Thruway\ClientSession');
$promise = M::mock('React\Promise\Promise');
Expand All @@ -290,7 +290,7 @@ public function test_publishing_simple()
$this->assertEquals($promise, $got);
}

public function test_subscribing_prepares_topic()
public function test_subscribing_prepares_topic(): void
{
$session = M::mock('Thruway\ClientSession');
$promise = M::mock('React\Promise\Promise');
Expand All @@ -307,7 +307,7 @@ public function test_subscribing_prepares_topic()
$this->assertEquals($promise, $got);
}

public function test_subscribing_with_function()
public function test_subscribing_with_function(): void
{
$session = M::mock('Thruway\ClientSession');
$promise = M::mock('React\Promise\Promise');
Expand All @@ -321,7 +321,7 @@ public function test_subscribing_with_function()
$this->assertEquals($promise, $got);
}

public function test_subscribing_with_closure()
public function test_subscribing_with_closure(): void
{
$session = M::mock('Thruway\ClientSession');
$promise = M::mock('React\Promise\Promise');
Expand All @@ -336,7 +336,7 @@ public function test_subscribing_with_closure()
$this->assertEquals($promise, $got);
}

public function test_publishing_full()
public function test_publishing_full(): void
{
$topic = 'pub.topic';
$arguments = ['dddddata' => 'hhhhhere'];
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/DictionaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
*/
class DictionaryTest extends PHPUnit\Framework\TestCase
{
public function test_initializing_dictionary()
public function test_initializing_dictionary(): void
{
$dict = Dictionary::make(['nick' => 'cave', 'back' => 'seeds']);

$this->assertEquals('cave', $dict->nick);
$this->assertEquals('seeds', $dict->back);
}

public function test_initializing_with_object()
public function test_initializing_with_object(): void
{
$data = new StdClass();
$data->into = 'my arms';
Expand All @@ -27,7 +27,7 @@ public function test_initializing_with_object()
$this->assertEquals('angels', $data->believe);
}

public function test_array_representation()
public function test_array_representation(): void
{
$flying = new StdClass();
$flying->wings = 2;
Expand Down Expand Up @@ -55,7 +55,7 @@ public function test_array_representation()
$this->assertEquals($expected, $dict->toArray());
}

public function test_allows_checking_attributes()
public function test_allows_checking_attributes(): void
{
$data = ['lime' => 'tree', 'cherry'];
$dict = Dictionary::make($data);
Expand Down
22 changes: 11 additions & 11 deletions tests/unit/MinionTest.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<?php

use Vinelab\Minion\Minion;
use Vinelab\Minion\InvalidProviderException;

/**
* @author Abed Halawi <abed.halawi@vinelab.com>
*/
class MinionTest extends PHPUnit\Framework\TestCase
{
public function setUp()
public function setUp(): void
{
$this->m = new Minion();
}

/**
* @expectedException Vinelab\Minion\InvalidProviderException
* @expectedExceptionMessage Provider NonProvider must be an instance of \Vinelab\Minion\Provider
*/
public function test_registering_non_provider_fails()
public function test_registering_non_provider_fails(): void
{
$this->expectException(InvalidProviderException::class);
$this->expectExceptionMessage('Provider NonProvider must be an instance of \Vinelab\Minion\Provider');

$this->m->register('NonProvider');
}

public function test_does_not_register_duplicates()
public function test_does_not_register_duplicates(): void
{
$this->m->register('AProvider');
$this->m->register('AProvider');
Expand All @@ -43,12 +43,12 @@ public function test_default_config()
$this->assertEquals($default, $this->m->getConfig());
}

public function test_getting_config_param()
public function test_getting_config_param(): void
{
$this->assertEquals('minion', $this->m->getConfig('realm'));
}

public function test_merging_config()
public function test_merging_config(): void
{
$options = [
'realm' => 'secrets',
Expand All @@ -60,14 +60,14 @@ public function test_merging_config()
$this->assertEquals($merged, $this->m->getConfig());
}

public function test_config_tls()
public function test_config_tls(): void
{
$this->assertEquals(false, $this->m->getConfig('tls'));
$this->m->mergeConfig(['tls'=>true]);
$this->assertEquals(true, $this->m->getConfig('tls'));
}

public function test_config_path()
public function test_config_path(): void
{
$path = '/websocket';
$this->assertEquals('/ws', $this->m->getConfig('path'));
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/ProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
*/
class ProviderTest extends UnitTestCase
{
public function setUp()
public function setUp(): void
{
$this->client = new Client('the-realm', []);
$this->provider = new ProviderStub($this->client);
}

public function tearDown()
public function tearDown(): void
{
M::close();
}

public function test_initializing_sets_client()
public function test_initializing_sets_client(): void
{
$getClient = $this->unProtectMethod('getClient', $this->provider);
$this->assertEquals($this->client, $getClient->invoke($this->provider));
Expand Down