Skip to content

Commit

Permalink
Remove code features unsupported by older versions of PHP LRN-43664
Browse files Browse the repository at this point in the history
  • Loading branch information
david-scarratt-lrn committed May 9, 2024
1 parent 078eb0d commit 890cfa2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/Services/PreHashStringFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ class PreHashStringFactory
LegacyPreHashString::class,
];

protected array $validServices;
/**
* @var array
*/
protected /* array */ $validServices;

public function __construct()
{
Expand Down
12 changes: 8 additions & 4 deletions src/Services/PreHashStrings/LegacyPreHashString.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,15 @@ class LegacyPreHashString implements PreHashStringInterface
'domain',
];

/** Service name to generate a pre-hash string for */
protected string $service;
/** Service name to generate a pre-hash string for
* @var string
*/
protected /* string */ $service;

/** V1-compat strings need the secret to be part of the pre-hash string */
protected bool $v1Compat;
/** V1-compat strings need the secret to be part of the pre-hash string
* @var bool
*/
protected /* bool */ $v1Compat;

public function __construct(string $service, bool $v1Compat = false)
{
Expand Down
12 changes: 12 additions & 0 deletions tests/Request/InitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ public function testNullRequestPacketAndActionGeneratesValidInit()
$this->assertInstanceOf(Init::class, $initObject);
}

/**
* @requires PHPUnit >= 9.6
*/
public function testMetaWithTelemetryOnlyAddsSdkProp()
{
list($service, $security, $secret, $request, $action) = ParamsFixture::getWorkingQuestionsApiParams();
Expand All @@ -170,6 +173,9 @@ public function testMetaWithTelemetryOnlyAddsSdkProp()
$this->assertEquals(1, count((array) $generatedObject->meta));
}

/**
* @requires PHPUnit >= 9.6
*/
public function testRequestWithTelemetryPreservesOtherMetaProps()
{
list($service, $security, $secret, $request, $action) = ParamsFixture::getWorkingQuestionsApiParams();
Expand All @@ -195,6 +201,9 @@ public function testRequestWithTelemetryPreservesOtherMetaProps()
$this->assertObjectHasProperty('sdk', $generatedObject->meta);
}

/**
* @requires PHPUnit >= 9.6
*/
public function testRequestWithoutTelemetryPreservesEmptyMeta()
{
// We disable telemetry to be able to reliably test signature generation. Added telemetry
Expand All @@ -210,6 +219,9 @@ public function testRequestWithoutTelemetryPreservesEmptyMeta()
$this->assertObjectNotHasProperty('meta', $generatedObject);
}

/**
* @requires PHPUnit >= 9.6
*/
public function testRequestWithoutTelemetryPreservesFilledMeta()
{
// We disable telemetry to be able to reliably test signature generation. Added telemetry
Expand Down
2 changes: 1 addition & 1 deletion tests/Services/LegacySignaturesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class LegacySignaturesTest extends AbstractTestCase
{
private SignatureFactory $signatureFactory;
private $signatureFactory;

public function setUp(): void
{
Expand Down

0 comments on commit 890cfa2

Please sign in to comment.