assertTrue(ExtensionTestAllowlist::isAllowed('plugin', 'sirsoft-gdpr')); $this->assertTrue(ExtensionTestAllowlist::isAllowed('module', 'sirsoft-ecommerce')); } public function test_is_allowed_returns_false_for_extension_outside_allowlist(): void { ExtensionTestAllowlist::set(['plugins/sirsoft-gdpr']); $this->assertFalse(ExtensionTestAllowlist::isAllowed('plugin', 'sirsoft-marketing')); $this->assertFalse(ExtensionTestAllowlist::isAllowed('module', 'sirsoft-gdpr')); $this->assertFalse(ExtensionTestAllowlist::isAllowed('unknown', 'sirsoft-gdpr')); } /** * @effects set_normalizes_trailing_slash */ public function test_set_normalizes_trailing_slash(): void { ExtensionTestAllowlist::set(['plugins/sirsoft-gdpr/']); $this->assertTrue(ExtensionTestAllowlist::isAllowed('plugin', 'sirsoft-gdpr')); } /** * @effects set_ignores_prefixless_entries */ public function test_set_ignores_prefixless_entries(): void { ExtensionTestAllowlist::set(['sirsoft-gdpr', 'templates/sirsoft-basic']); $this->assertFalse(ExtensionTestAllowlist::isAllowed('plugin', 'sirsoft-gdpr')); $this->assertFalse(ExtensionTestAllowlist::isAllowed('module', 'sirsoft-gdpr')); } /** * @effects allowlist_active_when_testing_and_configured */ public function test_is_active_returns_true_when_testing_env_and_configured(): void { ExtensionTestAllowlist::set([]); // phpunit.xml 의 APP_ENV=testing + 명시적 set → 가드 활성 $this->assertTrue(ExtensionTestAllowlist::isActive()); } /** * @effects empty_allowlist_is_active_and_blocks_all_extensions */ public function test_empty_allowlist_is_active_and_blocks_all_extensions(): void { // 빈 allowlist = core-only 테스트 → 가드는 활성, 모든 확장이 차단됨 ExtensionTestAllowlist::set([]); $this->assertTrue(ExtensionTestAllowlist::isActive()); $this->assertFalse(ExtensionTestAllowlist::isAllowed('plugin', 'sirsoft-gdpr')); } /** * @effects reset_deactivates_guard */ public function test_reset_deactivates_guard(): void { ExtensionTestAllowlist::set(['plugins/sirsoft-gdpr']); ExtensionTestAllowlist::reset(); $this->assertFalse(ExtensionTestAllowlist::isActive()); $this->assertFalse(ExtensionTestAllowlist::isAllowed('plugin', 'sirsoft-gdpr')); } /** * @effects set_recall_replaces_previous_allowlist */ public function test_set_recall_replaces_previous_allowlist(): void { ExtensionTestAllowlist::set(['plugins/sirsoft-gdpr']); ExtensionTestAllowlist::set(['plugins/sirsoft-marketing']); $this->assertFalse(ExtensionTestAllowlist::isAllowed('plugin', 'sirsoft-gdpr')); $this->assertTrue(ExtensionTestAllowlist::isAllowed('plugin', 'sirsoft-marketing')); } /** * @effects allowlist_inactive_when_app_env_not_testing, production_env_keeps_full_extension_loading */ public function test_is_active_returns_false_in_non_testing_env_even_when_configured(): void { ExtensionTestAllowlist::set(['plugins/sirsoft-gdpr']); // 운영/개발 환경에서는 가드가 비활성 → 확장 전수 로딩 보존 $this->app['env'] = 'production'; $this->assertFalse(ExtensionTestAllowlist::isActive()); // 후속 테스트 보호: 환경 복원 $this->app['env'] = 'testing'; } }