Skip to content

Commit 5d5ddaa

Browse files
committed
Use ::class notation
1 parent b9b41a1 commit 5d5ddaa

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

src/GatewayTestCase.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Omnipay\Tests;
44

55
use Omnipay\Common\AbstractGateway;
6+
use Omnipay\Common\Message\RequestInterface;
67

78
/**
89
* Base Gateway Test class
@@ -73,7 +74,7 @@ public function testSupportsAuthorize()
7374
$this->assertInternalType('boolean', $supportsAuthorize);
7475

7576
if ($supportsAuthorize) {
76-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->authorize());
77+
$this->assertInstanceOf(RequestInterface::class, $this->gateway->authorize());
7778
} else {
7879
$this->assertFalse(method_exists($this->gateway, 'authorize'));
7980
}
@@ -85,7 +86,7 @@ public function testSupportsCompleteAuthorize()
8586
$this->assertInternalType('boolean', $supportsCompleteAuthorize);
8687

8788
if ($supportsCompleteAuthorize) {
88-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->completeAuthorize());
89+
$this->assertInstanceOf(RequestInterface::class, $this->gateway->completeAuthorize());
8990
} else {
9091
$this->assertFalse(method_exists($this->gateway, 'completeAuthorize'));
9192
}
@@ -97,7 +98,7 @@ public function testSupportsCapture()
9798
$this->assertInternalType('boolean', $supportsCapture);
9899

99100
if ($supportsCapture) {
100-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->capture());
101+
$this->assertInstanceOf(RequestInterface::class, $this->gateway->capture());
101102
} else {
102103
$this->assertFalse(method_exists($this->gateway, 'capture'));
103104
}
@@ -109,7 +110,7 @@ public function testSupportsPurchase()
109110
$this->assertInternalType('boolean', $supportsPurchase);
110111

111112
if ($supportsPurchase) {
112-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->purchase());
113+
$this->assertInstanceOf(RequestInterface::class, $this->gateway->purchase());
113114
} else {
114115
$this->assertFalse(method_exists($this->gateway, 'purchase'));
115116
}
@@ -121,7 +122,7 @@ public function testSupportsCompletePurchase()
121122
$this->assertInternalType('boolean', $supportsCompletePurchase);
122123

123124
if ($supportsCompletePurchase) {
124-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->completePurchase());
125+
$this->assertInstanceOf(RequestInterface::class, $this->gateway->completePurchase());
125126
} else {
126127
$this->assertFalse(method_exists($this->gateway, 'completePurchase'));
127128
}
@@ -133,7 +134,7 @@ public function testSupportsRefund()
133134
$this->assertInternalType('boolean', $supportsRefund);
134135

135136
if ($supportsRefund) {
136-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->refund());
137+
$this->assertInstanceOf(RequestInterface::class, $this->gateway->refund());
137138
} else {
138139
$this->assertFalse(method_exists($this->gateway, 'refund'));
139140
}
@@ -145,7 +146,7 @@ public function testSupportsVoid()
145146
$this->assertInternalType('boolean', $supportsVoid);
146147

147148
if ($supportsVoid) {
148-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->void());
149+
$this->assertInstanceOf(RequestInterface::class, $this->gateway->void());
149150
} else {
150151
$this->assertFalse(method_exists($this->gateway, 'void'));
151152
}
@@ -157,7 +158,7 @@ public function testSupportsCreateCard()
157158
$this->assertInternalType('boolean', $supportsCreate);
158159

159160
if ($supportsCreate) {
160-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->createCard());
161+
$this->assertInstanceOf(RequestInterface::class, $this->gateway->createCard());
161162
} else {
162163
$this->assertFalse(method_exists($this->gateway, 'createCard'));
163164
}
@@ -169,7 +170,7 @@ public function testSupportsDeleteCard()
169170
$this->assertInternalType('boolean', $supportsDelete);
170171

171172
if ($supportsDelete) {
172-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->deleteCard());
173+
$this->assertInstanceOf(RequestInterface::class, $this->gateway->deleteCard());
173174
} else {
174175
$this->assertFalse(method_exists($this->gateway, 'deleteCard'));
175176
}
@@ -181,7 +182,7 @@ public function testSupportsUpdateCard()
181182
$this->assertInternalType('boolean', $supportsUpdate);
182183

183184
if ($supportsUpdate) {
184-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->updateCard());
185+
$this->assertInstanceOf(RequestInterface::class, $this->gateway->updateCard());
185186
} else {
186187
$this->assertFalse(method_exists($this->gateway, 'updateCard'));
187188
}

src/TestCase.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use Mockery as m;
66
use Omnipay\Common\Http\Client;
7+
use Omnipay\Common\Http\ClientInterface;
8+
use Omnipay\Common\Message\RequestInterface;
79
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
810
use Psr\Http\Message\ResponseInterface;
911
use ReflectionObject;
@@ -17,11 +19,16 @@
1719
*/
1820
abstract class TestCase extends PHPUnitTestCase
1921
{
20-
/** @var \Omnipay\Common\Message\RequestInterface */
22+
/** @var RequestInterface */
2123
private $mockRequest;
24+
2225
/** @var MockClient */
2326
private $mockClient;
27+
28+
/** @var ClientInterface */
2429
private $httpClient;
30+
31+
/** @var HttpRequest */
2532
private $httpRequest;
2633

2734
/**
@@ -129,7 +136,7 @@ public function getValidCard()
129136
public function getMockRequest()
130137
{
131138
if (null === $this->mockRequest) {
132-
$this->mockRequest = m::mock('\Omnipay\Common\Message\RequestInterface');
139+
$this->mockRequest = m::mock(RequestInterface::class);
133140
}
134141

135142
return $this->mockRequest;

0 commit comments

Comments
 (0)