Skip to content

Commit

Permalink
Merge pull request #8 from genkgo/upgrade_guzzle
Browse files Browse the repository at this point in the history
upgrade guzzle to 7
  • Loading branch information
frederikbosch authored Jul 26, 2021
2 parents 041d833 + 167f402 commit f9f531f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
- name: Static analysis for tests
run: ./vendor/bin/phpstan analyse -l max test
- name: Code Style
run: ./vendor/bin/php-cs-fixer fix --dry-run --verbose --config .php_cs.dist ./src ./test
run: ./vendor/bin/php-cs-fixer fix --dry-run --verbose --config .php-cs-fixer.dist.php ./src ./test
2 changes: 1 addition & 1 deletion .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name" : "genkgo/push",
"description": "Send push messages to Android and Apple using one interface.",
"require" : {
"php" : "^7.2",
"php" : "^7.3",
"ext-json" : "*",
"apple/apn-push": "^3.0",
"guzzlehttp/guzzle": "^6.0",
"guzzlehttp/guzzle": "^7.0",
"lcobucci/jwt": "^3.3.1"
},
"require-dev" : {
"phpunit/phpunit": "^8",
"phpunit/phpunit": "^9",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"friendsofphp/php-cs-fixer": "^2.9"
Expand All @@ -26,11 +26,11 @@
},
"scripts": {
"lint": [
"./vendor/bin/php-cs-fixer fix --verbose --config .php_cs.dist ./src ./test"
"./vendor/bin/php-cs-fixer fix --verbose --config .php-cs-fixer.dist.php ./src ./test"
],
"test": [
"./vendor/bin/phpunit -c phpunit.xml",
"./vendor/bin/php-cs-fixer fix --verbose --dry-run --config .php_cs.dist ./src ./test",
"./vendor/bin/php-cs-fixer fix --verbose --dry-run --config .php-cs-fixer.dist.php ./src ./test",
"./vendor/bin/phpstan analyse -l max src",
"./vendor/bin/phpstan analyse -l max -c .phpstan.test.neon test"
]
Expand Down
25 changes: 12 additions & 13 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
colors="true"
verbose="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
>
<testsuite name="GenkgoMail tests">
<directory>./test/Unit</directory>
<directory>./test/Integration</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
beStrictAboutTestsThatDoNotTestAnything="true">
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuite name="GenkgoMail tests">
<directory>./test/Unit</directory>
<directory>./test/Integration</directory>
</testsuite>
</phpunit>
4 changes: 0 additions & 4 deletions test/Integration/CloudMessagingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ public function testDataIsString(): void
{
$provider = $this->createMock(AuthorizationHeaderProviderInterface::class);
$provider
->expects($this->at(0))
->method('__invoke')
->willReturn('Bearer test');

$client = $this->createMock(ClientInterface::class);
$client
->expects($this->at(0))
->method('send')
->with(
$this->callback(
Expand Down Expand Up @@ -59,13 +57,11 @@ public function testForbidden(): void

$provider = $this->createMock(AuthorizationHeaderProviderInterface::class);
$provider
->expects($this->at(0))
->method('__invoke')
->willReturn('Bearer test');

$client = $this->createMock(ClientInterface::class);
$client
->expects($this->at(0))
->method('send')
->willReturnCallback(
function (Request $request) {
Expand Down
8 changes: 5 additions & 3 deletions test/Unit/GatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ public function testSend(): void
$recipient = new AndroidDeviceRecipient('token');

$sender = $this->createMock(SenderInterface::class);
$sender->expects($this->at(0))->method('supports')->with($message, $recipient)->willReturn(true);
$sender->expects($this->at(1))->method('send')->with($message, $recipient);
$sender->method('supports')->with($message, $recipient)->willReturn(true);
$sender->method('send')->with($message, $recipient);

$gateway = new Gateway([$sender]);
$gateway->send($message, $recipient);

$this->addToAssertionCount(1);
}

public function testExceptionUnsupportedSender(): void
Expand All @@ -34,7 +36,7 @@ public function testExceptionUnsupportedSender(): void
$recipient = new AndroidDeviceRecipient('token');

$sender = $this->createMock(SenderInterface::class);
$sender->expects($this->at(0))->method('supports')->with($message, $recipient)->willReturn(false);
$sender->method('supports')->with($message, $recipient)->willReturn(false);

$gateway = new Gateway([$sender]);
$gateway->send($message, $recipient);
Expand Down

0 comments on commit f9f531f

Please sign in to comment.