aboutsummaryrefslogtreecommitdiffstats
path: root/UnitTests
diff options
context:
space:
mode:
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];
}