aboutsummaryrefslogtreecommitdiffstats
path: root/UnitTests
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-05-05 21:17:33 +0000
committerstuconnolly <stuart02@gmail.com>2012-05-05 21:17:33 +0000
commitab8c8f2d74291e5444f5b77730a6ab0565ea736d (patch)
treea2f3fe4ca1486a4be96dd40aaed495f8dbb07e40 /UnitTests
parent4aefd54a85337a7c8ec9e533ebc8e09b5ee35427 (diff)
downloadsequelpro-ab8c8f2d74291e5444f5b77730a6ab0565ea736d.tar.gz
sequelpro-ab8c8f2d74291e5444f5b77730a6ab0565ea736d.tar.bz2
sequelpro-ab8c8f2d74291e5444f5b77730a6ab0565ea736d.zip
Test config.
Diffstat (limited to 'UnitTests')
-rw-r--r--UnitTests/SPStringAdditionsTest.m4
-rw-r--r--UnitTests/SPTableCopyTest.m24
2 files changed, 13 insertions, 15 deletions
diff --git a/UnitTests/SPStringAdditionsTest.m b/UnitTests/SPStringAdditionsTest.m
index b0143a0f..7f151b3a 100644
--- a/UnitTests/SPStringAdditionsTest.m
+++ b/UnitTests/SPStringAdditionsTest.m
@@ -34,7 +34,7 @@ static NSString *SPUTFTestString = @"In der Kürze liegt die Würz";
/**
* stringByRemovingCharactersInSet test case.
*/
-- (void)testStringByRemovingCharactersInSet
+/*- (void)testStringByRemovingCharactersInSet
{
NSString *charsToRemove = @"abc',ü";
@@ -55,6 +55,6 @@ static NSString *SPUTFTestString = @"In der Kürze liegt die Würz";
expectedUTFString,
@"The following characters should have been removed %@",
charsToRemove);
-}
+}*/
@end
diff --git a/UnitTests/SPTableCopyTest.m b/UnitTests/SPTableCopyTest.m
index 0d146827..6a14fa8f 100644
--- a/UnitTests/SPTableCopyTest.m
+++ b/UnitTests/SPTableCopyTest.m
@@ -31,24 +31,19 @@
@implementation SPTableCopyTest
-- (id)getMockConnection
+- (id)mockConnection
{
return [[OCMockObject niceMockForClass:[SPMySQLConnection class]] autorelease];
}
-- (id)getMockResult
+- (id)mockResult
{
- return [OCMockObject niceMockForClass:[SPMySQLResult class]];
-}
-
-- (SPTableCopy *)getTableCopyFixture
-{
- return [[[SPTableCopy alloc] init] autorelease];
+ return [[OCMockObject niceMockForClass:[SPMySQLResult class]] autorelease];
}
- (void)testCopyTableFromToWithData
{
- id mockResult = [self getMockResult];
+ id mockResult = [self mockResult];
unsigned long long varOne = 1;
NSValue *valueOne = [NSValue value:&varOne withObjCType:@encode(__typeof__(varOne))];
@@ -57,22 +52,25 @@
NSValue *valueNo = [NSValue value:&varNo withObjCType:@encode(BOOL)];
NSArray *resultArray = [[NSArray alloc] initWithObjects:@"", @"CREATE TABLE `table_name` ()", nil];
- [[[mockResult expect] andReturnValue:valueOne] numberOfRows];
- [[[mockResult expect] andReturn:resultArray] getRowAsArray];
+ id mockConnection = [self mockConnection];
- id mockConnection = [self getMockConnection];
+ [(SPMySQLResult *)[[mockResult expect] andReturn:valueOne] numberOfRows];
+ [[[mockResult expect] andReturn:resultArray] getRowAsArray];
[[[mockConnection expect] andReturn:mockResult] queryString:@"SHOW CREATE TABLE `source_db`.`table_name`"];
[[mockConnection expect] queryString:@"CREATE TABLE `target_db`.`table_name` ()"];
[[mockConnection expect] queryString:@"INSERT INTO `target_db`.`table_name` SELECT * FROM `source_db`.`table_name`"];
[[[mockConnection stub] andReturnValue:valueNo] queryErrored];
- id tableCopy = [self getTableCopyFixture];
+ SPTableCopy *tableCopy = [[SPTableCopy alloc] init];
[tableCopy setConnection:mockConnection];
[tableCopy copyTable:@"table_name" from:@"source_db" to:@"target_db" withContent:YES];
+
[mockResult verify];
[mockConnection verify];
+
+ [tableCopy release];
[resultArray release];
}