1 #pragma once 2 3 #include "pmbus.hpp" 4 #include "util_base.hpp" 5 6 #include <gmock/gmock.h> 7 8 namespace phosphor 9 { 10 namespace pmbus 11 { 12 class MockedPMBus : public PMBusBase 13 { 14 15 public: 16 virtual ~MockedPMBus() = default; 17 18 MOCK_METHOD(uint64_t, read, (const std::string& name, Type type), 19 (override)); 20 }; 21 } // namespace pmbus 22 23 namespace power 24 { 25 namespace psu 26 { 27 class MockedUtil : public UtilBase 28 { 29 public: 30 virtual ~MockedUtil() = default; 31 32 MOCK_METHOD(bool, getPresence, 33 (sdbusplus::bus::bus & bus, const std::string& invpath), 34 (const, override)); 35 }; 36 37 static std::unique_ptr<MockedUtil> util; 38 inline const UtilBase& getUtils() 39 { 40 if (!util) 41 { 42 util = std::make_unique<MockedUtil>(); 43 } 44 return *util; 45 } 46 47 inline void freeUtils() 48 { 49 util.reset(); 50 } 51 52 } // namespace psu 53 } // namespace power 54 55 } // namespace phosphor 56