OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
zzaws-ses
/
vendor
/
aws
/
aws-sdk-php
/
tests
/
Api
/
Parser
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/14/2024 08:08:06 AM
rwxr-xr-x
📄
ComplianceTest.php
5.2 KB
08/14/2024 08:01:03 AM
rw-r--r--
📄
Crc32ValidatingParserTest.php
1.84 KB
08/14/2024 08:01:03 AM
rw-r--r--
📄
DecodingEventStreamIteratorTest.php
4.42 KB
08/14/2024 08:01:03 AM
rw-r--r--
📄
EventParsingIteratorTest.php
12.77 KB
08/14/2024 08:01:03 AM
rw-r--r--
📁
Exception
-
08/14/2024 08:07:58 AM
rwxr-xr-x
📄
JsonParserTest.php
7.32 KB
08/14/2024 08:01:03 AM
rw-r--r--
📄
JsonRpcParserTest.php
7.77 KB
08/14/2024 08:01:03 AM
rw-r--r--
📄
NonSeekableStreamDecodingEventStreamIteratorTest.php
2.49 KB
08/14/2024 08:01:03 AM
rw-r--r--
📄
ParserTestServiceTrait.php
5.38 KB
08/14/2024 08:01:03 AM
rw-r--r--
📄
XmlParserTest.php
7.14 KB
08/14/2024 08:01:03 AM
rw-r--r--
Editing: Crc32ValidatingParserTest.php
Close
<?php namespace Aws\Test\Api\Parser; use Aws\Api\ApiProvider; use Aws\Api\Parser\Crc32ValidatingParser; use Aws\Api\Parser\JsonRpcParser; use Aws\Api\Service; use Aws\Command; use Aws\Exception\AwsException; use Aws\ResultInterface; use GuzzleHttp\Psr7\Response; use Yoast\PHPUnitPolyfills\TestCases\TestCase; /** * @covers Aws\Api\Parser\Crc32ValidatingParser */ class Crc32ValidatingParserTest extends TestCase { private function getWrapped() { $provider = ApiProvider::defaultProvider(); $data = $provider('api', 'dynamodb', 'latest'); $parser = new JsonRpcParser(new Service($data, $provider)); return new Crc32ValidatingParser($parser); } public function testSkipsIfNoCrcHeader() { $wrapped = $this->getWrapped(); $command = new Command('GetItem'); $response = new Response(200, [], '{"foo": "bar"}'); $this->assertInstanceOf(ResultInterface::class, $wrapped($command, $response)); } public function testThrowsWhenMismatch() { $wrapped = $this->getWrapped(); $command = new Command('GetItem'); $response = new Response(200, ['x-amz-crc32' => '123'], '{"foo": "bar"}'); try { $wrapped($command, $response); $this->fail(); } catch (AwsException $e) { $this->assertStringContainsString('crc32 mismatch. Expected 123, found 11124959', $e->getMessage()); $this->assertTrue($e->isConnectionError()); } } public function testNothingWhenValidChecksum() { $wrapped = $this->getWrapped(); $command = new Command('GetItem'); $response = new Response(200, ['x-amz-crc32' => '11124959'], '{"foo": "bar"}'); $this->assertInstanceOf(ResultInterface::class, $wrapped($command, $response)); } }