assertSame('composable_products', $settings->get_id()); } public function testGetSettings_ReturnsExpectedFieldIds(): void { Functions\expect('apply_filters') ->once() ->with('wc_composable_settings', \Mockery::type('array')) ->andReturnUsing(function ($hook, $settings) { return $settings; }); $settings = new Settings(); $fields = $settings->get_settings(); // Extract all field IDs $ids = array_column($fields, 'id'); $this->assertContains('wc_composable_settings', $ids); $this->assertContains('wc_composable_default_limit', $ids); $this->assertContains('wc_composable_default_pricing', $ids); $this->assertContains('wc_composable_include_unpublished', $ids); $this->assertContains('wc_composable_show_images', $ids); $this->assertContains('wc_composable_show_prices', $ids); $this->assertContains('wc_composable_show_total', $ids); } public function testGetSettings_HasCorrectFieldTypes(): void { Functions\expect('apply_filters') ->once() ->andReturnUsing(function ($hook, $settings) { return $settings; }); $settings = new Settings(); $fields = $settings->get_settings(); // Index fields by ID for easy lookup $indexed = []; foreach ($fields as $field) { if (isset($field['id'])) { $indexed[$field['id']] = $field; } } $this->assertSame('number', $indexed['wc_composable_default_limit']['type']); $this->assertSame('select', $indexed['wc_composable_default_pricing']['type']); $this->assertSame('checkbox', $indexed['wc_composable_include_unpublished']['type']); $this->assertSame('checkbox', $indexed['wc_composable_show_images']['type']); } public function testGetSettings_AppliesFilter(): void { Functions\expect('apply_filters') ->once() ->with('wc_composable_settings', \Mockery::type('array')) ->andReturnUsing(function ($hook, $settings) { return $settings; }); $settings = new Settings(); $settings->get_settings(); } }