From ab8c8f2d74291e5444f5b77730a6ab0565ea736d Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sat, 5 May 2012 21:17:33 +0000 Subject: Test config. --- UnitTests/SPStringAdditionsTest.m | 4 ++-- UnitTests/SPTableCopyTest.m | 24 +++++++++++------------- sequel-pro.xcodeproj/project.pbxproj | 27 +++++---------------------- 3 files changed, 18 insertions(+), 37 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]; } diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index b53998c5..21ae7fae 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -115,6 +115,8 @@ 17D3C6D3128B1C900047709F /* SPFavoritesOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3C6D2128B1C900047709F /* SPFavoritesOutlineView.m */; }; 17D3DC201281816E002A163A /* SPDatabaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3DC1F1281816E002A163A /* SPDatabaseViewController.m */; }; 17D5B49E1553059F00EF3BB3 /* SPViewCopy.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D5B49D1553059F00EF3BB3 /* SPViewCopy.m */; }; + 17DB5F441555CA300046834B /* SPMutableArrayAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1798F19715501838004B0AB8 /* SPMutableArrayAdditions.m */; }; + 17DB5F4A1555CA810046834B /* SPMenuAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 58DC10D212A1B8DF00B76DA5 /* SPMenuAdditions.m */; }; 17DD52B7115071D0007D8950 /* SPPrintTemplate.html in Resources */ = {isa = PBXBuildFile; fileRef = 17DD52B6115071D0007D8950 /* SPPrintTemplate.html */; }; 17DD52C3115074B3007D8950 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 17DD52C1115074B3007D8950 /* InfoPlist.strings */; }; 17DD52C6115074CB007D8950 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 17DD52C4115074CB007D8950 /* Localizable.strings */; }; @@ -457,13 +459,6 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 1798AAFF12676BAD000D946A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */; - proxyType = 1; - remoteGlobalIDString = 8D15AC270486D014006FF6A4; - remoteInfo = "Sequel Pro"; - }; 1798AB2712676F14000D946A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */; @@ -1313,13 +1308,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 58B9095F11C3A42B000826E5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 58CDB3340FCE13C900F8ACA3 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -2659,7 +2647,6 @@ buildRules = ( ); dependencies = ( - 1798AB0012676BAD000D946A /* PBXTargetDependency */, ); name = "Unit Tests"; productName = "Unit Tests"; @@ -2707,7 +2694,6 @@ buildConfigurationList = 58B9096A11C3A431000826E5 /* Build configuration list for PBXNativeTarget "xibLocalizationPostprocessor" */; buildPhases = ( 58B9095E11C3A42B000826E5 /* Sources */, - 58B9095F11C3A42B000826E5 /* Frameworks */, ); buildRules = ( ); @@ -3068,7 +3054,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Run build tasks\n\"${SRCROOT}/Scripts/run-tests.sh\"\n"; + shellScript = "\"${SRCROOT}/Scripts/run-tests.sh\"\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -3086,6 +3072,8 @@ 176059B913361D390098E162 /* SPTableCopyTest.m in Sources */, 176059BA13361D3A0098E162 /* SPDatabaseCopyTest.m in Sources */, 1798F1C4155018E2004B0AB8 /* SPMutableArrayAdditionsTest.m in Sources */, + 17DB5F441555CA300046834B /* SPMutableArrayAdditions.m in Sources */, + 17DB5F4A1555CA810046834B /* SPMenuAdditions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3315,11 +3303,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 1798AB0012676BAD000D946A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 8D15AC270486D014006FF6A4 /* Sequel Pro */; - targetProxy = 1798AAFF12676BAD000D946A /* PBXContainerItemProxy */; - }; 1798AB2812676F14000D946A /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 8D15AC270486D014006FF6A4 /* Sequel Pro */; -- cgit v1.2.3