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 "mock_pmbus.hpp"
19 #include "services.hpp"
20 
21 #include <gmock/gmock.h>
22 
23 namespace phosphor::power::sequencer
24 {
25 
26 using MockPMBus = phosphor::pmbus::MockPMBus;
27 
28 /**
29  * @class MockServices
30  *
31  * Mock implementation of the Services interface.
32  */
33 class MockServices : public Services
34 {
35   public:
36     // Specify which compiler-generated methods we want
37     MockServices() = default;
38     MockServices(const MockServices&) = delete;
39     MockServices(MockServices&&) = delete;
40     MockServices& operator=(const MockServices&) = delete;
41     MockServices& operator=(MockServices&&) = delete;
42     virtual ~MockServices() = default;
43 
44     MOCK_METHOD(sdbusplus::bus_t&, getBus, (), (override));
45     MOCK_METHOD(void, logErrorMsg, (const std::string& message), (override));
46     MOCK_METHOD(void, logInfoMsg, (const std::string& message), (override));
47     MOCK_METHOD(void, logError,
48                 (const std::string& message, Entry::Level severity,
49                  (std::map<std::string, std::string> & additionalData)),
50                 (override));
51     MOCK_METHOD(bool, isPresent, (const std::string& inventoryPath),
52                 (override));
53     MOCK_METHOD(std::vector<int>, getGPIOValues, (const std::string& chipLabel),
54                 (override));
55 
56     virtual std::unique_ptr<PMBusBase>
57         createPMBus(uint8_t, uint16_t, const std::string&, size_t) override
58     {
59         return std::make_unique<MockPMBus>();
60     }
61 
62     MOCK_METHOD(void, createBMCDump, (), (override));
63     MOCK_METHOD(void, clearCache, (), (override));
64 };
65 
66 } // namespace phosphor::power::sequencer
67