blob: 6c0d906efb00a974ef3646d6277bf03fffb41c30 [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
Shawn McCarney24956592024-02-19 18:58:57 -060026using MockPMBus = phosphor::pmbus::MockPMBus;
27
Shawn McCarney906cc3f2024-02-01 13:33:06 -060028/**
29 * @class MockServices
30 *
31 * Mock implementation of the Services interface.
32 */
33class 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,
Shawn McCarneye4fef0f2024-04-05 17:56:09 -050049 (std::map<std::string, std::string> & additionalData)),
Shawn McCarney906cc3f2024-02-01 13:33:06 -060050 (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>
Shawn McCarneye4fef0f2024-04-05 17:56:09 -050057 createPMBus(uint8_t, uint16_t, const std::string&, size_t) override
Shawn McCarney906cc3f2024-02-01 13:33:06 -060058 {
59 return std::make_unique<MockPMBus>();
60 }
Shawn McCarneye4fef0f2024-04-05 17:56:09 -050061
62 MOCK_METHOD(void, clearCache, (), (override));
Shawn McCarney906cc3f2024-02-01 13:33:06 -060063};
64
65} // namespace phosphor::power::sequencer