customergauge / minio
使用 Minio 模拟 S3 存储
1.5.0
2023-04-24 21:06 UTC
Requires
- php: >=7.3
- ext-json: *
- aws/aws-sdk-php: ^3.158
- illuminate/contracts: >=7.1
Requires (Dev)
- illuminate/config: >=7.1
- illuminate/container: ~7.1
- phpstan/phpstan: ^1.0
- phpunit/phpunit: >=9.0
README
此库提供了一种方便的方式编写针对 Minio(一个兼容 S3 的存储)的测试代码。
安装
composer require customergauge/minio
使用
$minio = new Minio(); $minio->disk('my-bucket', function (S3Client $client, string $bucket) { $this->post('/my/endpoint/that/interacts/with/s3', []) ->assertSuccessful(); $object = $client->getObject([ 'Bucket' => $bucket, 'Key' => "/my/expected/s3/key" ]); $content = $object['Body']->getContents(); $this->assertStringContainsString('partial-file-content', $content); });
Docker 示例
minio: image: minio/minio ports: - 9000:9000 environment: - MINIO_ACCESS_KEY=customergauge - MINIO_SECRET_KEY=phpunit123 command: server /data