mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			60 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Objective-C
		
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Objective-C
		
	
| //
 | |
| //  Copyright (c) 2018 Open Whisper Systems. All rights reserved.
 | |
| //
 | |
| 
 | |
| #import "SSKBaseTestObjC.h"
 | |
| #import "OWSPrimaryStorage.h"
 | |
| #import "SSKEnvironment.h"
 | |
| #import "TestAppContext.h"
 | |
| 
 | |
| @import CocoaLumberjack;
 | |
| #import <CocoaLumberjack/DDTTYLogger.h>
 | |
| 
 | |
| NS_ASSUME_NONNULL_BEGIN
 | |
| 
 | |
| #ifdef DEBUG
 | |
| 
 | |
| @implementation SSKBaseTestObjC
 | |
| 
 | |
| - (void)setUp
 | |
| {
 | |
|     OWSLogInfo(@"%@ setUp", self.logTag);
 | |
| 
 | |
|     [super setUp];
 | |
| 
 | |
|     [DDLog addLogger:DDTTYLogger.sharedInstance];
 | |
| 
 | |
|     ClearCurrentAppContextForTests();
 | |
|     SetCurrentAppContext([TestAppContext new]);
 | |
| 
 | |
|     [MockSSKEnvironment activate];
 | |
| }
 | |
| 
 | |
| - (void)tearDown
 | |
| {
 | |
|     OWSLogInfo(@"%@ tearDown", self.logTag);
 | |
| 
 | |
|     [super tearDown];
 | |
| }
 | |
| 
 | |
| - (void)readWithBlock:(void (^)(YapDatabaseReadTransaction *transaction))block
 | |
| {
 | |
|     OWSAssert(block);
 | |
| 
 | |
|     [[SSKEnvironment.shared.primaryStorage newDatabaseConnection] readWithBlock:block];
 | |
| }
 | |
| 
 | |
| 
 | |
| - (void)readWriteWithBlock:(void (^)(YapDatabaseReadWriteTransaction *transaction))block
 | |
| {
 | |
|     OWSAssert(block);
 | |
| 
 | |
|     [[SSKEnvironment.shared.primaryStorage newDatabaseConnection] readWriteWithBlock:block];
 | |
| }
 | |
| 
 | |
| @end
 | |
| 
 | |
| #endif
 | |
| 
 | |
| NS_ASSUME_NONNULL_END
 |