regulators: Add PhaseFaultDetection to Device

Add a PhaseFaultDetection data member to the Device class.  This is the
first step in enabling phase fault detection for Device objects.

Create and modify gtest test cases to exercise new code.

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Icc771eda5c79ace854acb1d7c395b82b34213996
diff --git a/phosphor-regulators/src/config_file_parser.cpp b/phosphor-regulators/src/config_file_parser.cpp
index 430d490..619a8b6 100644
--- a/phosphor-regulators/src/config_file_parser.cpp
+++ b/phosphor-regulators/src/config_file_parser.cpp
@@ -394,6 +394,20 @@
         ++propertyCount;
     }
 
+    // Optional phase_fault_detection property
+    std::unique_ptr<PhaseFaultDetection> phaseFaultDetection{};
+    auto phaseFaultDetectionIt = element.find("phase_fault_detection");
+    if (phaseFaultDetectionIt != element.end())
+    {
+        if (!isRegulator)
+        {
+            throw std::invalid_argument{"Invalid phase_fault_detection "
+                                        "property when is_regulator is false"};
+        }
+        phaseFaultDetection = parsePhaseFaultDetection(*phaseFaultDetectionIt);
+        ++propertyCount;
+    }
+
     // Optional rails property
     std::vector<std::unique_ptr<Rail>> rails{};
     auto railsIt = element.find("rails");
@@ -411,10 +425,10 @@
     // Verify no invalid properties exist
     verifyPropertyCount(element, propertyCount);
 
-    return std::make_unique<Device>(id, isRegulator, fru,
-                                    std::move(i2cInterface),
-                                    std::move(presenceDetection),
-                                    std::move(configuration), std::move(rails));
+    return std::make_unique<Device>(
+        id, isRegulator, fru, std::move(i2cInterface),
+        std::move(presenceDetection), std::move(configuration),
+        std::move(phaseFaultDetection), std::move(rails));
 }
 
 std::vector<std::unique_ptr<Device>> parseDeviceArray(const json& element)