1 /**
2  * Copyright © 2024 IBM Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include "pmbus.hpp"
19 
20 #include <gmock/gmock.h>
21 
22 namespace phosphor::pmbus
23 {
24 
25 /**
26  * @class MockPMBus
27  *
28  * Mock implementation of the PMBusBase interface.
29  */
30 class MockPMBus : public PMBusBase
31 {
32   public:
33     // Specify which compiler-generated methods we want
34     MockPMBus() = default;
35     MockPMBus(const MockPMBus&) = delete;
36     MockPMBus(MockPMBus&&) = delete;
37     MockPMBus& operator=(const MockPMBus&) = delete;
38     MockPMBus& operator=(MockPMBus&&) = delete;
39     virtual ~MockPMBus() = default;
40 
41     MOCK_METHOD(uint64_t, read,
42                 (const std::string& name, Type type, bool errTrace),
43                 (override));
44     MOCK_METHOD(std::string, readString, (const std::string& name, Type type),
45                 (override));
46     MOCK_METHOD(std::vector<uint8_t>, readBinary,
47                 (const std::string& name, Type type, size_t length),
48                 (override));
49     MOCK_METHOD(void, writeBinary,
50                 (const std::string& name, std::vector<uint8_t> data, Type type),
51                 (override));
52     MOCK_METHOD(void, findHwmonDir, (), (override));
53     MOCK_METHOD(const fs::path&, path, (), (const, override));
54     MOCK_METHOD(std::string, insertPageNum,
55                 (const std::string& templateName, size_t page), (override));
56 };
57 
58 } // namespace phosphor::pmbus
59