Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
Preparing test bundle to create tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vilanovi committed Dec 16, 2014
1 parent 088ad7c commit 7ff5563
Show file tree
Hide file tree
Showing 39 changed files with 623 additions and 159 deletions.
File renamed without changes.
24 changes: 24 additions & 0 deletions PersistentModel/PersistentModel Tests/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.mobilejazz.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
83 changes: 83 additions & 0 deletions PersistentModel/PersistentModel Tests/PersistentModel_Tests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//
// PersistentModel_Tests.m
// PersistentModel Tests
//
// Created by Joan Martin on 16/12/14.
// Copyright (c) 2014 Joan Martin. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>

#import "PersistentModel.h"

NSURL* applicationCacheDirectory()
{
static NSURL *url = nil;

static dispatch_once_t onceToken;

dispatch_once(&onceToken, ^{
NSArray *pathList = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachePath = [pathList[0] stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]];

// Create cache path if it doesn't exist, yet:
BOOL isDir = NO;
NSError *error;
if (! [[NSFileManager defaultManager] fileExistsAtPath:cachePath isDirectory:&isDir] && isDir == NO)
[[NSFileManager defaultManager] createDirectoryAtPath:cachePath withIntermediateDirectories:YES attributes:nil error:&error];

url = [NSURL fileURLWithPath:cachePath];
});

return url;
}

@interface PersistentModel_Tests : XCTestCase

@end

@implementation PersistentModel_Tests
{
PMPersistentStore *_persistentStore;
PMObjectContext *_objectContext;
}

- (void)setUp
{
[super setUp];

// Creating the URL where we will store the database
NSURL *url = [applicationCacheDirectory() URLByAppendingPathComponent:@"test.sql"];

// Instantiating the persistent store
_persistentStore = [[PMSQLiteStore alloc] initWithURL:url];

// Creating an object context connected to the persistent store
_objectContext = [[PMObjectContext alloc] initWithPersistentStore:_persistentStore];
}

- (void)tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}

- (void)testExample
{
// This is an example of a functional test case.
XCTAssert(YES, @"Pass");
}

- (void)testPerformanceExample
{
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}

#pragma mark - Index


@end

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// PMAppDelegate.h
// PersistentModelTest
// PersistentModel
//
// Created by Joan Martin on 27/02/14.
// Copyright (c) 2014 Joan Martin. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// PMAppDelegate.m
// PersistentModelTest
// PersistentModel
//
// Created by Joan Martin on 27/02/14.
// Copyright (c) 2014 Joan Martin. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// PMUser.h
// PersistentModelTest
// PersistentModel
//
// Created by Joan Martin on 21/03/14.
// Copyright (c) 2014 Joan Martin. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// PMUser.m
// PersistentModelTest
// PersistentModel
//
// Created by Joan Martin on 21/03/14.
// Copyright (c) 2014 Joan Martin. All rights reserved.
Expand All @@ -12,9 +12,9 @@ @implementation PMUser

+ (NSArray*)pmd_persistentPropertyNames
{
return @[mjz_key(username),
mjz_key(age),
mjz_key(avatarURL),
return @[pmd_key(username),
pmd_key(age),
pmd_key(avatarURL),
];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// PMVideo.h
// PersistentModelTest
// PersistentModel
//
// Created by Joan Martin on 21/03/14.
// Copyright (c) 2014 Joan Martin. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// PMVideo.m
// PersistentModelTest
// PersistentModel
//
// Created by Joan Martin on 21/03/14.
// Copyright (c) 2014 Joan Martin. All rights reserved.
Expand All @@ -13,8 +13,8 @@ @implementation PMVideo

+ (NSArray*)pmd_persistentPropertyNames
{
return @[mjz_key(title),
mjz_key(uploaderID),
return @[pmd_key(title),
pmd_key(uploaderID),
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.vilanovi.${PRODUCT_NAME:rfc1034identifier}</string>
<string>com.mobilejazz.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// main.m
// PersistentModelTest
// PersistentModel
//
// Created by Joan Martin on 27/02/14.
// Copyright (c) 2014 Joan Martin. All rights reserved.
Expand Down
10 changes: 10 additions & 0 deletions PersistentModel/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Uncomment this line to define a global platform for your project
# platform :ios, "6.0"

target 'PersistentModel' do
pod 'FMDB', '~> 2.2'
end

target 'PersistentModel Tests' do
pod 'FMDB', '~> 2.2'
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- FMDB (2.2):
- FMDB/standard
- FMDB/standard (= 2.2)
- FMDB/common (2.2)
- FMDB/standard (2.2):
- FMDB/common
Expand All @@ -11,4 +11,4 @@ DEPENDENCIES:
SPEC CHECKSUMS:
FMDB: f6f4511ad1e9ace38e9b6f4d83c2cddaabf98ea6

COCOAPODS: 0.33.1
COCOAPODS: 0.35.0
4 changes: 0 additions & 4 deletions PersistentModelTest/Podfile

This file was deleted.

29 changes: 0 additions & 29 deletions Source/NSArray+PMBaseObject.h

This file was deleted.

53 changes: 0 additions & 53 deletions Source/NSArray+PMBaseObject.m

This file was deleted.

Loading

0 comments on commit 7ff5563

Please sign in to comment.