@@ -46,7 +46,7 @@ - (void)tearDown {
4646 BOOL isOpen = [task.result boolValue ];
4747
4848 if (isOpen) {
49- return [database closeAsync ];
49+ return [self -> database closeAsync ];
5050 }
5151 return task;
5252 }] waitUntilFinished ];
@@ -63,6 +63,7 @@ - (void)tearDown {
6363
6464// Should return BFTask to not waste `waitUntilFinished`
6565- (BFTask *)createDatabaseAsync {
66+ PFSQLiteDatabase *database = self->database ;
6667 // Drop existing database first if any.
6768 return [[[[database openAsync ] continueWithBlock: ^id (BFTask *task) {
6869 return [database executeSQLAsync: @" DROP TABLE test" withArgumentsInArray: nil ];
@@ -79,6 +80,7 @@ - (BFTask *)createDatabaseAsync {
7980// /--------------------------------------
8081
8182- (void )testOpen {
83+ PFSQLiteDatabase *database = self->database ;
8284 [[[[[[[[[database openAsync ] continueWithBlock: ^id (BFTask *task) {
8385 return [database isOpenAsync ];
8486 }] continueWithBlock: ^id (BFTask *task) {
@@ -104,6 +106,7 @@ - (void)testOpen {
104106}
105107
106108- (void )testCRUD {
109+ PFSQLiteDatabase *database = self->database ;
107110 [[[[[[[[[[[[database openAsync ] continueWithBlock: ^id (BFTask *task) {
108111 return [database executeSQLAsync: @" CREATE TABLE test (a text, b text, c integer, d double)"
109112 withArgumentsInArray: nil ];
@@ -185,6 +188,7 @@ - (void)testCRUD {
185188
186189// TODO (hallucinogen): this test consists of three units which can be separated.
187190- (void )testTransaction {
191+ PFSQLiteDatabase *database = self->database ;
188192 [[[[[[[[[[[[[[[[[self createDatabaseAsync ] continueWithBlock: ^id (BFTask *task) {
189193 return [database beginTransactionAsync ];
190194 }] continueWithBlock: ^id (BFTask *task) {
@@ -281,7 +285,8 @@ - (void)testTransaction {
281285 return [BFTask taskWithResult: nil ];
282286 }] waitUntilFinished ];
283287
284- database = [PFSQLiteDatabase databaseWithPath: [self databasePath ]];
288+ self->database = [PFSQLiteDatabase databaseWithPath: [self databasePath ]];
289+ database = self->database ;
285290 [[[[[[[database openAsync ] continueWithBlock: ^id (BFTask *task) {
286291 XCTAssertNil (task.error );
287292 return [database executeSQLAsync: @" INSERT INTO test (a, b, c, d) VALUES (?, ?, ?, ?)"
@@ -322,6 +327,7 @@ - (void)testTransaction {
322327}
323328
324329- (void )testOperationOnNonExistentTable {
330+ PFSQLiteDatabase *database = self->database ;
325331 [[[[[[[self createDatabaseAsync ] continueWithBlock: ^id (BFTask *task) {
326332 return [database executeSQLAsync: @" INSERT INTO testFake (a, b, c, d) VALUES (?, ?, ?, ?)"
327333 withArgumentsInArray: @[ @" one" , @" two" , @3 , @4.4 ]];
@@ -351,6 +357,7 @@ - (void)testOperationOnNonExistentTable {
351357}
352358
353359- (void )testQuery {
360+ PFSQLiteDatabase *database = self->database ;
354361 [[[[[[[[[self createDatabaseAsync ] continueWithBlock: ^id (BFTask *task) {
355362 return [database executeSQLAsync: @" INSERT INTO test (a, b, c, d) VALUES (?, ?, ?, ?)"
356363 withArgumentsInArray: @[ @" one" , @" two" , @3 , @4.4 ]];
@@ -413,6 +420,7 @@ - (void)testQuery {
413420}
414421
415422- (void )testCursorAndOperationOnDifferentThread {
423+ PFSQLiteDatabase *database = self->database ;
416424 BFTask *taskWithCursor = [[[[[self createDatabaseAsync ] continueWithBlock: ^id (BFTask *task) {
417425 return [database executeSQLAsync: @" INSERT INTO test (a, b, c, d) VALUES (?, ?, ?, ?)"
418426 withArgumentsInArray: @[ @" one" , @" two" , @3 , @4.4 ]];
@@ -468,6 +476,7 @@ - (void)testCursorAndOperationOnDifferentThread {
468476}
469477
470478- (void )testInvalidArgumentCount {
479+ PFSQLiteDatabase *database = self->database ;
471480 [[[[self createDatabaseAsync ] continueWithBlock: ^id (BFTask *task) {
472481 return [database executeSQLAsync: @" INSERT INTO test (a, b, c, d) VALUES (?, ?, ?)"
473482 withArgumentsInArray: @[ @" one" , @" two" , @3 , @4.4 ]];
@@ -479,6 +488,7 @@ - (void)testInvalidArgumentCount {
479488}
480489
481490- (void )testInvalidSQL {
491+ PFSQLiteDatabase *database = self->database ;
482492 [[[[[self createDatabaseAsync ] continueWithBlock: ^id (BFTask *task) {
483493 return [database executeSQLAsync: @" INSERT INTO test (a, b, c, d) VALUES (?, ?, ?, ?)"
484494 withArgumentsInArray: @[ @" one" , @" two" , @3 , @4.4 ]];
@@ -492,6 +502,7 @@ - (void)testInvalidSQL {
492502}
493503
494504- (void )testColumnTypes {
505+ PFSQLiteDatabase *database = self->database ;
495506 [[[[[self createDatabaseAsync ] continueWithBlock: ^id (BFTask *task) {
496507 return [database executeSQLAsync: @" INSERT INTO test (a, b, c, d) VALUES (?, ?, ?, ?)"
497508 withArgumentsInArray: @[ @1 , [NSNull null ], @" string" , @13.37 ]];
0 commit comments