blob: 0c64e0052406867fcb64fdb0d2f30c642c9facd2 [file] [log] [blame]
Brandon Wyman3f1242f2020-01-28 13:11:25 -06001#pragma once
2
3#include "pmbus.hpp"
4#include "util_base.hpp"
5
6#include <gmock/gmock.h>
7
8namespace phosphor
9{
10namespace pmbus
11{
12class 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
23namespace power
24{
25namespace psu
26{
27class 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
37static std::unique_ptr<MockedUtil> util;
38inline const UtilBase& getUtils()
39{
40 if (!util)
41 {
42 util = std::make_unique<MockedUtil>();
43 }
44 return *util;
45}
46
47inline void freeUtils()
48{
49 util.reset();
50}
51
52} // namespace psu
53} // namespace power
54
55} // namespace phosphor