diff options
| author | 2014-12-06 17:33:25 -0500 | |
|---|---|---|
| committer | 2014-12-06 17:33:25 -0500 | |
| commit | 7167ce41b61d2ba2cdb526777a4233eb84a3b66a (patch) | |
| tree | a35c14143716e1f2c98f808c81f89426045a946f /SQLiteStudio3/Tests/TestUtils/mocks.cpp | |
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'SQLiteStudio3/Tests/TestUtils/mocks.cpp')
| -rw-r--r-- | SQLiteStudio3/Tests/TestUtils/mocks.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
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()); +} |
