diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index 3079004..b6e51f1 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -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 \ No newline at end of file + run: ./vendor/bin/php-cs-fixer fix --dry-run --verbose --config .php-cs-fixer.dist.php ./src ./test \ No newline at end of file diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php similarity index 93% rename from .php_cs.dist rename to .php-cs-fixer.dist.php index 0095783..6ca871f 100644 --- a/.php_cs.dist +++ b/.php-cs-fixer.dist.php @@ -1,5 +1,5 @@ setRules([ '@PSR2' => true, 'array_syntax' => ['syntax' => 'short'], diff --git a/composer.json b/composer.json index c917890..73dd4ac 100644 --- a/composer.json +++ b/composer.json @@ -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" @@ -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" ] diff --git a/phpunit.xml b/phpunit.xml index e31a6c6..000d85f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,18 +1,17 @@ - - ./test/Unit - ./test/Integration - - - - ./src - - - \ No newline at end of file + beStrictAboutTestsThatDoNotTestAnything="true"> + + + ./src + + + + ./test/Unit + ./test/Integration + + diff --git a/test/Integration/CloudMessagingTest.php b/test/Integration/CloudMessagingTest.php index 74e86ea..09d2adf 100644 --- a/test/Integration/CloudMessagingTest.php +++ b/test/Integration/CloudMessagingTest.php @@ -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( @@ -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) { diff --git a/test/Unit/GatewayTest.php b/test/Unit/GatewayTest.php index 8ddf3e3..18b417b 100644 --- a/test/Unit/GatewayTest.php +++ b/test/Unit/GatewayTest.php @@ -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 @@ -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);