blob: 6337dbf26462692b441c034884a03a4433f66b44 [file] [log] [blame]
Shawn McCarney906cc3f2024-02-01 13:33:06 -06001/**
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
Shawn McCarneyfb0ccb82024-04-24 13:14:41 -050020#include <filesystem>
21
Shawn McCarney906cc3f2024-02-01 13:33:06 -060022#include <gmock/gmock.h>
23
24namespace phosphor::pmbus
25{
26
Shawn McCarneyfb0ccb82024-04-24 13:14:41 -050027namespace fs = std::filesystem;
28
Shawn McCarney906cc3f2024-02-01 13:33:06 -060029/**
30 * @class MockPMBus
31 *
32 * Mock implementation of the PMBusBase interface.
33 */
34class MockPMBus : public PMBusBase
35{
36 public:
37 // Specify which compiler-generated methods we want
38 MockPMBus() = default;
39 MockPMBus(const MockPMBus&) = delete;
40 MockPMBus(MockPMBus&&) = delete;
41 MockPMBus& operator=(const MockPMBus&) = delete;
42 MockPMBus& operator=(MockPMBus&&) = delete;
43 virtual ~MockPMBus() = default;
44
45 MOCK_METHOD(uint64_t, read,
46 (const std::string& name, Type type, bool errTrace),
47 (override));
48 MOCK_METHOD(std::string, readString, (const std::string& name, Type type),
49 (override));
50 MOCK_METHOD(std::vector<uint8_t>, readBinary,
51 (const std::string& name, Type type, size_t length),
52 (override));
53 MOCK_METHOD(void, writeBinary,
54 (const std::string& name, std::vector<uint8_t> data, Type type),
55 (override));
56 MOCK_METHOD(void, findHwmonDir, (), (override));
57 MOCK_METHOD(const fs::path&, path, (), (const, override));
58 MOCK_METHOD(std::string, insertPageNum,
59 (const std::string& templateName, size_t page), (override));
Shawn McCarneyfb0ccb82024-04-24 13:14:41 -050060 MOCK_METHOD(fs::path, getPath, (Type type), (override));
Shawn McCarney906cc3f2024-02-01 13:33:06 -060061};
62
63} // namespace phosphor::pmbus