RKMappingTest has no methods (RestKit) - ios

I'm working with RestKit and trying to do unit tests per the Unit Testing Guide on their Github wiki.
When I try to create an instance of RKMappingTest, its like it only has the NSObject methods on it. it doesn't have the testWithMapping: method or any others that come up in the autocomplete and if I type it myself there is an error. Also, respondsToSelector: returns NO for the testWithMapping method.
So, since the class is available I'm sure the header is there but I can't figure out why the methods are not there. The textFixture stuff works fine as well. I've restarted XCode but can't seem to find out what is going on here. Help.

I've updated the Wiki page. There was an error with the message call it should be:
+ testForMapping:sourceObject:destinationObject:
instead of
+ testForMapping:withSourceObject:destinationObject:

Related

Using rest fixture in a scenario to make it reusable

I have been trying to find if this works.
|Script|RestScriptFixture|http://admin:password#localhost:5984/|
I found this example but have been getting an error that the restscriptfixture is not found.
It seems like you have not imported the fixture correctly. If you look at the SetUp part of the ScriptTable documentation, you can see that they include some fixtures to get it to call the actual class. According to the RestScriptFixture documentation, the actual import statement is:
|import|
|smartrics.rest.fitnesse.fixture|
Note that you must have the RestScriptFixture jar on your classpath as well.

How to add custom fields in ZFC-user module for zend 2 without doctrine?

I have tried using creating a different module and attaching the ZfcUser\Form\Register over init method. But it wasn't working.
I want to add few custom fields, with changing any thing in the vendor dir, as is it not a good practice. I also tried using user_entity_class ,creating a custom 'User' class, but it was creating some route issue in other modules, with zfc-user , I'm also using zfc-admin and zfc-adminuser, the error was coming in zfc-adminuser, Couldn't found the class was the error.
Thanks in advance.
Well there are some issue regarding the overriding of the module ZFC-User, But still you can overwrite it manually.
One way I have used is a bit old fashioned but working. What I have done is I have copied complete module the to module folder. Then pointing the form towards to my module where the changes are required, rest all are pointed to default.With this you can update your module. Make sure you point the user_entity_class to your module something like this:
'user_entity_class' => 'MyZfcUser\Entity\User',
you can find this in config\autoload\zfcuser.global.php

Domain.GetDomainsById not working in Umbraco 6

I'm trying to get the language from the current node but are unable to get this working.
umbraco.cms.businesslogic.web.Domain.GetDomainsById(
umbraco.uQuery.GetCurrentNode().Id
).Id
This will return 0 at all times. Any advice where to start looking or are there other methods to acquire the current language id, thanks!
After some extensive digging in the well functioning dictionary classes I found the UmbracoCultureDictionary library that contains useful stuff like this
new umbraco.MacroEngines.UmbracoCultureDictionary().Language.id
Currently obsoleted and the referenced class Umbraco.Web.Dictionary.DefaultCultureDictionary is Internal, hence the following approach is probably the most compatible at the moment
umbraco.cms.businesslogic.language.Language.GetByCultureCode(
System.Threading.Thread.CurrentThread.CurrentUICulture.Name
).id
umbraco.cms.businesslogic.language.Language.GetByCultureCode(
System.Threading.Thread.CurrentThread.CurrentUICulture.Name
).FriendlyName
umbraco.cms.businesslogic.language.Language.GetByCultureCode(
System.Threading.Thread.CurrentThread.CurrentUICulture.Name
).CultureAlias

Xcode 5 unit test seeing wrong class

I am running into a bizarre situation where a unit test's execution is behaving differently than the normal execution of a piece of code.
In particular, I am using a library called JSONModel, and when I am attempting to deserialize an object from a JSON string, one line in particular is causing problems when I step through the executing test case:
if ( [[property.type class] isSubclassOfClass:[JSONModel class]] ) ...
If I put a breakpoint before (or after) this line and execute:
expr [[property.type class] isSubclassOfClass:[JSONModel class]]
...in the debugger, it prints \x01 as the value (i.e. true), however when I actually step the instruction pointer, it behaves as though it is false, going instead into the else block. Again, typing the expression into the debugger again shows it as true even still.
I'm curious if anyone has seen similar behavior before and has any suggestions as to what could possibly be going wrong. I'm quite certain I'm not including different definitions for anything, unless Xcode has different internal cocoa class implementations for testing.
Update: Here's some even weirder evidence: I've added some NSLog statements to get an idea for how the execution is seeing things. If I log property.type.superclass I get JSONModel back (as expected); however if I log property.type.superclass == [JSONModel class] I get false!
To me this is indicating that the JSONModel the unit test execution is seeing is somehow a different JSONModel class that I'm seeing at runtime (and what it should be seeing). However, how that is happening I can't figure out.
Could this be caused by a forward class declaration or something like that?
Well I seem to have discovered a "solution" by experimentation. It turns out if I replace [JSONModel class] with NSClassFromString(#"JSONModel") it works swimmingly!
Now why this is I cannot say, and will give the answer to whoever can explain it!
I had the exact same problem, here's what was happening.
As expected with this kind of behaviour, it was an issue with the class being duplicated. As with you, [instance class] and NSClassFromString would return different values. However, the class were identical in all points : same ivar, same methods (checked with the obj runtime). No warning was displayed at compile, link and/or runtime
In my case, the tests were about a static library used in my main application (Bar.app).
Basically, I had 3 targets:
libFoo
libFooTests
Bar.app
The tests were performing on the device, and not on simulator. As such, they needed to be logic tests, and not unit tests, and had to be loaded into an application. The bundle loader was my main app, Bar.app.
Only additional linker flag was -ObjC
Now, Bar.app was linking libFoo.
It turns out, libFooTests was also linking libFoo.
When injecting libFooTests in the test host (Bar.app), symbols were duplicated, but no warning were presented to me. This is how this particular class got duplicated.
Simply removing libFoo from the list of libraries to link against in libFooTests did the trick.

IntelliJ Idea auto-complete for my own grails domain meta class methods?

I'm using IntelliJ Idea 10 IDE for my grails development and while it's great at working out the "standard" meta class methods on, for example, domain classes (save, findBy etc), it (obviously) can't pick up methods added by plugins or my own code.
While I don't expect the IDE to be able to pick these up automatically, I'm optimistically wondering if there's a way to tell IntelliJ that, for example, "myMethod" is added to all domain objects, and that it takes a map and returns "myType".
It's a long shot I know, but does anyone know how this might be done in config, a plugin, or by some smoke-and-mirrors so I can a) stop missing simple, stupid typos and b) get some auto-complete?
I think you're looking for the GroovyDSL scripting framework
http://confluence.jetbrains.net/display/GRVY/Scripting+IDE+for+DSL+awareness
its possible to save a *.gdsl file somethere in src dir, with content:
contributor(context()) {
def scope = com.intellij.psi.search.GlobalSearchScope.allScope(project);
delegatesTo(com.intellij.psi.JavaPsiFacade.getInstance(project).findClass('org.grails.datastore.gorm.GormStaticApi', scope)) delegatesTo(com.intellij.psi.JavaPsiFacade.getInstance(project).findClass('org.grails.datastore.gorm.GormEntity', scope))}

Resources