assertNotEmpty($options); $this->assertSame('account_owner', $options[0]['name']); } public function test_options_for_returns_empty_for_unknown_slug(): void { $this->assertSame([], PaymentMethod::optionsFor('DOES_NOT_EXIST')); } public function test_required_option_keys_only_returns_required(): void { $keys = PaymentMethod::requiredOptionKeys(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION); $this->assertContains('account_owner', $keys); $this->assertContains('iban', $keys); $this->assertNotContains('bic', $keys); // bic ist optional } public function test_sanitize_configuration_drops_unknown_keys(): void { $sanitized = PaymentMethod::sanitizeConfiguration(PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION, [ 'iban' => 'DE123', 'account_owner' => 'Kasse', 'evil' => 'x', ]); $this->assertArrayHasKey('iban', $sanitized); $this->assertArrayHasKey('account_owner', $sanitized); $this->assertArrayNotHasKey('evil', $sanitized); } public function test_is_configuration_complete_requires_all_required_options(): void { $slug = PaymentMethod::PAYMENT_ACCOUNT_TRANSACTION; $this->assertFalse(PaymentMethod::isConfigurationComplete($slug, [])); $this->assertFalse(PaymentMethod::isConfigurationComplete($slug, ['iban' => 'DE123'])); $this->assertFalse(PaymentMethod::isConfigurationComplete($slug, ['iban' => 'DE123', 'account_owner' => ''])); $this->assertTrue(PaymentMethod::isConfigurationComplete($slug, ['iban' => 'DE123', 'account_owner' => 'Kasse'])); } public function test_unknown_slug_is_always_complete(): void { // Kein Modul -> keine Pflichtfelder -> stets vollständig. $this->assertTrue(PaymentMethod::isConfigurationComplete('NO_MODULE', [])); } }