Brion VIBBER has uploaded a new change for review.
https://gerrit.wikimedia.org/r/93099
Change subject: Stub PageTitle class
......................................................................
Stub PageTitle class
With tests, sorta :D
Change-Id: If927c431b9b5d1253145d51ab4297ab54ba0e412
---
M Wikipedia-iOS.xcodeproj/project.pbxproj
A Wikipedia-iOS/mw-support/PageTitle.h
A Wikipedia-iOS/mw-support/PageTitle.m
A Wikipedia-iOSTests/mw-support/PageTitleTests.m
4 files changed, 121 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia
refs/changes/99/93099/1
diff --git a/Wikipedia-iOS.xcodeproj/project.pbxproj
b/Wikipedia-iOS.xcodeproj/project.pbxproj
index 651cc82..3dd962b 100644
--- a/Wikipedia-iOS.xcodeproj/project.pbxproj
+++ b/Wikipedia-iOS.xcodeproj/project.pbxproj
@@ -22,6 +22,9 @@
D4991465181D51DF00E6073C /* InfoPlist.strings in Resources */ =
{isa = PBXBuildFile; fileRef = D4991463181D51DF00E6073C /* InfoPlist.strings
*/; };
D4991467181D51DF00E6073C /* Wikipedia_iOSTests.m in Sources */
= {isa = PBXBuildFile; fileRef = D4991466181D51DF00E6073C /*
Wikipedia_iOSTests.m */; };
D4BC22B4181E9E6300CAC673 /* empty.png in Resources */ = {isa =
PBXBuildFile; fileRef = D4BC22B3181E9E6300CAC673 /* empty.png */; };
+ D4EE00B9182443FC0090790F /* PageTitle.m in Sources */ = {isa =
PBXBuildFile; fileRef = D4EE00B8182443FC0090790F /* PageTitle.m */; };
+ D4EE00BA182443FC0090790F /* PageTitle.m in Sources */ = {isa =
PBXBuildFile; fileRef = D4EE00B8182443FC0090790F /* PageTitle.m */; };
+ D4EE00BD1824459D0090790F /* PageTitleTests.m in Sources */ =
{isa = PBXBuildFile; fileRef = D4EE00BC1824459D0090790F /* PageTitleTests.m */;
};
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -55,6 +58,9 @@
D4991464181D51DF00E6073C /* en */ = {isa = PBXFileReference;
lastKnownFileType = text.plist.strings; name = en; path =
en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
D4991466181D51DF00E6073C /* Wikipedia_iOSTests.m */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path =
Wikipedia_iOSTests.m; sourceTree = "<group>"; };
D4BC22B3181E9E6300CAC673 /* empty.png */ = {isa =
PBXFileReference; lastKnownFileType = image.png; path = empty.png; sourceTree =
"<group>"; };
+ D4EE00B7182443FC0090790F /* PageTitle.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name =
PageTitle.h; path = "mw-support/PageTitle.h"; sourceTree = "<group>"; };
+ D4EE00B8182443FC0090790F /* PageTitle.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name
= PageTitle.m; path = "mw-support/PageTitle.m"; sourceTree = "<group>"; };
+ D4EE00BC1824459D0090790F /* PageTitleTests.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name
= PageTitleTests.m; path = "mw-support/PageTitleTests.m"; sourceTree =
"<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -122,6 +128,7 @@
D4991451181D51DE00E6073C /* ViewController.m */,
D4991453181D51DE00E6073C /* Images.xcassets */,
D499143F181D51DE00E6073C /* Supporting Files */,
+ D4EE00BB182445670090790F /* mw-support */,
);
path = "Wikipedia-iOS";
sourceTree = "<group>";
@@ -142,6 +149,7 @@
children = (
D4991466181D51DF00E6073C /*
Wikipedia_iOSTests.m */,
D4991461181D51DF00E6073C /* Supporting Files */,
+ D4EE00BC1824459D0090790F /* PageTitleTests.m */,
);
path = "Wikipedia-iOSTests";
sourceTree = "<group>";
@@ -153,6 +161,15 @@
D4991463181D51DF00E6073C /* InfoPlist.strings
*/,
);
name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ D4EE00BB182445670090790F /* mw-support */ = {
+ isa = PBXGroup;
+ children = (
+ D4EE00B7182443FC0090790F /* PageTitle.h */,
+ D4EE00B8182443FC0090790F /* PageTitle.m */,
+ );
+ name = "mw-support";
sourceTree = "<group>";
};
/* End PBXGroup section */
@@ -257,6 +274,7 @@
buildActionMask = 2147483647;
files = (
D4991452181D51DE00E6073C /* ViewController.m in
Sources */,
+ D4EE00B9182443FC0090790F /* PageTitle.m in
Sources */,
D4991449181D51DE00E6073C /* AppDelegate.m in
Sources */,
D4991445181D51DE00E6073C /* main.m in Sources
*/,
);
@@ -267,6 +285,8 @@
buildActionMask = 2147483647;
files = (
D4991467181D51DF00E6073C /*
Wikipedia_iOSTests.m in Sources */,
+ D4EE00BD1824459D0090790F /* PageTitleTests.m in
Sources */,
+ D4EE00BA182443FC0090790F /* PageTitle.m in
Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Wikipedia-iOS/mw-support/PageTitle.h
b/Wikipedia-iOS/mw-support/PageTitle.h
new file mode 100644
index 0000000..bb07252
--- /dev/null
+++ b/Wikipedia-iOS/mw-support/PageTitle.h
@@ -0,0 +1,20 @@
+//
+// PageTitle.h
+// Wikipedia-iOS
+//
+// Created by Brion on 11/1/13.
+// Copyright (c) 2013 Wikimedia Foundation. Provided under MIT-style license;
please copy and modify!
+//
+
+#import <Foundation/Foundation.h>
+
+@interface PageTitle : NSObject
+
++(PageTitle *)titleFromNamespace:(NSString *)namespace text:(NSString *)text;
+
+-(id)initFromNamespace:(NSString *)namespace text:(NSString *)text;
+
+-(NSString *)namespace;
+-(NSString *)text;
+
+@end
diff --git a/Wikipedia-iOS/mw-support/PageTitle.m
b/Wikipedia-iOS/mw-support/PageTitle.m
new file mode 100644
index 0000000..987ba0b
--- /dev/null
+++ b/Wikipedia-iOS/mw-support/PageTitle.m
@@ -0,0 +1,41 @@
+//
+// PageTitle.m
+// Wikipedia-iOS
+//
+// Created by Brion on 11/1/13.
+// Copyright (c) 2013 Wikimedia Foundation. Provided under MIT-style license;
please copy and modify!
+//
+
+#import "PageTitle.h"
+
+@implementation PageTitle {
+ NSString *_namespace;
+ NSString *_text;
+}
+
++(PageTitle *)titleFromNamespace:(NSString *)namespace text:(NSString *)text
+{
+ return [[PageTitle alloc] initFromNamespace:namespace text:text];
+}
+
+-(id)initFromNamespace:(NSString *)namespace text:(NSString *)text
+{
+ self = [self init];
+ if (self) {
+ _namespace = namespace;
+ _text = text;
+ }
+ return self;
+}
+
+-(NSString *)namespace
+{
+ return _namespace;
+}
+
+-(NSString *)text
+{
+ return _text;
+}
+
+@end
diff --git a/Wikipedia-iOSTests/mw-support/PageTitleTests.m
b/Wikipedia-iOSTests/mw-support/PageTitleTests.m
new file mode 100644
index 0000000..8ecddc2
--- /dev/null
+++ b/Wikipedia-iOSTests/mw-support/PageTitleTests.m
@@ -0,0 +1,40 @@
+//
+// PageTitleTests.m
+// Wikipedia-iOS
+//
+// Created by Brion on 11/1/13.
+// Copyright (c) 2013 Wikimedia Foundation. All rights reserved.
+//
+
+#import <XCTest/XCTest.h>
+
+#import "PageTitle.h"
+
+@interface PageTitleTests : XCTestCase
+
+@end
+
+@implementation PageTitleTests
+
+- (void)setUp
+{
+ [super setUp];
+ // Put setup code here; it will be run once, before the first test case.
+}
+
+- (void)tearDown
+{
+ // Put teardown code here; it will be run once, after the last test case.
+ [super tearDown];
+}
+
+- (void)testCreate
+{
+ NSString *ns = @"";
+ NSString *text = @"Test-driven developent";
+ PageTitle *title = [PageTitle titleFromNamespace:ns text:text];
+ XCTAssert([title.namespace isEqualToString:ns], @"Title namespace should
be what we passed in");
+ XCTAssert([title.text isEqualToString:text], @"Title text should be what
we passed in");
+}
+
+@end
--
To view, visit https://gerrit.wikimedia.org/r/93099
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If927c431b9b5d1253145d51ab4297ab54ba0e412
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits