From 5544489096885e4e4be1ab6e54160caaa44c03dc Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Fri, 4 May 2012 14:36:30 +0000 Subject: Add initial support of moving views when renaming a database. Currently not hooked up yet. Part of issue #1235. --- UnitTests/SPDatabaseCopyTest.h | 8 ++-- UnitTests/SPDatabaseCopyTest.m | 2 +- UnitTests/SPDatabaseInfoTest.h | 36 ---------------- UnitTests/SPDatabaseInfoTest.m | 92 ---------------------------------------- UnitTests/SPDatabaseRenameTest.h | 4 +- UnitTests/SPDatabaseRenameTest.m | 2 +- UnitTests/SPTableCopyTest.h | 5 +-- 7 files changed, 9 insertions(+), 140 deletions(-) delete mode 100644 UnitTests/SPDatabaseInfoTest.h delete mode 100644 UnitTests/SPDatabaseInfoTest.m (limited to 'UnitTests') diff --git a/UnitTests/SPDatabaseCopyTest.h b/UnitTests/SPDatabaseCopyTest.h index 641b3cdd..ba882ee1 100644 --- a/UnitTests/SPDatabaseCopyTest.h +++ b/UnitTests/SPDatabaseCopyTest.h @@ -27,9 +27,9 @@ #import -@interface SPDatabaseCopyTest : SenTestCase { -} -- (void) testCopyDatabase; -- (void) testCreateDatabase; +@interface SPDatabaseCopyTest : SenTestCase + +- (void)testCopyDatabase; +- (void)testCreateDatabase; @end diff --git a/UnitTests/SPDatabaseCopyTest.m b/UnitTests/SPDatabaseCopyTest.m index 9ba7d5b7..df4807b9 100644 --- a/UnitTests/SPDatabaseCopyTest.m +++ b/UnitTests/SPDatabaseCopyTest.m @@ -55,7 +55,7 @@ return mockDBInfo; } -- (void) testCopyDatabase { +- (void)testCopyDatabase { SPDatabaseCopy *dbCopy = [self getDatabaseCopyFixture]; id mockConnection = [self getMockConnection]; diff --git a/UnitTests/SPDatabaseInfoTest.h b/UnitTests/SPDatabaseInfoTest.h deleted file mode 100644 index ed0093c5..00000000 --- a/UnitTests/SPDatabaseInfoTest.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// $Id$ -// -// SPDatabaseInfoTest.h -// sequel-pro -// -// Created by David Rekowski -// Copyright (c) 2010 David Rekowski. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import - -#define USE_APPLICATION_UNIT_TEST 1 - -@interface SPDatabaseInfoTest : SenTestCase - -- (void)testDatabaseExists; -- (void)testListDBs; -- (void)testListDBsLike; - -@end diff --git a/UnitTests/SPDatabaseInfoTest.m b/UnitTests/SPDatabaseInfoTest.m deleted file mode 100644 index fc2309e3..00000000 --- a/UnitTests/SPDatabaseInfoTest.m +++ /dev/null @@ -1,92 +0,0 @@ -// -// $Id$ -// -// SPDatabaseInfoTest.m -// sequel-pro -// -// Created by David Rekowski -// Copyright (c) 2010 David Rekowski. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import - -#import "SPDatabaseInfo.h" -#import "SPDatabaseInfoTest.h" - -@implementation SPDatabaseInfoTest - -- (SPDatabaseInfo *)getDatabaseInfoFixture -{ - SPDatabaseInfo *dbInfo = [[SPDatabaseInfo alloc] init]; - - return dbInfo; -} - -- (id) getMockConnection -{ - id mockConnection = [OCMockObject niceMockForClass:[MCPConnection class]]; - - return mockConnection; -} - -- (id) getMockMCPResult -{ - id mockResult = [OCMockObject niceMockForClass:[MCPResult class]]; - - return mockResult; -} - -- (void)testDatabaseExists -{ - SPDatabaseInfo *dbInfo = [self getDatabaseInfoFixture]; - - NSArray *tables = [[NSArray alloc] initWithObjects: @"db_one", nil]; - id mockMCPResult = [self getMockMCPResult]; - [[mockMCPResult expect] numOfRows]; - [[[mockMCPResult stub] andReturn:[[NSNumber alloc] initWithInt:1]] numOfRows]; - [[mockMCPResult expect] fetchRowAsArray]; - [[[mockMCPResult stub] andReturn:tables] fetchRowAsArray]; - id mockConnection = [self getMockConnection]; - - [[[mockConnection expect] andReturn:mockMCPResult] queryString:@"SHOW DATABASES"]; - [dbInfo setConnection:mockConnection]; - [dbInfo databaseExists:@"db_one"]; - [mockConnection verify]; -} - -- (void)testListDBs -{ - SPDatabaseInfo *dbInfo = [self getDatabaseInfoFixture]; - id mockConnection = [self getMockConnection]; - [[mockConnection expect] queryString:@"SHOW DATABASES"]; - [dbInfo setConnection:mockConnection]; - [dbInfo listDBs]; - [mockConnection verify]; -} - -- (void)testListDBsLike -{ - SPDatabaseInfo *dbInfo = [self getDatabaseInfoFixture]; - id mockConnection = [self getMockConnection]; - [[mockConnection expect] queryString:@"SHOW DATABASES LIKE `test_db`"]; - [dbInfo setConnection:mockConnection]; - [dbInfo listDBsLike:@"test_db"]; - [mockConnection verify]; -} - -@end diff --git a/UnitTests/SPDatabaseRenameTest.h b/UnitTests/SPDatabaseRenameTest.h index e3ac19cc..d012e8b9 100644 --- a/UnitTests/SPDatabaseRenameTest.h +++ b/UnitTests/SPDatabaseRenameTest.h @@ -29,7 +29,7 @@ @interface SPDatabaseRenameTest : SenTestCase -- (void) testRenameDatabase; -- (void) testCreateDatabase; +- (void)testRenameDatabase; +- (void)testCreateDatabase; @end diff --git a/UnitTests/SPDatabaseRenameTest.m b/UnitTests/SPDatabaseRenameTest.m index 9a1c7b1d..335e9f34 100644 --- a/UnitTests/SPDatabaseRenameTest.m +++ b/UnitTests/SPDatabaseRenameTest.m @@ -34,7 +34,7 @@ @implementation SPDatabaseRenameTest -- (SPDatabaseRename *) getDatabaseRenameFixture +- (SPDatabaseRename *)getDatabaseRenameFixture { SPDatabaseRename *dbRename = [[SPDatabaseRename alloc] init]; diff --git a/UnitTests/SPTableCopyTest.h b/UnitTests/SPTableCopyTest.h index 25d0da7b..62ebbaaf 100644 --- a/UnitTests/SPTableCopyTest.h +++ b/UnitTests/SPTableCopyTest.h @@ -27,11 +27,8 @@ #import -@interface SPTableCopyTest : SenTestCase { - -} +@interface SPTableCopyTest : SenTestCase - (void)testCopyTableFromToWithData; - @end -- cgit v1.2.3