TestGlobalConfigOmitProjectNameDefault tests the global config flag handling
(t *testing.T)
| 1201 | |
| 1202 | // TestGlobalConfigOmitProjectNameDefault tests the global config flag handling |
| 1203 | func TestGlobalConfigOmitProjectNameDefault(t *testing.T) { |
| 1204 | assert := asrt.New(t) |
| 1205 | |
| 1206 | // Create temporary XDG_CONFIG_HOME for isolated testing |
| 1207 | tmpXdgConfigHomeDir := testcommon.CopyGlobalDdevDir(t) |
| 1208 | |
| 1209 | t.Cleanup(func() { |
| 1210 | testcommon.ResetGlobalDdevDir(t, tmpXdgConfigHomeDir) |
| 1211 | }) |
| 1212 | |
| 1213 | // Ensure global config exists |
| 1214 | globalconfig.EnsureGlobalConfig() |
| 1215 | |
| 1216 | // Test setting to true directly (avoids subprocess environment variable issues) |
| 1217 | globalconfig.DdevGlobalConfig.OmitProjectNameByDefault = true |
| 1218 | err := globalconfig.WriteGlobalConfig(globalconfig.DdevGlobalConfig) |
| 1219 | require.NoError(t, err) |
| 1220 | |
| 1221 | err = globalconfig.ReadGlobalConfig() |
| 1222 | require.NoError(t, err) |
| 1223 | assert.True(globalconfig.DdevGlobalConfig.OmitProjectNameByDefault) |
| 1224 | |
| 1225 | // Test setting to false |
| 1226 | globalconfig.DdevGlobalConfig.OmitProjectNameByDefault = false |
| 1227 | err = globalconfig.WriteGlobalConfig(globalconfig.DdevGlobalConfig) |
| 1228 | require.NoError(t, err) |
| 1229 | |
| 1230 | err = globalconfig.ReadGlobalConfig() |
| 1231 | require.NoError(t, err) |
| 1232 | assert.False(globalconfig.DdevGlobalConfig.OmitProjectNameByDefault) |
| 1233 | } |
nothing calls this directly
no test coverage detected