aboutsummaryrefslogtreecommitdiffstats
path: root/UnitTests
diff options
context:
space:
mode:
Diffstat (limited to 'UnitTests')
-rw-r--r--UnitTests/SPDatabaseInfoTest.h8
-rw-r--r--UnitTests/SPDatabaseInfoTest.m24
-rw-r--r--UnitTests/SPDatabaseRenameTest.h6
-rw-r--r--UnitTests/SPDatabaseRenameTest.m27
4 files changed, 39 insertions, 26 deletions
diff --git a/UnitTests/SPDatabaseInfoTest.h b/UnitTests/SPDatabaseInfoTest.h
index 81763b4a..ed0093c5 100644
--- a/UnitTests/SPDatabaseInfoTest.h
+++ b/UnitTests/SPDatabaseInfoTest.h
@@ -23,18 +23,14 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
-#define USE_APPLICATION_UNIT_TEST 1
-
#import <SenTestingKit/SenTestingKit.h>
+#define USE_APPLICATION_UNIT_TEST 1
-@interface SPDatabaseInfoTest : SenTestCase {
-
-}
+@interface SPDatabaseInfoTest : SenTestCase
- (void)testDatabaseExists;
- (void)testListDBs;
- (void)testListDBsLike;
-
@end
diff --git a/UnitTests/SPDatabaseInfoTest.m b/UnitTests/SPDatabaseInfoTest.m
index a53104e9..fc2309e3 100644
--- a/UnitTests/SPDatabaseInfoTest.m
+++ b/UnitTests/SPDatabaseInfoTest.m
@@ -24,28 +24,35 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import <OCMock/OCMock.h>
+
#import "SPDatabaseInfo.h"
#import "SPDatabaseInfoTest.h"
-
@implementation SPDatabaseInfoTest
-- (SPDatabaseInfo *)getDatabaseInfoFixture {
+- (SPDatabaseInfo *)getDatabaseInfoFixture
+{
SPDatabaseInfo *dbInfo = [[SPDatabaseInfo alloc] init];
+
return dbInfo;
}
-- (id) getMockConnection {
+- (id) getMockConnection
+{
id mockConnection = [OCMockObject niceMockForClass:[MCPConnection class]];
+
return mockConnection;
}
-- (id) getMockMCPResult {
+- (id) getMockMCPResult
+{
id mockResult = [OCMockObject niceMockForClass:[MCPResult class]];
+
return mockResult;
}
-- (void)testDatabaseExists {
+- (void)testDatabaseExists
+{
SPDatabaseInfo *dbInfo = [self getDatabaseInfoFixture];
NSArray *tables = [[NSArray alloc] initWithObjects: @"db_one", nil];
@@ -62,7 +69,8 @@
[mockConnection verify];
}
-- (void)testListDBs {
+- (void)testListDBs
+{
SPDatabaseInfo *dbInfo = [self getDatabaseInfoFixture];
id mockConnection = [self getMockConnection];
[[mockConnection expect] queryString:@"SHOW DATABASES"];
@@ -71,7 +79,8 @@
[mockConnection verify];
}
-- (void)testListDBsLike {
+- (void)testListDBsLike
+{
SPDatabaseInfo *dbInfo = [self getDatabaseInfoFixture];
id mockConnection = [self getMockConnection];
[[mockConnection expect] queryString:@"SHOW DATABASES LIKE `test_db`"];
@@ -80,5 +89,4 @@
[mockConnection verify];
}
-
@end
diff --git a/UnitTests/SPDatabaseRenameTest.h b/UnitTests/SPDatabaseRenameTest.h
index 473f4716..e3ac19cc 100644
--- a/UnitTests/SPDatabaseRenameTest.h
+++ b/UnitTests/SPDatabaseRenameTest.h
@@ -23,12 +23,12 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
+#import <SenTestingKit/SenTestingKit.h>
+
#define USE_APPLICATION_UNIT_TEST 1
-#import <SenTestingKit/SenTestingKit.h>
+@interface SPDatabaseRenameTest : SenTestCase
-@interface SPDatabaseRenameTest : SenTestCase {
-}
- (void) testRenameDatabase;
- (void) testCreateDatabase;
diff --git a/UnitTests/SPDatabaseRenameTest.m b/UnitTests/SPDatabaseRenameTest.m
index 51562db9..7e787caa 100644
--- a/UnitTests/SPDatabaseRenameTest.m
+++ b/UnitTests/SPDatabaseRenameTest.m
@@ -24,6 +24,7 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import <OCMock/OCMock.h>
+
#import "SPDatabaseRenameTest.h"
#import "SPDatabaseRename.h"
#import "SPTableCopy.h"
@@ -32,31 +33,38 @@
#import "SPStringAdditions.h"
#import "SPLogger.h"
-
@implementation SPDatabaseRenameTest
-- (SPDatabaseRename *) getDatabaseRenameFixture {
+- (SPDatabaseRename *) getDatabaseRenameFixture
+{
SPDatabaseRename *dbRename = [[SPDatabaseRename alloc] init];
+
return [dbRename autorelease];
}
-- (SPTableCopy *) getTableCopyFixture {
+- (SPTableCopy *)getTableCopyFixture
+{
SPTableCopy *tableCopy = [[SPTableCopy alloc] init];
+
return [tableCopy autorelease];
}
-- (id) getMockConnection {
+- (id)getMockConnection
+{
id mockConnection = [OCMockObject niceMockForClass:[MCPConnection class]];
- return mockConnection;
+
+ eturn mockConnection;
}
-- (id) getMockDBInfo {
+- (id)getMockDBInfo
+{
id mockDBInfo = [OCMockObject niceMockForClass:[SPDatabaseInfo class]];
+
return mockDBInfo;
}
-- (void) testRenameDatabase {
-
+- (void)testRenameDatabase
+{
SPDatabaseRename *dbRename = [self getDatabaseRenameFixture];
id mockConnection = [self getMockConnection];
@@ -84,7 +92,8 @@
[target release];
}
-- (void) testCreateDatabase {
+- (void)testCreateDatabase
+{
SPDatabaseRename *dbRename = [self getDatabaseRenameFixture];
}