aws / aws-sdk-php

Official repository of the AWS SDK for PHP (@awsforphp)
http://aws.amazon.com/sdkforphp
Apache License 2.0
6.04k stars 1.23k forks source link

add missing stream wrapper functions #2979

Open p8nut opened 3 months ago

p8nut commented 3 months ago

Issue #, if available:

2954

Description of changes: this implement the missing functions from the stream wrapper interface. all of the missing function return false as the doc describe. if needed it also throw an E_WARNING

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

stobrien89 commented 3 months ago

Hi @p8nut,

Thanks for the contribution. Would you be able to to add some unit tests covering this behavior in Test\S3\StreamWrapperTest ? Nothing fancy, just assertions on the output.

p8nut commented 2 months ago

as asked i try to add some basic test to the code but for some reason i wasn't able to try them on my computer. i leave them here for now and will try to validate all of them as soon as possible.

stobrien89 commented 2 months ago

@p8nut,

Thanks for adding the tests. Just two things:

  1. for the test methods, can you append ReturnsFalse to their names? e.g. testSetStreamOptionReturnsFalse.
  2. The tests are failing because the mock request is not returning a mock result. You can fix this by adding
$this->addMockResults(
  $this->client,
  [
      new Result(),
  ]
);

prior to $stream = ... in your tests.