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