Skip to content

Commit ec2b25d

Browse files
author
Mark Unsworth
committed
bumped dependencies to allow use of symphony dispatcher 5.0, guzzle 7.0 and phpunit 8.0.
1 parent b4f398e commit ec2b25d

File tree

10 files changed

+53
-24
lines changed

10 files changed

+53
-24
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
language: php
22

33
php:
4-
- 7.1
4+
- 7.2
5+
- 7.3
6+
- 7.4
57

68
before_script:
79
- composer self-update

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
"homepage": "https://github.com/CurrencyCloud/currencycloud-php",
1515
"license": "MIT",
1616
"require": {
17-
"php": ">=7.1",
18-
"guzzlehttp/guzzle": "~6.1",
19-
"symfony/yaml": "^2.7|^3.0|^4.0",
20-
"symfony/event-dispatcher": "^2.7|^3.0|^4.0"
17+
"php": ">=7.2",
18+
"guzzlehttp/guzzle": "~6.1||~7.0",
19+
"symfony/yaml": "^2.7||^3.0||^4.0",
20+
"symfony/event-dispatcher": "^5.0"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "~4.7",
23+
"phpunit/phpunit": "^8.0",
2424
"php-vcr/php-vcr": "~1.2",
25-
"php-vcr/phpunit-testlistener-vcr": "~1.1"
25+
"php-vcr/phpunit-testlistener-vcr": "^3.2"
2626
},
2727
"suggest": {
2828

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</testsuites>
1919

2020
<listeners>
21-
<listener class="PHPUnit_Util_Log_VCR" file="vendor/php-vcr/phpunit-testlistener-vcr/PHPUnit/Util/Log/VCR.php" />
21+
<listener class="VCR\PHPUnit\TestListener\VCRTestListener" file="vendor/php-vcr/phpunit-testlistener-vcr/src/VCRTestListener.php" />
2222
</listeners>
2323

2424
<filter>

src/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ public function request(
5858
array $options,
5959
$secured
6060
) {
61-
$this->eventDispatcher->dispatch(BeforeClientRequestEvent::NAME, new BeforeClientRequestEvent(
61+
$this->eventDispatcher->dispatch( new BeforeClientRequestEvent(
6262
$method,
6363
$uri,
6464
$queryParams,
6565
$requestParams,
6666
$options,
6767
$secured
68-
));
68+
), BeforeClientRequestEvent::NAME);
6969

7070
$originalRequest = [
7171
'method' => $method,
@@ -134,7 +134,7 @@ public function request(
134134
$url,
135135
$originalRequest
136136
);
137-
$this->eventDispatcher->dispatch(ClientHttpErrorEvent::NAME, $event);
137+
$this->eventDispatcher->dispatch($event, ClientHttpErrorEvent::NAME);
138138
$interceptedResponse = $event->getInterceptedResponse();
139139
if (null !== $interceptedResponse) {
140140
return $interceptedResponse;

src/EventDispatcher/Event/BeforeClientRequestEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace CurrencyCloud\EventDispatcher\Event;
44

5-
use Symfony\Component\EventDispatcher\Event;
5+
use Symfony\Contracts\EventDispatcher\Event;
66

77
final class BeforeClientRequestEvent extends Event
88
{

src/EventDispatcher/Event/ClientHttpErrorEvent.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
namespace CurrencyCloud\EventDispatcher\Event;
44

55
use Psr\Http\Message\ResponseInterface;
6-
use Symfony\Component\EventDispatcher\Event;
6+
use Symfony\Contracts\EventDispatcher\Event;
7+
78

89
final class ClientHttpErrorEvent extends Event
910
{

tests/BaseCurrencyCloudTestCase.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
use CurrencyCloud\Client;
66
use CurrencyCloud\SimpleEntityManager;
77
use DateTime;
8-
use PHPUnit_Framework_TestCase;
8+
use PHPUnit\Framework\TestCase;
9+
910
use ReflectionClass;
1011

11-
class BaseCurrencyCloudTestCase extends PHPUnit_Framework_TestCase
12+
class BaseCurrencyCloudTestCase extends TestCase
1213
{
1314

1415
/**
@@ -55,7 +56,7 @@ protected function getMockedEntityManager($expectedModel, $changeSet)
5556

5657
protected function validateObjectStrictName($object, $dummy)
5758
{
58-
$this->assertInternalType('object', $object);
59+
$this->assertIsObject( $object);
5960
foreach ($dummy as $key => $original) {
6061
$parts = explode('_', $key);
6162
$uCased = implode('', array_map('ucfirst', $parts));
@@ -125,4 +126,17 @@ protected function setIdProperty($object, $value, $propertyName = 'id')
125126
$property->setAccessible(true);
126127
$property->setValue($object, $value);
127128
}
129+
130+
131+
protected function getMock($className){
132+
return $this->createMock($className);
133+
}
134+
135+
protected function setExpectedException(string $class, string $string=null)
136+
{
137+
$this->expectException($class);
138+
if($string){
139+
$this->expectExceptionMessage($string);
140+
}
141+
}
128142
}

tests/Core/SessionTest.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
use CurrencyCloud\Session;
66
use InvalidArgumentException;
77
use LogicException;
8-
use PHPUnit_Framework_TestCase;
8+
use PHPUnit\Framework\TestCase;
99

10-
class SessionTest extends PHPUnit_Framework_TestCase
10+
11+
class SessionTest extends TestCase
1112
{
1213

1314
/**
1415
* @var Session
1516
*/
1617
private $session;
1718

18-
public function setUp()
19+
public function setUp():void
1920
{
21+
parent::setUp();
2022
$this->session = new Session(Session::ENVIRONMENT_DEMONSTRATION, 'a', 'b');
2123
}
2224

@@ -37,7 +39,10 @@ public function invalidEnvironmentThrowsException()
3739
*/
3840
public function invalidLoginIdThrowsException()
3941
{
40-
$this->setExpectedException(InvalidArgumentException::class, 'Login ID can not be nul');
42+
43+
$this->expectException(InvalidArgumentException::class);
44+
$this->expectExceptionMessage('Login ID can not be null');
45+
4146
new Session(Session::ENVIRONMENT_DEMONSTRATION, null, 'test');
4247
}
4348

@@ -90,4 +95,10 @@ public function onBehalfOfCanBeSetAfterUnset()
9095
$this->session->setOnBehalfOf('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaab');
9196
$this->assertEquals('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaab', $this->session->getOnBehalfOf());
9297
}
98+
99+
private function setExpectedException(string $class, string $string)
100+
{
101+
$this->expectException($class);
102+
$this->expectExceptionMessage($string);
103+
}
93104
}

tests/VCR/Error/Test.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function containsFullDetailForApiError()
6767
$this->assertSame('auth_invalid_user_login_details', $e->getApiCode());
6868

6969
$errors = $e->getErrors();
70-
$this->assertInternalType('array', $errors);
70+
$this->assertIsArray( $errors);
7171
$this->assertArrayHasKey(0, $errors);
7272
$this->assertCount(1, $errors);
7373
$sub = $errors[0];
@@ -83,14 +83,14 @@ public function containsFullDetailForApiError()
8383

8484
$params = $sub['params'];
8585

86-
$this->assertInternalType('array', $params);
86+
$this->assertIsArray( $params);
8787
$this->assertCount(1, $params);
8888
$this->assertArrayHasKey('length', $params);
8989
$this->assertSame(64, $params['length']);
9090

9191
$params = $e->getParameters();
9292

93-
$this->assertInternalType('array', $params);
93+
$this->assertIsArray($params);
9494
$this->assertCount(2, $params);
9595
$this->assertArrayHasKey('login_id', $params);
9696
$this->assertArrayHasKey('api_key', $params);

tests/bootstrap.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use VCR\Request;
44
use CurrencyCloud\Tests\FormDataExtractor;
5+
use VCR\VCR;
56

67
$parametersMatcher = function ($first, $second) {
78
//process and check data sent as form-data via POST
@@ -64,7 +65,7 @@
6465
return $result;
6566
};
6667

67-
\VCR\VCR::configure()
68+
VCR::configure()
6869
->setCassettePath('tests/fixtures/')
6970
->enableRequestMatchers(['url', 'body', 'headers'])
7071
->addRequestMatcher(

0 commit comments

Comments
 (0)