File: ClientTest.php

package info (click to toggle)
php-async-aws-core 1.28.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 892 kB
  • sloc: php: 6,980; makefile: 39
file content (39 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

declare(strict_types=1);

namespace AsyncAws\Core\Tests\Integration;

use AsyncAws\Core\Credentials\NullProvider;
use AsyncAws\S3\S3Client;
use PHPUnit\Framework\TestCase;

class ClientTest extends TestCase
{
    public function testStreamToStream(): void
    {
        if (!class_exists(S3Client::class)) {
            self::markTestSkipped('This test needs a client with waiter endpoints');
        }

        $client = new S3Client([
            'endpoint' => 'http://localhost:4569',
            'pathStyleEndpoint' => true,
        ], new NullProvider());

        $client->createBucket(['Bucket' => 'foo'])->resolve();
        $client->putObject([
            'Bucket' => 'foo',
            'Key' => 'bar',
            'Body' => 'content',
        ])->resolve();

        $client->putObject([
            'Bucket' => 'foo',
            'Key' => 'bar2',
            'Body' => $client->getObject(['Bucket' => 'foo', 'Key' => 'bar'])->getBody()->getContentAsResource(),
        ])->resolve();

        self::expectNotToPerformAssertions();
    }
}