Skip to content

Commit 569bd90

Browse files
committed
Code style fixes, added scripts to composer.json
1 parent 5ceddd5 commit 569bd90

File tree

9 files changed

+34
-18
lines changed

9 files changed

+34
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/tools/
44

55
.idea
6+
.php_cs.cache

.php_cs.dist

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->exclude('somedir')
5+
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
6+
->in(__DIR__ . DIRECTORY_SEPARATOR . 'src')
7+
->in(__DIR__ . DIRECTORY_SEPARATOR . 'tests')
8+
;
9+
10+
return PhpCsFixer\Config::create()
11+
->setRules([
12+
'@PSR2' => true,
13+
'array_syntax' => ['syntax' => 'short'],
14+
])
15+
->setFinder($finder)
16+
;

composer.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,19 @@
3939
"MiamiOH\\SnsHandler\\ServiceProvider"
4040
]
4141
}
42+
},
43+
"scripts": {
44+
"phpcs-7.3": [
45+
"phpcs -p src --standard=PHPCompatibility --runtime-set testVersion 7.3"
46+
],
47+
"phpcs-7.4": [
48+
"phpcs -p src --standard=PHPCompatibility --runtime-set testVersion 7.4"
49+
],
50+
"cs-fix": [
51+
"php-cs-fixer fix --diff"
52+
],
53+
"phpstan": [
54+
"phpstan analyze"
55+
]
4256
}
4357
}

src/ServiceProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace MiamiOH\SnsHandler;
55

6-
76
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
87
use MiamiOH\SnsHandler\Controllers\SnsMessageController;
98

src/SnsBroker.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Illuminate\Support\Facades\Http;
99
use Illuminate\Support\Facades\Log;
1010

11-
1211
class SnsBroker
1312
{
1413
/**
@@ -19,10 +18,6 @@ class SnsBroker
1918
* @var MessageValidator
2019
*/
2120
private $validator;
22-
/**
23-
* @var HttpClient
24-
*/
25-
private $httpClient;
2621
/**
2722
* @var Log
2823
*/
@@ -66,6 +61,7 @@ public function handleRequest(SnsHttpRequest $request): void
6661

6762
case SnsMessage::SUBSCRIBE_TYPE:
6863
Log::info(sprintf('Confirming subscription to topic %s', $message->topicArn()));
64+
//TODO Make this work with Laravel 6, as the Http facade was introduced in Laravel 7
6965
$response = Http::get($message->subscribeUrl());
7066
if ($response->successful()) {
7167
return;

tests/Feature/SnsHandlerTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Tests\MiamiOH\SnsHandler\MakesSnsTests;
1313
use Tests\MiamiOH\SnsHandler\Unit\SnsMessageHandlerStub;
1414

15-
1615
class SnsHandlerTest extends \Tests\MiamiOH\SnsHandler\TestCase
1716
{
1817
use MakesSnsTests;
@@ -37,8 +36,6 @@ protected function getPackageProviders($app)
3736

3837
public function testReturnsNotFoundForUnknownTopicArn(): void
3938
{
40-
41-
4239
$data = $this->makeSnsMessageData([
4340
'Type' => SnsMessage::NOTIFICATION_TYPE,
4441
'TopicArn' => 'arn:aws:sns:us-west-2:123456789012:Unknown',
@@ -76,7 +73,6 @@ public function testRespondsWithOkAfterConfirmsSubscription(): void
7673
]);
7774

7875
$response = $this->postJson('/sns/message', $data);
79-
print_r($response->getContent());
8076

8177
$this->assertEquals(200, $response->status());
8278
}

tests/TestCase.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
namespace Tests\MiamiOH\SnsHandler;
55

6-
76
class TestCase extends \Orchestra\Testbench\TestCase
87
{
9-
10-
}
8+
}

tests/Unit/SnsBrokerTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
use Tests\MiamiOH\SnsHandler\TestCase;
1616
use Illuminate\Support\Facades\Http;
1717

18-
19-
2018
class SnsBrokerTest extends TestCase
2119
{
2220
use MakesSnsTests;
@@ -89,7 +87,7 @@ public function testConfirmsSubscriptionUsingSubscribeUrl(): void
8987
'SubscribeURL' => 'https://aws.amazon.com/subscribe/123',
9088
]));
9189

92-
Http::fake(['https://aws.amazon.com/subscribe/123' => Http::response([], 200,[])]);
90+
Http::fake(['https://aws.amazon.com/subscribe/123' => Http::response([], 200, [])]);
9391

9492
$this->broker->handleRequest($request);
9593
}
@@ -140,5 +138,4 @@ public function testValidatesSnsMessage(): void
140138

141139
$this->broker->handleRequest($request);
142140
}
143-
144141
}

tests/Unit/SnsMessageTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Tests\MiamiOH\SnsHandler\MakesSnsTests;
88
use Tests\MiamiOH\SnsHandler\TestCase;
99

10-
1110
class SnsMessageTest extends TestCase
1211
{
1312
use MakesSnsTests;

0 commit comments

Comments
 (0)