Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
sed -i -re 's/"require": \{/"repositories": [{"type": "path","url": "..\/..\/Core", "options": {"versions": {"async-aws\/core": "dev-master"}}, "canonical": ${{matrix.strategy != 'lowest' && 'true' || 'false'}} }],"require": \{/' composer.json
composer config minimum-stability dev
composer config prefer-stable true
composer require --dev --no-update symfony/phpunit-bridge
composer require --dev --no-update symfony/phpunit-bridge:^7.3.2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cat composer.json

echo ::endgroup::
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
cd "$CURRENT_DIR/$COMPONENT"

localExit=0
composer require symfony/phpunit-bridge --no-update --no-install
composer require symfony/phpunit-bridge:^7.3.2@dev --dev --no-update --no-install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove the @dev here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only once 7.3.2 has been tagged, the minimum stability setting to dev further above is not applied to all composer.json files (see https://github.com/xabbuh/aws/actions/runs/16861959545/job/47763456579#step:8:32)

composer update --no-interaction --no-scripts --prefer-dist --optimize-autoloader ${{ matrix.strategy == 'lowest' && '--prefer-lowest' || '' }} $COMPOSER_OPTIONS || localExit=1
./vendor/bin/simple-phpunit install
echo ::endgroup::
Expand Down
4 changes: 4 additions & 0 deletions src/Core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Support for Symfony 8

### Changed

- `ResultMockFactory` does not call `ReflectionProperty::setAccessible()` on PHP 8.1+

## 1.26.0

### Added
Expand Down
40 changes: 30 additions & 10 deletions src/Core/src/Test/ResultMockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public static function create(string $class, array $data = [])
// Make sure the Result is initialized
$reflectionClass = new \ReflectionClass(Result::class);
$initializedProperty = $reflectionClass->getProperty('initialized');
$initializedProperty->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$initializedProperty->setAccessible(true);
}

/** @psalm-var \ReflectionClass<T> $reflectionClass */
$reflectionClass = new \ReflectionClass($class);
Expand Down Expand Up @@ -116,7 +118,9 @@ public static function create(string $class, array $data = [])
$property = $reflectionClass->getProperty($propertyName);
}
}
$property->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue($object, $propertyValue);
}

Expand Down Expand Up @@ -151,10 +155,14 @@ public static function waiter(string $class, string $finalState)

$reflectionClass = new \ReflectionClass(Waiter::class);
$propertyResponse = $reflectionClass->getProperty('response');
$propertyResponse->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$propertyResponse->setAccessible(true);
}

$propertyState = $reflectionClass->getProperty('finalState');
$propertyState->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$propertyState->setAccessible(true);
}

/** @psalm-var \ReflectionClass<T> $reflectionClass */
$reflectionClass = new \ReflectionClass($class);
Expand Down Expand Up @@ -217,7 +225,9 @@ private static function addUndefinedProperties(\ReflectionClass $reflectionClass
}

if (null !== $propertyValue) {
$property->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue($object, $propertyValue);
}
}
Expand Down Expand Up @@ -260,14 +270,18 @@ private static function addPropertiesOnResult(\ReflectionClass $reflectionClass,
if (class_exists($awsClientClass)) {
$awsClientMock = (new \ReflectionClass($awsClientClass))->newInstanceWithoutConstructor();
$property = $reflectionClass->getProperty('awsClient');
$property->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue($object, $awsClientMock);
}

if (class_exists($inputClass)) {
$inputMock = (new \ReflectionClass($inputClass))->newInstanceWithoutConstructor();
$property = $reflectionClass->getProperty('input');
$property->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue($object, $inputMock);
}
}
Expand All @@ -278,15 +292,21 @@ private static function getResponseObject(): Response
$response = $reflectionClass->newInstanceWithoutConstructor();

$property = $reflectionClass->getProperty('resolveResult');
$property->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue($response, true);

$property = $reflectionClass->getProperty('bodyDownloaded');
$property->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue($response, true);

$property = $reflectionClass->getProperty('httpResponse');
$property->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$property->setValue($response, new SimpleMockedResponse());

return $response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public function testCreateStore()
self::assertInstanceOf(AsyncAwsDynamoDbStore::class, $store);
$refl = new \ReflectionClass($store);
$property = $refl->getProperty('dynamoDb');
$property->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$property->setAccessible(true);
}
$client = $property->getValue($store);

$config = $client->getConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ public function testIssue1758Cache()

$r = new \ReflectionObject($cache);
$p = $r->getProperty('cache');
$p->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$p->setAccessible(true);
}

$adapter = $p->getValue($cache);
self::assertInstanceOf(ApcuAdapter::class, $adapter);
Expand All @@ -205,7 +207,9 @@ public function testIssue1758Provider()

$r = new \ReflectionClass(AbstractApi::class);
$p = $r->getProperty('credentialProvider');
$p->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$p->setAccessible(true);
}

$credentialProvider = $p->getValue($client);
self::assertInstanceOf(InstanceProvider::class, $credentialProvider);
Expand All @@ -226,7 +230,9 @@ public function testIssue1758ProviderAndCache()

$r = new \ReflectionClass(AbstractApi::class);
$p = $r->getProperty('credentialProvider');
$p->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$p->setAccessible(true);
}

$credentialProvider = $p->getValue($client);
self::assertInstanceOf(CacheProvider::class, $credentialProvider);
Expand All @@ -235,13 +241,17 @@ public function testIssue1758ProviderAndCache()

$r = new \ReflectionObject($cache);
$p = $r->getProperty('cache');
$p->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$p->setAccessible(true);
}

$adapter = $p->getValue($cache);
self::assertInstanceOf(ApcuAdapter::class, $adapter);

$p = $r->getProperty('decorated');
$p->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$p->setAccessible(true);
}

$decorated = $p->getValue($cache);
self::assertInstanceOf(InstanceProvider::class, $decorated);
Expand Down
4 changes: 3 additions & 1 deletion src/Service/Ses/tests/Unit/SesClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ public function testSignService()
$ses = new SesClient([], new NullProvider());
$refl = new \ReflectionClass($ses);
$method = $refl->getMethod('getEndpointMetadata');
$method->setAccessible(true);
if (\PHP_VERSION_ID < 80100) {
$method->setAccessible(true);
}
$data = $method->invokeArgs($ses, ['eu-central-1']);

self::assertEquals('ses', $data['signService']);
Expand Down
Loading