blob: 78ccbc22c056b943f7a8684eb42af95a9cff468d [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,
47 std::map<std::string, std::string>& additionalData),
48 (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>
55 createPMBus(uint8_t bus, uint16_t address,
56 const std::string& driverName = "",
57 size_t instance = 0) override
58 {
59 return std::make_unique<MockPMBus>();
60 }
61};
62
63} // namespace phosphor::power::sequencer