diff --git a/composer.json b/composer.json index 775fe48..33cfc2f 100644 --- a/composer.json +++ b/composer.json @@ -1,40 +1,41 @@ { "name": "keruald/github", "description": "X-Hub-Signature generator and validator", "license": "BSD-2-Clause", "repositories": [ { "type": "vcs", "url": "https://github.com/keruald/github" } ], "authors": [ { "name": "Sébastien Santoro", "email": "dereckson@espace-win.org" } ], "keywords": [ "keruald", "GitHub" ], "support": { "irc": "irc://irc.freenode.net/wolfplex", "issues": "http://devcentral.nasqueron.org" }, "require": { "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "5.0.*" + "php": ">=8.2.0", + "phpunit/phpunit": "11.*" }, "autoload": { "psr-4": { "Keruald\\GitHub\\": "src/", "Keruald\\GitHub\\Tests\\": "tests/" } }, "scripts": { "test": "phpunit tests" } } diff --git a/tests/XHubSignatureTest.php b/tests/XHubSignatureTest.php index e2add85..fbc3f96 100644 --- a/tests/XHubSignatureTest.php +++ b/tests/XHubSignatureTest.php @@ -1,84 +1,82 @@ -<?php +<?php declare(strict_types=1); + +use PHPUnit\Framework\TestCase; use Keruald\GitHub\XHubSignature; require 'XHubSignatureConstants.php'; -class XHubSignatureTest extends PHPUnit_Framework_TestCase { +class XHubSignatureTest extends TestCase { protected $defaultInstance; protected $tigerInstance; - protected function setUp() { + protected function setUp() : void { $this->defaultInstance = new XHubSignature(SECRET); $this->tigerInstance = new XHubSignature(SECRET, TIGER_ALGO); $this->defaultInstance->payload = DEFAULT_PAYLOAD; $this->tigerInstance->payload = TIGER_PAYLOAD; } - public function testValidate () { + public function testValidate () : void { $this->defaultInstance->signature = ""; $this->assertFalse($this->defaultInstance->validate()); $this->defaultInstance->signature = "bad signature"; $this->assertFalse($this->defaultInstance->validate()); $this->defaultInstance->signature = DEFAULT_SIGNATURE; $this->assertTrue($this->defaultInstance->validate()); } - public function testCompute () { + public function testCompute () : void { $this->assertSame( DEFAULT_SIGNATURE, $this->defaultInstance->compute() ); $this->assertSame( TIGER_SIGNATURE, $this->tigerInstance->compute() ); } /// /// Test static helper methods /// - /** - * @covers XHubSignature::validatePayload - */ - public function testhashPayload () { + #[CoversFunction(XHubSignature::validatePayload)] + public function testhashPayload () : void { $this->assertSame( EMPTY_DEFAULT_HASH_ALGO_SIGNATURE, XHubSignature::hashPayload("", "") ); $this->assertSame( TIGER_SIGNATURE, XHubSignature::hashPayload(SECRET, TIGER_PAYLOAD, TIGER_ALGO) ); } - /** - * @covers XHubSignature::validatePayload - */ - public function testValidatePayload () { + #[CoversFunction(XHubSignature::validatePayload)] + public function testValidatePayload () : void { $this->assertFalse(XHubSignature::validatePayload("", "", "")); $this->assertTrue(XHubSignature::validatePayload( SECRET, TIGER_PAYLOAD, TIGER_SIGNATURE, TIGER_ALGO )); } - public function testParseSignature () { + public function testParseSignature () : void { $this->assertSame( TIGER_SIGNATURE, XHubSignature::parseSignature(TIGER_SIGNATURE) ); $this->assertSame( TIGER_SIGNATURE, XHubSignature::parseSignature(TIGER_ALGO . '=' . TIGER_SIGNATURE) ); } }