Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the functionality to the mongodb model to always return a value…
… for attributes even when they don't exist. This allows for the more fluid documents stored by mongodb. Closes #2
- Loading branch information
Showing
3 changed files
with
89 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
component extends="mxunit.framework.TestCase" { | ||
public void function setup() { | ||
variables.i18n = createObject('component', 'cf-compendium.inc.resource.i18n.i18n').init(expandPath('/')); | ||
variables.model = createObject('component', 'plugins.mongodb.inc.resource.base.model').init(variables.i18n); | ||
} | ||
|
||
/** | ||
* Test that getting a value without setting it returns a blank string. | ||
*/ | ||
public void function testReturnBlankWhenNotSet() { | ||
assertEquals('', variables.model.getSomething()); | ||
} | ||
|
||
/** | ||
* Test that getting a value with a provided default without setting it returns a blank string. | ||
*/ | ||
public void function testReturnDefaultWhenNotSet() { | ||
assertEquals('default', variables.model.getSomething('default')); | ||
} | ||
|
||
/** | ||
* Test that getting a value with setting it returns the set value. | ||
*/ | ||
public void function testReturnValueWhenSet() { | ||
variables.model.setSomething('val'); | ||
|
||
assertEquals('val', variables.model.getSomething()); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.