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.
		
		
		
		
		
			
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Objective-C
		
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Objective-C
		
	
| //
 | |
| //  Copyright (c) 2018 Open Whisper Systems. All rights reserved.
 | |
| //
 | |
| 
 | |
| #import "SignalBaseTest.h"
 | |
| #import "Environment.h"
 | |
| #import <SignalServiceKit/OWSPrimaryStorage.h>
 | |
| #import <SignalServiceKit/TestAppContext.h>
 | |
| 
 | |
| NS_ASSUME_NONNULL_BEGIN
 | |
| 
 | |
| @implementation SignalBaseTest
 | |
| 
 | |
| - (void)setUp
 | |
| {
 | |
|     OWSLogInfo(@"");
 | |
| 
 | |
|     [super setUp];
 | |
| 
 | |
|     ClearCurrentAppContextForTests();
 | |
|     [Environment clearSharedForTests];
 | |
|     [SSKEnvironment clearSharedForTests];
 | |
| 
 | |
|     SetCurrentAppContext([TestAppContext new]);
 | |
| 
 | |
|     [MockSSKEnvironment activate];
 | |
|     [MockEnvironment activate];
 | |
| }
 | |
| 
 | |
| - (void)tearDown
 | |
| {
 | |
|     OWSLogInfo(@"");
 | |
| 
 | |
|     [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
 | |
| 
 | |
| NS_ASSUME_NONNULL_END
 |