Skip to content

Commit a366c9b

Browse files
authored
Merge pull request #10 from mirko-bukilic/master
Replace zendframework with laminas packages
2 parents 56d1f17 + a4d65af commit a366c9b

19 files changed

Lines changed: 77 additions & 74 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ composer.lock
1111
vendor
1212

1313
tests/unit/coverage/*
14+
tests/unit/.phpunit.result.cache
1415

1516
.DS_Store
1617
.buildpath

composer.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,18 @@
2323
}
2424
],
2525
"autoload": {
26-
"psr-4": {"G4\\Gateway\\": "src/"}
26+
"psr-4": {
27+
"G4\\Gateway\\": "src/"
28+
}
2729
},
2830
"require-dev": {
29-
"phpunit/phpunit": "4.8.*"
31+
"phpunit/phpunit": "9.*"
3032
},
3133
"require": {
32-
"php" : ">=5.6",
33-
"g4/constants" : "*",
34-
"g4/profiler" : ">=1.10.0",
35-
"zendframework/zend-http": "2.9.*",
36-
"g4/value-object" : "*"
34+
"php": ">=7.3",
35+
"g4/constants": "*",
36+
"g4/profiler": ">=1.10.0",
37+
"laminas/laminas-http": "2.14.*",
38+
"g4/value-object": "*"
3739
}
3840
}

src/Client/ComplexHttpClient.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class ComplexHttpClient implements HttpClientInterface
1111
{
1212
/**
13-
* @var \Zend\Http\Client
13+
* @var \Laminas\Http\Client
1414
*/
1515
private $client;
1616

@@ -34,16 +34,16 @@ public function __construct(Options $options)
3434
}
3535

3636
/**
37-
* @return \Zend\Http\Client
37+
* @return \Laminas\Http\Client
3838
*/
3939
public function getClient()
4040
{
41-
if (! $this->client instanceof \Zend\Http\Client) {
41+
if (! $this->client instanceof \Laminas\Http\Client) {
4242

43-
$this->client = new \Zend\Http\Client();
43+
$this->client = new \Laminas\Http\Client();
4444
$this->client
45-
->setAdapter('\Zend\Http\Client\Adapter\Curl')
46-
->setEncType(\Zend\Http\Client::ENC_URLENCODED)
45+
->setAdapter('\Laminas\Http\Client\Adapter\Curl')
46+
->setEncType(\Laminas\Http\Client::ENC_URLENCODED)
4747
->setOptions([
4848
'timeout' => $this->options->getTimeout(),
4949
'curloptions' => $this->getCurlOptions(),

src/Client/ComplexResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace G4\Gateway\Client;
44

55
use G4\Gateway\Url;
6-
use Zend\Http\Response as ClientResponse;
6+
use Laminas\Http\Response as ClientResponse;
77

88
class ComplexResponse implements ClientResponseInterface
99
{

tests/unit/src/Client/ComplexHttpClientTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
use G4\Gateway\Client\ComplexHttpClient;
44

5-
class ComplexHttpClientTest extends PHPUnit_Framework_TestCase
5+
class ComplexHttpClientTest extends \PHPUnit\Framework\TestCase
66
{
77
/**
88
* @var ComplexHttpClient
99
*/
1010
private $client;
1111

1212
/**
13-
* @var \PHPUnit_Framework_MockObject_MockObject
13+
* @var \PHPUnit\Framework\MockObject\MockObject
1414
*/
1515
private $optionsMock;
1616
private $urlValue = 'http://google.com';
1717
private $methodValue = 'GET';
1818
private $paramsValue = ['id' => 123];
1919

20-
protected function setUp()
20+
protected function setUp(): void
2121
{
2222
$this->optionsMock = $this->getMockBuilder('\G4\Gateway\Options')
2323
->disableOriginalConstructor()
@@ -35,7 +35,7 @@ protected function setUp()
3535
$this->client = new ComplexHttpClient($this->optionsMock);
3636
}
3737

38-
protected function tearDown()
38+
protected function tearDown(): void
3939
{
4040
$this->optionsMock = null;
4141
$this->client = null;
@@ -58,7 +58,7 @@ public function testGetClient()
5858
->method('getHeaders')
5959
->willReturn([]);
6060

61-
$this->assertInstanceOf('\Zend\Http\Client', $this->client->getClient());
61+
$this->assertInstanceOf('\Laminas\Http\Client', $this->client->getClient());
6262
}
6363

6464
public function testGetProfiler()

tests/unit/src/Client/ComplexResponseTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22

33
use G4\Gateway\Url;
4-
use Zend\Http\Headers;
5-
use Zend\Http\AbstractMessage;
4+
use Laminas\Http\Headers;
5+
use Laminas\Http\AbstractMessage;
66
use G4\Gateway\Client\ComplexResponse;
7-
use Zend\Http\Response as ClientResponse;
7+
use Laminas\Http\Response as ClientResponse;
88

9-
class ComplexResponseTest extends PHPUnit_Framework_TestCase
9+
class ComplexResponseTest extends \PHPUnit\Framework\TestCase
1010
{
1111
/**
12-
* @var \PHPUnit_Framework_MockObject_MockObject
12+
* @var \PHPUnit\Framework\MockObject\MockObject
1313
*/
1414
private $clientResponseMock;
1515

@@ -19,16 +19,16 @@ class ComplexResponseTest extends PHPUnit_Framework_TestCase
1919
private $response;
2020

2121
/**
22-
* @var \PHPUnit_Framework_MockObject_MockObject
22+
* @var \PHPUnit\Framework\MockObject\MockObject
2323
*/
2424
private $headersMock;
2525

2626
/**
27-
* @var \PHPUnit_Framework_MockObject_MockObject
27+
* @var \PHPUnit\Framework\MockObject\MockObject
2828
*/
2929
private $urlMock;
3030

31-
protected function setUp()
31+
protected function setUp(): void
3232
{
3333
$this->clientResponseMock = $this->getMockBuilder(ClientResponse::class)
3434
->disableOriginalConstructor()
@@ -45,7 +45,7 @@ protected function setUp()
4545
$this->response = new ComplexResponse($this->clientResponseMock, $this->urlMock);
4646
}
4747

48-
protected function tearDown()
48+
protected function tearDown(): void
4949
{
5050
$this->clientResponseMock = null;
5151
$this->urlMock = null;

tests/unit/src/Client/HttpClientFactoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
use G4\Gateway\Options;
44
use G4\Gateway\Client\HttpClientFactory;
55

6-
class HttpClientFactoryTest extends PHPUnit_Framework_TestCase
6+
class HttpClientFactoryTest extends \PHPUnit\Framework\TestCase
77
{
88
/**
99
* @var Options
1010
*/
1111
private $options;
1212

13-
protected function setUp()
13+
protected function setUp(): void
1414
{
1515
$this->options = new Options();
1616
}
1717

18-
protected function tearDown()
18+
protected function tearDown(): void
1919
{
2020
$this->options = null;
2121
}

tests/unit/src/Client/SimpleHttpClientTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use G4\Gateway\Params;
66
use G4\Gateway\Options;
77

8-
class SimpleHttpClientTest extends PHPUnit_Framework_TestCase
8+
class SimpleHttpClientTest extends \PHPUnit\Framework\TestCase
99
{
1010
/**
1111
* @var SimpleHttpClient
@@ -25,7 +25,7 @@ class SimpleHttpClientTest extends PHPUnit_Framework_TestCase
2525

2626
private $urlValue = 'https://www.google.com';
2727

28-
protected function setUp()
28+
protected function setUp(): void
2929
{
3030
$this->optionsMock = $this->getMockBuilder('\G4\Gateway\Options')
3131
->disableOriginalConstructor()
@@ -38,7 +38,7 @@ protected function setUp()
3838
$this->client = new SimpleHttpClient($this->optionsMock);
3939
}
4040

41-
protected function tearDown()
41+
protected function tearDown(): void
4242
{
4343
$this->client = null;
4444
$this->optionsMock = null;
@@ -55,7 +55,7 @@ public function testSend()
5555
public function testSendException()
5656
{
5757
$this->urlValue = 'fake-test-something-90274.com';
58-
$this->setExpectedException('\Exception');
58+
$this->expectException('\Exception');
5959
$this->client->send($this->urlMock(), $this->methodMock());
6060
}
6161

tests/unit/src/Client/SimpleResponseTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
use G4\ValueObject\IntegerNumber;
55
use G4\Gateway\Client\SimpleResponse;
66

7-
class SimpleResponseTest extends PHPUnit_Framework_TestCase
7+
class SimpleResponseTest extends \PHPUnit\Framework\TestCase
88
{
99
/**
1010
* @var SimpleResponse
1111
*/
1212
private $response;
1313

1414
/**
15-
* @var \PHPUnit_Framework_MockObject_MockObject
15+
* @var \PHPUnit\Framework\MockObject\MockObject
1616
*/
1717
private $urlMock;
1818

@@ -26,7 +26,7 @@ class SimpleResponseTest extends PHPUnit_Framework_TestCase
2626
*/
2727
private $statusCodeMock;
2828

29-
protected function setUp()
29+
protected function setUp(): void
3030
{
3131
$this->urlMock = $this->getMockBuilder(Url::class)
3232
->disableOriginalConstructor()
@@ -49,7 +49,7 @@ protected function setUp()
4949
$this->response = new SimpleResponse($this->body, $this->statusCodeMock, $this->urlMock);
5050
}
5151

52-
protected function tearDown()
52+
protected function tearDown(): void
5353
{
5454
$this->urlMock = null;
5555
$this->statusCodeMock = null;

tests/unit/src/FullRequestInfoMapTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use G4\Gateway\FullRequestInfo;
44
use G4\Gateway\FullRequestInfoMap;
55

6-
class FullRequestInfoMapTest extends PHPUnit_Framework_TestCase
6+
class FullRequestInfoMapTest extends \PHPUnit\Framework\TestCase
77
{
88

99
private $fullRequestInfoMock;
@@ -16,7 +16,7 @@ class FullRequestInfoMapTest extends PHPUnit_Framework_TestCase
1616
private $responseHeaders = ['response' => 'something'];
1717
private $responseBody = 'success';
1818

19-
protected function setUp()
19+
protected function setUp(): void
2020
{
2121
$this->fullRequestInfoMock = $this->getMockBuilder(FullRequestInfo::class)
2222
->disableOriginalConstructor()
@@ -30,7 +30,7 @@ protected function setUp()
3030
$this->fullRequestInfoMock->expects($this->once())->method('getResponseBody')->willReturn($this->responseBody);
3131
}
3232

33-
protected function tearDown()
33+
protected function tearDown(): void
3434
{
3535
$this->fullRequestInfoMock = null;
3636
}

0 commit comments

Comments
 (0)