File indexing completed on 2024-11-10 04:40:21
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2006 Till Adam <adam@kde.org> * 0003 * * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later * 0005 ***************************************************************************/ 0006 0007 #pragma once 0008 0009 #include "akonadiconnection.h" 0010 #include "teststoragebackend.h" 0011 0012 using namespace Akonadi; 0013 0014 static AkonadiConnection *s_connection = nullptr; 0015 static DataStore *s_backend = nullptr; 0016 0017 class MockConnection : public AkonadiConnection 0018 { 0019 public: 0020 MockConnection() 0021 { 0022 } 0023 DataStore *storageBackend() 0024 { 0025 if (!s_backend) { 0026 s_backend = new MockBackend(); 0027 } 0028 return s_backend; 0029 } 0030 }; 0031 0032 class MockObjects 0033 { 0034 public: 0035 MockObjects(); 0036 ~MockObjects(); 0037 0038 static AkonadiConnection *mockConnection() 0039 { 0040 if (!s_connection) { 0041 s_connection = new MockConnection(); 0042 } 0043 return s_connection; 0044 } 0045 }; // End of class MockObjects