Skip to content

Commit 6d0bddf

Browse files
committed
Merge pull request #50 from pilot/renaming
Globar renamed store/create, unstore/delete gateway requests
2 parents 12337bd + a1dadb2 commit 6d0bddf

File tree

2 files changed

+58
-29
lines changed

2 files changed

+58
-29
lines changed

src/Omnipay/Common/AbstractGateway.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,33 +170,33 @@ public function supportsVoid()
170170
}
171171

172172
/**
173-
* Supports Store
173+
* Supports CreateCard
174174
*
175-
* @return boolean True if this gateway supports the store() method
175+
* @return boolean True if this gateway supports the create() method
176176
*/
177-
public function supportsStore()
177+
public function supportsCreateCard()
178178
{
179-
return method_exists($this, 'store');
179+
return method_exists($this, 'createCard');
180180
}
181181

182182
/**
183-
* Supports Unstore
183+
* Supports DeleteCard
184184
*
185-
* @return boolean True if this gateway supports the unstore() method
185+
* @return boolean True if this gateway supports the delete() method
186186
*/
187-
public function supportsUnstore()
187+
public function supportsDeleteCard()
188188
{
189-
return method_exists($this, 'unstore');
189+
return method_exists($this, 'deleteCard');
190190
}
191191

192192
/**
193-
* Supports Update
193+
* Supports UpdateCard
194194
*
195195
* @return boolean True if this gateway supports the update() method
196196
*/
197-
public function supportsUpdate()
197+
public function supportsUpdateCard()
198198
{
199-
return method_exists($this, 'update');
199+
return method_exists($this, 'updateCard');
200200
}
201201

202202
/**

tests/Omnipay/GatewayTestCase.php

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,39 @@ public function testSupportsVoid()
149149
}
150150
}
151151

152-
public function testSupportsStore()
152+
public function testSupportsCreateCard()
153153
{
154-
$supportsStore = $this->gateway->supportsStore();
155-
$this->assertInternalType('boolean', $supportsStore);
154+
$supportsCreate = $this->gateway->supportsCreateCard();
155+
$this->assertInternalType('boolean', $supportsCreate);
156156

157-
if ($supportsStore) {
158-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->store());
157+
if ($supportsCreate) {
158+
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->createCard());
159159
} else {
160-
$this->assertFalse(method_exists($this->gateway, 'store'));
160+
$this->assertFalse(method_exists($this->gateway, 'createCard'));
161161
}
162162
}
163163

164-
public function testSupportsUnstore()
164+
public function testSupportsDeleteCard()
165165
{
166-
$supportsUnstore = $this->gateway->supportsUnstore();
167-
$this->assertInternalType('boolean', $supportsUnstore);
166+
$supportsDelete = $this->gateway->supportsDeleteCard();
167+
$this->assertInternalType('boolean', $supportsDelete);
168168

169-
if ($supportsUnstore) {
170-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->unstore());
169+
if ($supportsDelete) {
170+
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->deleteCard());
171171
} else {
172-
$this->assertFalse(method_exists($this->gateway, 'unstore'));
172+
$this->assertFalse(method_exists($this->gateway, 'deleteCard'));
173+
}
174+
}
175+
176+
public function testSupportsUpdateCard()
177+
{
178+
$supportsUpdate = $this->gateway->supportsUpdateCard();
179+
$this->assertInternalType('boolean', $supportsUpdate);
180+
181+
if ($supportsUpdate) {
182+
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->updateCard());
183+
} else {
184+
$this->assertFalse(method_exists($this->gateway, 'updateCard'));
173185
}
174186
}
175187

@@ -290,9 +302,26 @@ public function testVoidParameters()
290302
}
291303
}
292304

293-
public function testStoreParameters()
305+
public function testCreateCardParameters()
306+
{
307+
if ($this->gateway->supportsCreateCard()) {
308+
foreach ($this->gateway->getDefaultParameters() as $key => $default) {
309+
// set property on gateway
310+
$getter = 'get'.ucfirst($key);
311+
$setter = 'set'.ucfirst($key);
312+
$value = uniqid();
313+
$this->gateway->$setter($value);
314+
315+
// request should have matching property, with correct value
316+
$request = $this->gateway->createCard();
317+
$this->assertSame($value, $request->$getter());
318+
}
319+
}
320+
}
321+
322+
public function testDeleteCardParameters()
294323
{
295-
if ($this->gateway->supportsStore()) {
324+
if ($this->gateway->supportsDeleteCard()) {
296325
foreach ($this->gateway->getDefaultParameters() as $key => $default) {
297326
// set property on gateway
298327
$getter = 'get'.ucfirst($key);
@@ -301,15 +330,15 @@ public function testStoreParameters()
301330
$this->gateway->$setter($value);
302331

303332
// request should have matching property, with correct value
304-
$request = $this->gateway->store();
333+
$request = $this->gateway->deleteCard();
305334
$this->assertSame($value, $request->$getter());
306335
}
307336
}
308337
}
309338

310-
public function testUnstoreParameters()
339+
public function testUpdateCardParameters()
311340
{
312-
if ($this->gateway->supportsUnstore()) {
341+
if ($this->gateway->supportsUpdateCard()) {
313342
foreach ($this->gateway->getDefaultParameters() as $key => $default) {
314343
// set property on gateway
315344
$getter = 'get'.ucfirst($key);
@@ -318,7 +347,7 @@ public function testUnstoreParameters()
318347
$this->gateway->$setter($value);
319348

320349
// request should have matching property, with correct value
321-
$request = $this->gateway->unstore();
350+
$request = $this->gateway->updateCard();
322351
$this->assertSame($value, $request->$getter());
323352
}
324353
}

0 commit comments

Comments
 (0)