Content-Length: 930839 | pFad | http://github.com/Payum/PaypalRest/commit/7b6fd14f1c362be286f4f652ae23bfbd8049cd01

46 Add PHPUnit CS rule · Payum/PaypalRest@7b6fd14 · GitHub
Skip to content

Commit 7b6fd14

Browse files
committed
Add PHPUnit CS rule
1 parent 8a80ed2 commit 7b6fd14

File tree

7 files changed

+28
-120
lines changed

7 files changed

+28
-120
lines changed

Action/CaptureAction.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public function __construct()
3535
$this->apiClass = ApiContext::class;
3636
}
3737

38-
/**
39-
* {@inheritDoc}
40-
*/
4138
public function execute($request)
4239
{
4340
/** @var $request Capture */
@@ -112,13 +109,9 @@ public function execute($request)
112109
}
113110
}
114111

115-
/**
116-
* {@inheritDoc}
117-
*/
118112
public function supports($request)
119113
{
120-
return
121-
$request instanceof Capture &&
114+
return $request instanceof Capture &&
122115
($request->getModel() instanceof PaypalPayment || $request->getModel() instanceof \ArrayAccess)
123116
;
124117
}
@@ -148,7 +141,7 @@ private function captureArrayAccess(\ArrayAccess $model, Capture $request): Payp
148141

149142
$cancelUri = HttpUri::createFromString($returnUrl);
150143
$redirectUrls->setReturnUrl($returnUrl)
151-
->setCancelUrl((string) UriModifier::mergeQuery($cancelUri, 'cancelled=1'));
144+
->setCancelUrl((string) UriModifier::mergeQuery($cancelUri, 'cancelled=1'));
152145

153146
$payment = new PaypalPayment();
154147
$payment->setIntent('sale')

Action/ConvertAction.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ class ConvertAction implements ActionInterface, GatewayAwareInterface
1717
{
1818
use GatewayAwareTrait;
1919

20-
/**
21-
* {@inheritDoc}
22-
*/
2320
public function execute($request)
2421
{
2522
RequestNotSupportedException::assertSupports($this, $request);
@@ -42,13 +39,9 @@ public function execute($request)
4239
$request->setResult((array) $details);
4340
}
4441

45-
/**
46-
* {@inheritDoc}
47-
*/
4842
public function supports($request)
4943
{
50-
return
51-
$request instanceof Convert &&
44+
return $request instanceof Convert &&
5245
$request->getSource() instanceof PaymentInterface &&
5346
$request->getTo() == 'array'
5447
;

PaypalRestGatewayFactory.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
class PaypalRestGatewayFactory extends GatewayFactory
1616
{
17-
/**
18-
* {@inheritDoc}
19-
*/
2017
protected function populateConfig(ArrayObject $config)
2118
{
2219
if (false == class_exists(ApiContext::class)) {

Tests/Action/CaptureActionTest.php

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111

1212
class CaptureActionTest extends \PHPUnit\Framework\TestCase
1313
{
14-
/**
15-
* @test
16-
*/
17-
public function shouldSupportCaptureWithPaymentSdkModel()
14+
public function testShouldSupportCaptureWithPaymentSdkModel()
1815
{
1916
$action = new CaptureAction();
2017

@@ -25,10 +22,7 @@ public function shouldSupportCaptureWithPaymentSdkModel()
2522
$this->assertTrue($action->supports($request));
2623
}
2724

28-
/**
29-
* @test
30-
*/
31-
public function shouldSupportCaptureWithArrayObjectModel()
25+
public function testShouldSupportCaptureWithArrayObjectModel()
3226
{
3327
$action = new CaptureAction();
3428

@@ -39,10 +33,7 @@ public function shouldSupportCaptureWithArrayObjectModel()
3933
$this->assertTrue($action->supports($request));
4034
}
4135

42-
/**
43-
* @test
44-
*/
45-
public function shouldNotSupportCapturePaymentSdkModel()
36+
public function testShouldNotSupportCapturePaymentSdkModel()
4637
{
4738
$action = new CaptureAction();
4839

@@ -51,31 +42,22 @@ public function shouldNotSupportCapturePaymentSdkModel()
5142
$this->assertFalse($action->supports($request));
5243
}
5344

54-
/**
55-
* @test
56-
*/
57-
public function throwIfNotSupportedRequestGivenAsArgumentForExecute()
45+
public function testThrowIfNotSupportedRequestGivenAsArgumentForExecute()
5846
{
5947
$this->expectException(\Payum\Core\Exception\RequestNotSupportedException::class);
6048
$action = new CaptureAction();
6149

6250
$action->execute(new \stdClass());
6351
}
6452

65-
/**
66-
* @test
67-
*/
68-
public function shouldNotSupportNotCapture()
53+
public function testShouldNotSupportNotCapture()
6954
{
7055
$action = new CaptureAction();
7156

7257
$this->assertFalse($action->supports(new \stdClass()));
7358
}
7459

75-
/**
76-
* @test
77-
*/
78-
public function shouldSupportCapture()
60+
public function testShouldSupportCapture()
7961
{
8062
$action = new CaptureAction();
8163

@@ -85,10 +67,7 @@ public function shouldSupportCapture()
8567
$this->assertTrue($action->supports(new Capture(new \ArrayObject())));
8668
}
8769

88-
/**
89-
* @test
90-
*/
91-
public function throwIfNotSupportedApiContext()
70+
public function testThrowIfNotSupportedApiContext()
9271
{
9372
$this->expectException(\Payum\Core\Exception\UnsupportedApiException::class);
9473
$action = new CaptureAction();

Tests/Action/ConvertActionTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ public function provideNotSupportedRequests(): \Iterator
3535
yield array(new $this->requestClass($this->createMock(PaymentInterface::class), 'foobar'));
3636
}
3737

38-
/**
39-
* @test
40-
*/
41-
public function shouldCorrectlyConvertOrderToDetailsAndSetItBack()
38+
public function testShouldCorrectlyConvertOrderToDetailsAndSetItBack()
4239
{
4340
$payment = new Payment();
4441
$payment->setNumber('theNumber');
@@ -83,10 +80,7 @@ public function shouldCorrectlyConvertOrderToDetailsAndSetItBack()
8380
$this->assertSame('https://example.com', $details['return_url']);
8481
}
8582

86-
/**
87-
* @test
88-
*/
89-
public function shouldNotOverwriteAlreadySetExtraDetails()
83+
public function testShouldNotOverwriteAlreadySetExtraDetails()
9084
{
9185
$payment = new Payment();
9286
$payment->setCurrencyCode('USD');

Tests/Action/StatusActionTest.php

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,14 @@
88

99
class StatusActionTest extends \PHPUnit\Framework\TestCase
1010
{
11-
/**
12-
* @test
13-
*/
14-
public function shouldImplementsActionInterface()
11+
public function testShouldImplementsActionInterface()
1512
{
1613
$rc = new \ReflectionClass('Payum\Paypal\Rest\Action\StatusAction');
1714

1815
$this->assertTrue($rc->implementsInterface('Payum\Core\Action\ActionInterface'));
1916
}
2017

21-
/**
22-
* @test
23-
*/
24-
public function shouldNotSupportStatusRequestWithNoPaymentAsModel()
18+
public function testShouldNotSupportStatusRequestWithNoPaymentAsModel()
2519
{
2620
$action = new StatusAction();
2721

@@ -30,10 +24,7 @@ public function shouldNotSupportStatusRequestWithNoPaymentAsModel()
3024
$this->assertFalse($action->supports($request));
3125
}
3226

33-
/**
34-
* @test
35-
*/
36-
public function shouldSupportStatusRequestWithArrayObjectAsModel()
27+
public function testShouldSupportStatusRequestWithArrayObjectAsModel()
3728
{
3829
$action = new StatusAction();
3930

@@ -42,31 +33,22 @@ public function shouldSupportStatusRequestWithArrayObjectAsModel()
4233
$this->assertTrue($action->supports($request));
4334
}
4435

45-
/**
46-
* @test
47-
*/
48-
public function shouldNotSupportAnythingNotStatusRequest()
36+
public function testShouldNotSupportAnythingNotStatusRequest()
4937
{
5038
$action = new StatusAction();
5139

5240
$this->assertFalse($action->supports(new \stdClass()));
5341
}
5442

55-
/**
56-
* @test
57-
*/
58-
public function throwIfNotSupportedRequestGivenAsArgumentForExecute()
43+
public function testThrowIfNotSupportedRequestGivenAsArgumentForExecute()
5944
{
6045
$this->expectException(\Payum\Core\Exception\RequestNotSupportedException::class);
6146
$action = new StatusAction();
6247

6348
$action->execute(new \stdClass());
6449
}
6550

66-
/**
67-
* @test
68-
*/
69-
public function shouldMarkPendingIfStateCreated()
51+
public function testShouldMarkPendingIfStateCreated()
7052
{
7153
$action = new StatusAction();
7254

@@ -87,10 +69,7 @@ public function shouldMarkPendingIfStateCreated()
8769
$this->assertTrue($request->isPending());
8870
}
8971

90-
/**
91-
* @test
92-
*/
93-
public function shouldMarkNewIfStateNotSet()
72+
public function testShouldMarkNewIfStateNotSet()
9473
{
9574
$action = new StatusAction();
9675

@@ -110,10 +89,7 @@ public function shouldMarkNewIfStateNotSet()
11089
$this->assertTrue($request->isNew());
11190
}
11291

113-
/**
114-
* @test
115-
*/
116-
public function shouldMarkCapturedIfStateApproved()
92+
public function testShouldMarkCapturedIfStateApproved()
11793
{
11894
$action = new StatusAction();
11995

@@ -134,10 +110,7 @@ public function shouldMarkCapturedIfStateApproved()
134110
$this->assertTrue($request->isCaptured());
135111
}
136112

137-
/**
138-
* @test
139-
*/
140-
public function shouldMarkCanceledIfStateCanceled()
113+
public function testShouldMarkCanceledIfStateCanceled()
141114
{
142115
$action = new StatusAction();
143116

@@ -158,10 +131,7 @@ public function shouldMarkCanceledIfStateCanceled()
158131
$this->assertTrue($request->isCanceled());
159132
}
160133

161-
/**
162-
* @test
163-
*/
164-
public function shouldMarkUnknownIfStateIsSetAndSetUnknown()
134+
public function testShouldMarkUnknownIfStateIsSetAndSetUnknown()
165135
{
166136
$action = new StatusAction();
167137

Tests/PaypalRestGatewayFactoryTest.php

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ protected function getRequiredOptions(): array
2121
];
2222
}
2323

24-
/**
25-
* @test
26-
*/
27-
public function shouldAllowCreateGatewayWithCustomConfig()
24+
public function testShouldAllowCreateGatewayWithCustomConfig()
2825
{
2926
$factory = new PaypalRestGatewayFactory();
3027

@@ -59,10 +56,7 @@ public function shouldAllowCreateGatewayWithCustomConfig()
5956
}
6057
}
6158

62-
/**
63-
* @test
64-
*/
65-
public function shouldAddDefaultConfigPassedInConstructorWhileCreatingGatewayConfig()
59+
public function testShouldAddDefaultConfigPassedInConstructorWhileCreatingGatewayConfig()
6660
{
6761
$factory = new PaypalRestGatewayFactory([
6862
'foo' => 'fooVal',
@@ -80,10 +74,7 @@ public function shouldAddDefaultConfigPassedInConstructorWhileCreatingGatewayCon
8074
$this->assertSame('barVal', $config['bar']);
8175
}
8276

83-
/**
84-
* @test
85-
*/
86-
public function shouldConfigContainDefaultOptions()
77+
public function testShouldConfigContainDefaultOptions()
8778
{
8879
$factory = new PaypalRestGatewayFactory();
8980

@@ -95,10 +86,7 @@ public function shouldConfigContainDefaultOptions()
9586
$this->assertEquals(['client_id' => '', 'client_secret' => '', 'config_path' => '', 'config' => []], $config['payum.default_options']);
9687
}
9788

98-
/**
99-
* @test
100-
*/
101-
public function shouldConfigContainFactoryNameAndTitle()
89+
public function testShouldConfigContainFactoryNameAndTitle()
10290
{
10391
$factory = new PaypalRestGatewayFactory();
10492

@@ -113,10 +101,7 @@ public function shouldConfigContainFactoryNameAndTitle()
113101
$this->assertSame('PayPal Rest', $config['payum.factory_title']);
114102
}
115103

116-
/**
117-
* @test
118-
*/
119-
public function shouldThrowIfRequiredOptionsNotPassed()
104+
public function testShouldThrowIfRequiredOptionsNotPassed()
120105
{
121106
$this->expectException(\Payum\Core\Exception\LogicException::class);
122107
$this->expectExceptionMessage('The client_id, client_secret fields are required.');
@@ -125,10 +110,7 @@ public function shouldThrowIfRequiredOptionsNotPassed()
125110
$factory->create();
126111
}
127112

128-
/**
129-
* @test
130-
*/
131-
public function shouldThrowIfConfigPathOptionsNotEqualPaypalPath()
113+
public function testShouldThrowIfConfigPathOptionsNotEqualPaypalPath()
132114
{
133115
define('PP_CONFIG_PATH', __DIR__);
134116
$this->expectException(\Payum\Core\Exception\InvalidArgumentException::class);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/Payum/PaypalRest/commit/7b6fd14f1c362be286f4f652ae23bfbd8049cd01

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy