fix(core,admin_basic): S3 스토리지 드라이버 실동작 결함 수정 및 S3 호환 스토리지 연결 지원
공개 제보 — 파일 스토리지에서 S3 를 선택해 저장해도 실제 파일 저장이 동작하지 않던 결함의 전면 수정. - S3 어댑터(league/flysystem-aws-s3-v3)·predis 를 코어 기본 의존성으로 포함 — 어댑터 부재 즉사, phpredis 확장 없는 서버의 redis 선택 전면 다운 차단 (부트 시 확장 부재 감지 → predis 자동 폴백) - storage_driver=s3 저장 시 코어 첨부 업로드 디스크를 s3 로 전환 (ATTACHMENT_DISK env 명시가 항상 우선, 기존 행은 저장 당시 disk 로 서빙) - 첨부·템플릿 레이아웃 첨부 서빙을 행 disk 를 따르는 스토리지 스트림으로 교체 — 로컬 절대 경로 전제 fileResponse 는 S3 행에서 filemtime stat 500 (streamedFileResponse: 행 메타 기반 ETag/304/Cache-Control) - S3 호환 스토리지(R2/MinIO/NCP) 연결 지원: 엔드포인트 URL·path-style 설정 신설, 리전 목록 선택 → 자유 입력 전환, 연결 테스트를 실제 저장 경로와 동일 설정(endpoint/path-style)으로 정렬 - 사용 불능 드라이버(어댑터·PHP 확장 부재)의 저장/테스트 요청을 사유와 함께 422 로 차단하는 서버 게이트 신설 (DriverRegistryService 능력 판정) - 웹소켓 연결 테스트에 서버(백엔드 발송용) endpoint 검사 추가 — 클라이언트만 검사해 테스트 성공 + 실제 발송 실패가 가능하던 비대칭 해소 - env 빈 값(`KEY=`) 함정 정규화: AWS_URL/AWS_ENDPOINT/ATTACHMENT_DISK 빈 문자열을 미설정으로 취급 (config 정규화 + 예시 파일 주석 처리) - 플러그인 드라이버 폴백의 log 카테고리 죽은 키(logging.default) 정정 및 websocket 유령 설정 키 제거 - 실 AWS S3 종단 검증 완료 (설정 저장 → 업로드 S3 실저장 → 서빙 200/304)
This commit is contained in:
1 parent
c128a6ea3a
commit
ea58c606a2
56 files changed
+2899
-243
No files matched your search
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services;
|
||||
|
||||
use App\Services\DriverConnectionTester;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use League\Flysystem\AwsS3V3\AwsS3V3Adapter;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* DriverConnectionTester 테스트 (공개 #99 / 내부 #563, A5·A6)
|
||||
*
|
||||
* testS3 의 endpoint/path-style 반영·어댑터 선검사, testWebsocket 의
|
||||
* client/server 양측 endpoint probe 를 검증합니다.
|
||||
*
|
||||
* 한계: Http::fake 는 요청 URL 계약까지만 검증한다 (요청 본문 미검증 —
|
||||
* feedback_http_fake_does_not_validate_request_body). S3 종단 검증은
|
||||
* Chrome MCP MinIO 매트릭스가 담당한다.
|
||||
*/
|
||||
class DriverConnectionTesterTest extends TestCase
|
||||
{
|
||||
private DriverConnectionTester $tester;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->tester = new DriverConnectionTester;
|
||||
}
|
||||
|
||||
/**
|
||||
* 필수 설정 누락 시 s3_missing_config 메시지를 반환하는지 테스트합니다.
|
||||
*/
|
||||
public function test_s3_missing_config_returns_failure(): void
|
||||
{
|
||||
$result = $this->tester->testS3(['s3_bucket' => 'only-bucket']);
|
||||
|
||||
$this->assertFalse($result['success']);
|
||||
$this->assertSame(__('settings.s3_missing_config'), $result['message']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 커스텀 endpoint 가 실제 아웃바운드 대상에 반영되는지 테스트합니다.
|
||||
*
|
||||
* 도달 불가한 로컬 endpoint 로 시도 → 연결 실패의 error 문자열에 해당 endpoint
|
||||
* 호스트가 나타나야 한다 (AWS 리전 도메인이 아니라). 이것이 endpoint 미반영
|
||||
* 결함(#99 ③ — s3_url 만 있고 SDK 요청 대상은 amazonaws.com 고정)의 회귀 가드다.
|
||||
*
|
||||
* @scenario region_shape=custom_minio,endpoint=path_style,driver_usability=adapter_present,attachment_disk=local_default
|
||||
*
|
||||
* @effects endpoint_injected
|
||||
*/
|
||||
public function test_s3_custom_endpoint_reaches_outbound_target(): void
|
||||
{
|
||||
$result = $this->tester->testS3([
|
||||
's3_bucket' => 'test-bucket',
|
||||
's3_region' => 'us-east-1',
|
||||
's3_access_key' => 'test-key',
|
||||
's3_secret_key' => 'test-secret',
|
||||
's3_endpoint' => 'http://127.0.0.1:9',
|
||||
's3_use_path_style' => true,
|
||||
]);
|
||||
|
||||
$this->assertFalse($result['success']);
|
||||
$this->assertArrayHasKey('error', $result);
|
||||
$this->assertStringContainsString(
|
||||
'127.0.0.1',
|
||||
$result['error'],
|
||||
'아웃바운드가 커스텀 endpoint 를 향해야 함 — amazonaws.com 고정이면 endpoint 미반영 회귀'
|
||||
);
|
||||
$this->assertStringNotContainsString('amazonaws.com', $result['error']);
|
||||
}
|
||||
|
||||
/**
|
||||
* path-style 토글이 아웃바운드 주소 형태를 실제로 바꾸는지 테스트합니다.
|
||||
*
|
||||
* IP endpoint 는 SDK 가 path-style 을 자동 강제해 off↔on 이 구분되지 않으므로
|
||||
* hostname endpoint 로 검증한다: off = virtual-hosted(버킷이 호스트에 접두) /
|
||||
* on = path-style(버킷이 경로로 이동). off 상태로도 통과하던 endpoint 단언의
|
||||
* 사각을 메우는 회귀 가드다.
|
||||
*
|
||||
* @scenario region_shape=custom_minio,endpoint=path_style,driver_usability=adapter_present,attachment_disk=local_default
|
||||
*
|
||||
* @effects endpoint_injected
|
||||
*/
|
||||
public function test_s3_path_style_toggle_changes_outbound_address_shape(): void
|
||||
{
|
||||
$config = [
|
||||
's3_bucket' => 'test-bucket',
|
||||
's3_region' => 'us-east-1',
|
||||
's3_access_key' => 'test-key',
|
||||
's3_secret_key' => 'test-secret',
|
||||
's3_endpoint' => 'http://s3-parity.invalid:9',
|
||||
];
|
||||
|
||||
$virtualHosted = $this->tester->testS3($config + ['s3_use_path_style' => false]);
|
||||
$pathStyle = $this->tester->testS3($config + ['s3_use_path_style' => true]);
|
||||
|
||||
$this->assertFalse($virtualHosted['success']);
|
||||
$this->assertFalse($pathStyle['success']);
|
||||
|
||||
// off: 버킷명이 호스트에 접두된 virtual-hosted 주소를 향해야 한다
|
||||
$this->assertStringContainsString(
|
||||
'test-bucket.s3-parity.invalid',
|
||||
$virtualHosted['error'],
|
||||
'path-style off 는 virtual-hosted 주소여야 함'
|
||||
);
|
||||
|
||||
// on: 버킷 접두 호스트가 사라져야 한다 — off 와 동일하면 path-style 주입 회귀
|
||||
$this->assertStringNotContainsString(
|
||||
'test-bucket.s3-parity.invalid',
|
||||
$pathStyle['error'],
|
||||
'path-style on 인데 버킷 접두 호스트가 남아 있으면 use_path_style_endpoint 미반영 회귀'
|
||||
);
|
||||
$this->assertStringContainsString('s3-parity.invalid', $pathStyle['error']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 어댑터 선검사 계약 — 어댑터가 설치된 환경에서는 missing 분기가 발동하지 않고,
|
||||
* 코드가 어댑터 존재를 검사하고 있는지(클래스 상수 참조) 검증합니다.
|
||||
*
|
||||
* 어댑터는 composer 필수 의존성이라 부재 상태를 만들 수 없으므로 구성 검증으로 대체한다
|
||||
* (계획서 A5 — "mock 불가 시 구성 검증으로 대체").
|
||||
*/
|
||||
public function test_s3_adapter_precheck_present_in_code(): void
|
||||
{
|
||||
$this->assertTrue(
|
||||
class_exists(AwsS3V3Adapter::class),
|
||||
'어댑터는 코어 필수 의존성 (#99 A1)'
|
||||
);
|
||||
|
||||
$source = file_get_contents(app_path('Services/DriverConnectionTester.php'));
|
||||
$this->assertStringContainsString(
|
||||
'AwsS3V3Adapter::class',
|
||||
$source,
|
||||
'testS3 는 어댑터 존재 선검사를 유지해야 함 — 테스트(SDK 직접)와 실경로(Flysystem)의 분리가 결함을 가리는 구조 방지 (A5)'
|
||||
);
|
||||
$this->assertStringContainsString('s3_adapter_missing', $source);
|
||||
}
|
||||
|
||||
/**
|
||||
* testWebsocket 이 client 와 server endpoint 를 모두 probe 하는지 테스트합니다.
|
||||
*
|
||||
* @scenario region_shape=aws_region,endpoint=absent,driver_usability=adapter_present,attachment_disk=local_default
|
||||
*
|
||||
* @effects test_covers_server_websocket
|
||||
*/
|
||||
public function test_websocket_probes_both_client_and_server_endpoints(): void
|
||||
{
|
||||
Http::fake([
|
||||
'client.test:8443*' => Http::response('ok', 200),
|
||||
'server.test:8080*' => Http::response('ok', 200),
|
||||
]);
|
||||
|
||||
$result = $this->tester->testWebsocket([
|
||||
'websocket_host' => 'client.test',
|
||||
'websocket_port' => 8443,
|
||||
'websocket_scheme' => 'https',
|
||||
'websocket_server_host' => 'server.test',
|
||||
'websocket_server_port' => 8080,
|
||||
'websocket_server_scheme' => 'http',
|
||||
]);
|
||||
|
||||
$this->assertTrue($result['success']);
|
||||
Http::assertSent(fn ($request) => str_starts_with($request->url(), 'https://client.test'));
|
||||
Http::assertSent(fn ($request) => str_starts_with($request->url(), 'http://server.test'));
|
||||
}
|
||||
|
||||
/**
|
||||
* server endpoint 실패 시 어느 쪽 실패인지 구분된 메시지를 반환하는지 테스트합니다.
|
||||
*/
|
||||
public function test_websocket_server_endpoint_failure_is_distinguished(): void
|
||||
{
|
||||
Http::fake([
|
||||
'client.test:8443*' => Http::response('ok', 200),
|
||||
'server.test:8080*' => Http::response('error', 500),
|
||||
]);
|
||||
|
||||
$result = $this->tester->testWebsocket([
|
||||
'websocket_host' => 'client.test',
|
||||
'websocket_port' => 8443,
|
||||
'websocket_scheme' => 'https',
|
||||
'websocket_server_host' => 'server.test',
|
||||
'websocket_server_port' => 8080,
|
||||
'websocket_server_scheme' => 'http',
|
||||
]);
|
||||
|
||||
$this->assertFalse($result['success']);
|
||||
$this->assertSame(
|
||||
__('settings.websocket_server_test_failed'),
|
||||
$result['message'],
|
||||
'백엔드 발송은 server endpoint 를 쓴다 — client 만 검사하면 "테스트 성공 + 실제 발송 실패" (A6)'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* server 필드가 비어 있으면 client 값으로 폴백하며 중복 probe 를 생략하는지 테스트합니다.
|
||||
*/
|
||||
public function test_websocket_server_fields_fallback_to_client(): void
|
||||
{
|
||||
Http::fake([
|
||||
'client.test:8443*' => Http::response('ok', 200),
|
||||
]);
|
||||
|
||||
$result = $this->tester->testWebsocket([
|
||||
'websocket_host' => 'client.test',
|
||||
'websocket_port' => 8443,
|
||||
'websocket_scheme' => 'https',
|
||||
]);
|
||||
|
||||
$this->assertTrue($result['success']);
|
||||
Http::assertSentCount(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* client endpoint 실패 시 기존 메시지 계약이 유지되는지 테스트합니다 (하위호환).
|
||||
*/
|
||||
public function test_websocket_client_failure_keeps_existing_contract(): void
|
||||
{
|
||||
Http::fake([
|
||||
'client.test:8443*' => Http::response('error', 500),
|
||||
]);
|
||||
|
||||
$result = $this->tester->testWebsocket([
|
||||
'websocket_host' => 'client.test',
|
||||
'websocket_port' => 8443,
|
||||
'websocket_scheme' => 'https',
|
||||
'websocket_server_host' => 'server.test',
|
||||
'websocket_server_port' => 8080,
|
||||
'websocket_server_scheme' => 'http',
|
||||
]);
|
||||
|
||||
$this->assertFalse($result['success']);
|
||||
$this->assertSame(__('settings.websocket_test_failed'), $result['message']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services;
|
||||
|
||||
use App\Services\DriverRegistryService;
|
||||
use League\Flysystem\AwsS3V3\AwsS3V3Adapter;
|
||||
use Predis\Client;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* DriverRegistryService 드라이버 가용성 판정 테스트 (공개 #99 / 내부 #563, A7)
|
||||
*
|
||||
* isDriverUsable()/usabilityFailureReason() 의 런타임 능력 판정과
|
||||
* a5(CONFIG_KEYS 로그 키 정정)·a6(websocket 설정 키 제외) 회귀를 검증합니다.
|
||||
*/
|
||||
class DriverRegistryServiceUsabilityTest extends TestCase
|
||||
{
|
||||
private DriverRegistryService $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->service = new DriverRegistryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* s3 드라이버 가용성이 Flysystem 어댑터 존재와 일치하는지 테스트합니다.
|
||||
*
|
||||
* 어댑터는 composer require 로 코어에 포함되므로(#99 A1) 항상 true 여야 합니다.
|
||||
*
|
||||
* @scenario region_shape=aws_region,endpoint=absent,driver_usability=adapter_present,attachment_disk=local_default
|
||||
*
|
||||
* @effects s3_disk_resolves
|
||||
*/
|
||||
public function test_s3_usability_matches_adapter_presence(): void
|
||||
{
|
||||
$expected = class_exists(AwsS3V3Adapter::class);
|
||||
|
||||
$this->assertSame($expected, $this->service->isDriverUsable('storage', 's3'));
|
||||
$this->assertTrue(
|
||||
$expected,
|
||||
'league/flysystem-aws-s3-v3 는 코어 필수 의존성 — 부재 시 S3 선택이 즉사한다 (#99 A1)'
|
||||
);
|
||||
$this->assertNull($this->service->usabilityFailureReason('storage', 's3'));
|
||||
}
|
||||
|
||||
/**
|
||||
* redis 드라이버 가용성이 phpredis 확장 또는 predis 존재와 일치하는지 테스트합니다.
|
||||
*
|
||||
* predis 는 composer require 로 코어에 포함되므로(#99 A2) 항상 true 여야 합니다.
|
||||
*/
|
||||
public function test_redis_usability_matches_client_presence(): void
|
||||
{
|
||||
$expected = extension_loaded('redis') || class_exists(Client::class);
|
||||
|
||||
$this->assertSame($expected, $this->service->isDriverUsable('cache', 'redis'));
|
||||
$this->assertTrue(
|
||||
$expected,
|
||||
'predis/predis 는 코어 필수 의존성 — 확장 없는 서버에서 redis 선택 시 전면 다운 방어 (#99 A2)'
|
||||
);
|
||||
|
||||
// predis 명시 설정 분기 — 판정은 설정 클라이언트 기준 (predis 는 코어 의존성이라 참)
|
||||
config(['database.redis.client' => 'predis']);
|
||||
$this->assertTrue($this->service->isDriverUsable('cache', 'redis'));
|
||||
}
|
||||
|
||||
/**
|
||||
* memcached 드라이버 가용성이 PHP 확장 존재와 일치하는지 테스트합니다.
|
||||
*
|
||||
* @scenario region_shape=aws_region,endpoint=absent,driver_usability=adapter_absent,attachment_disk=local_default
|
||||
*
|
||||
* @effects unusable_driver_rejected
|
||||
*/
|
||||
public function test_memcached_usability_matches_extension(): void
|
||||
{
|
||||
$expected = extension_loaded('memcached');
|
||||
|
||||
$this->assertSame($expected, $this->service->isDriverUsable('cache', 'memcached'));
|
||||
|
||||
if (! $expected) {
|
||||
$this->assertNotNull(
|
||||
$this->service->usabilityFailureReason('cache', 'memcached'),
|
||||
'사용 불능 드라이버는 사유 문자열을 제공해야 함 (422 메시지 파라미터)'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 능력 요구가 없는 드라이버(local/file 등)와 미지정 드라이버는 항상 사용 가능해야 합니다.
|
||||
*/
|
||||
public function test_unknown_and_capability_free_drivers_are_usable(): void
|
||||
{
|
||||
$this->assertTrue($this->service->isDriverUsable('storage', 'local'));
|
||||
$this->assertTrue($this->service->isDriverUsable('cache', 'file'));
|
||||
$this->assertTrue($this->service->isDriverUsable('queue', 'database'));
|
||||
// 플러그인 등록 드라이버 — 가용성은 해당 플러그인 SP 가 보증하므로 코어는 통과
|
||||
$this->assertTrue($this->service->isDriverUsable('storage', 'plugin-custom-driver'));
|
||||
}
|
||||
|
||||
/**
|
||||
* a5 회귀 — log 카테고리 Config 키가 실제 적용 키(stack.channels)와 일치해야 합니다.
|
||||
*/
|
||||
public function test_log_config_key_matches_actual_applied_key(): void
|
||||
{
|
||||
$this->assertSame(
|
||||
'logging.channels.stack.channels',
|
||||
$this->service->getConfigKey('log'),
|
||||
'logging.default 는 어디에서도 읽지 않는 죽은 키 — applyLogConfig 실제 기록 키와 일치해야 폴백이 실효한다 (a5)'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* log 카테고리의 Config 기록 값은 채널 배열 형태여야 합니다.
|
||||
*/
|
||||
public function test_log_config_value_is_channel_array(): void
|
||||
{
|
||||
$this->assertSame(['daily'], $this->service->getConfigValueForDriver('log', 'daily'));
|
||||
$this->assertSame('file', $this->service->getConfigValueForDriver('cache', 'file'));
|
||||
}
|
||||
|
||||
/**
|
||||
* a6 회귀 — websocket 은 드라이버 ID 선택 설정이 없으므로 설정 키 매핑에서 제외되어야 합니다.
|
||||
*/
|
||||
public function test_websocket_settings_key_excluded(): void
|
||||
{
|
||||
$this->assertNull(
|
||||
$this->service->getSettingsKey('websocket'),
|
||||
"websocket 은 불리언 websocket_enabled 뿐 — 종전 'websocket_driver' 는 어떤 저장 경로에도 없는 유령 키였다 (a6)"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services;
|
||||
|
||||
use App\Contracts\Extension\StorageInterface;
|
||||
use App\Contracts\Repositories\TemplateLayoutAttachmentRepositoryInterface;
|
||||
use App\Contracts\Repositories\TemplateRepositoryInterface;
|
||||
use App\Models\Template;
|
||||
use App\Models\TemplateLayoutAttachment;
|
||||
use App\Services\TemplateLayoutAttachmentService;
|
||||
use Mockery;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* 템플릿 레이아웃 첨부 디스크 인지 서빙 테스트 (공개 #99 / 내부 #563)
|
||||
*
|
||||
* PublicAttachmentController 이미지 서빙과 동형 결함 — getServableFilePath 가
|
||||
* getBasePath 로 로컬 절대 경로를 조립해 S3 디스크 행에서 fileResponse(filemtime)가
|
||||
* 500 이 나던 구조의 회귀 가드. 서빙은 StorageInterface::response() 스트림으로
|
||||
* 디스크 무관하게 성립해야 한다.
|
||||
*/
|
||||
class TemplateLayoutAttachmentServingTest extends TestCase
|
||||
{
|
||||
private TemplateLayoutAttachmentService $service;
|
||||
|
||||
private $templateRepository;
|
||||
|
||||
private $storage;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$repository = Mockery::mock(TemplateLayoutAttachmentRepositoryInterface::class);
|
||||
$this->templateRepository = Mockery::mock(TemplateRepositoryInterface::class);
|
||||
$this->storage = Mockery::mock(StorageInterface::class);
|
||||
|
||||
$this->service = new TemplateLayoutAttachmentService(
|
||||
$repository,
|
||||
$this->templateRepository,
|
||||
$this->storage
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 소속 템플릿 첨부를 만듭니다 (DB 미저장).
|
||||
*/
|
||||
private function makeAttachment(int $templateId, string $disk = 's3'): TemplateLayoutAttachment
|
||||
{
|
||||
$attachment = new TemplateLayoutAttachment([
|
||||
'layout_name' => 'home',
|
||||
'disk' => $disk,
|
||||
'path' => 'sirsoft-basic/home/bg.png',
|
||||
'original_name' => 'bg.png',
|
||||
'mime_type' => 'image/png',
|
||||
'size' => 70,
|
||||
]);
|
||||
$attachment->template_id = $templateId;
|
||||
|
||||
return $attachment;
|
||||
}
|
||||
|
||||
/**
|
||||
* s3 디스크 행이 StorageInterface::response() 스트림으로 서빙 정보를 반환해야 합니다.
|
||||
*
|
||||
* @scenario region_shape=aws_region,endpoint=absent,driver_usability=adapter_present,attachment_disk=follow_s3
|
||||
*
|
||||
* @effects attachment_upload_follows_driver
|
||||
*/
|
||||
public function test_s3_disk_attachment_returns_streamed_response(): void
|
||||
{
|
||||
$template = new Template;
|
||||
$template->id = 7;
|
||||
$this->templateRepository->shouldReceive('findByIdentifier')
|
||||
->with('sirsoft-basic')->andReturn($template);
|
||||
|
||||
$stream = new StreamedResponse(function () {
|
||||
echo 'bytes';
|
||||
}, 200, ['Content-Type' => 'image/png']);
|
||||
|
||||
$this->storage->shouldReceive('withDisk')->with('s3')->andReturnSelf();
|
||||
$this->storage->shouldReceive('response')->andReturn($stream);
|
||||
|
||||
$result = $this->service->getServableResponse('sirsoft-basic', $this->makeAttachment(7));
|
||||
|
||||
$this->assertNotNull($result);
|
||||
$this->assertSame($stream, $result['response']);
|
||||
$this->assertNotEmpty($result['etag_source']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 경로 템플릿과 첨부 소속이 다르면 null 이어야 합니다 (교차 템플릿 접근 차단 유지).
|
||||
*/
|
||||
public function test_cross_template_access_returns_null(): void
|
||||
{
|
||||
$template = new Template;
|
||||
$template->id = 7;
|
||||
$this->templateRepository->shouldReceive('findByIdentifier')
|
||||
->with('sirsoft-basic')->andReturn($template);
|
||||
|
||||
$result = $this->service->getServableResponse('sirsoft-basic', $this->makeAttachment(99));
|
||||
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 스토리지에 파일이 없으면(response null) null 이어야 합니다.
|
||||
*/
|
||||
public function test_missing_file_returns_null(): void
|
||||
{
|
||||
$template = new Template;
|
||||
$template->id = 7;
|
||||
$this->templateRepository->shouldReceive('findByIdentifier')
|
||||
->with('sirsoft-basic')->andReturn($template);
|
||||
|
||||
$this->storage->shouldReceive('withDisk')->with('s3')->andReturnSelf();
|
||||
$this->storage->shouldReceive('response')->andReturnNull();
|
||||
|
||||
$result = $this->service->getServableResponse('sirsoft-basic', $this->makeAttachment(7));
|
||||
|
||||
$this->assertNull($result);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user