From 7167ce41b61d2ba2cdb526777a4233eb84a3b66a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 6 Dec 2014 17:33:25 -0500 Subject: Imported Upstream version 2.99.6 --- SQLiteStudio3/Tests/TestUtils/mocks.cpp | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 SQLiteStudio3/Tests/TestUtils/mocks.cpp (limited to 'SQLiteStudio3/Tests/TestUtils/mocks.cpp') diff --git a/SQLiteStudio3/Tests/TestUtils/mocks.cpp b/SQLiteStudio3/Tests/TestUtils/mocks.cpp new file mode 100644 index 0000000..dee3bfd --- /dev/null +++ b/SQLiteStudio3/Tests/TestUtils/mocks.cpp @@ -0,0 +1,37 @@ +#include "mocks.h" +#include "common/global.h" +#include "sqlitestudio.h" +#include "configmock.h" +#include "pluginmanagermock.h" +#include "functionmanagermock.h" +#include "collationmanagermock.h" +#include "dbattachermock.h" +#include "dbmanagermock.h" + +MockRepository* mockRepository = nullptr; + +MockRepository& mockRepo() +{ + if (!mockRepository) + { + mockRepository = new MockRepository; + mockRepository->autoExpect = false; + } + + return *mockRepository; +} + +void deleteMockRepo() +{ + safe_delete(mockRepository); +} + +void initMocks() +{ + SQLITESTUDIO->setConfig(new ConfigMock()); + SQLITESTUDIO->setFunctionManager(new FunctionManagerMock()); + SQLITESTUDIO->setPluginManager(new PluginManagerMock()); + SQLITESTUDIO->setDbAttacherFactory(new DbAttacherFactoryMock()); + SQLITESTUDIO->setDbManager(new DbManagerMock()); + SQLITESTUDIO->setCollationManager(new CollationManagerMock()); +} -- cgit v1.2.3