Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
simonbingham committed Oct 5, 2012
2 parents 67f4bdb + 166cb16 commit cd702f6ff80860195f43727e5cd3f048e3732ea0
View
@@ -33,6 +33,7 @@ component extends="frameworks.org.corfield.framework"{
}
// ------------------------ FW/1 SETTINGS ------------------------ //
+
variables.framework = {
cacheFileExists = !this.development
, defaultSubsystem = "public"
@@ -169,7 +170,7 @@ component extends="frameworks.org.corfield.framework"{
, resetpasswordemailsubject = ""
, whitelist = "^admin:security,^public:" // list of unsecure actions - by default all requests require authentication
}
- , version = "2012.09.28"
+ , version = "2012.10.5"
};
// override config in development mode
if( config.development ){
@@ -31,9 +31,14 @@ component extends="mxunit.framework.TestCase"{
}
function testGetChildren(){
- var result = CUT.getChildren( 1, 26, true );
- assertEquals( 3, result.recordcount );
- }
+ var result = CUT.getChildren( left=1, right=18 );
+ assertEquals( 2, result.recordcount ); // note: 2 as only returns direct descendants
+ }
+
+ function testGetChildrenClearCache(){
+ var result = CUT.getChildren( left=1, right=18,clearcache=true );
+ assertEquals( 2, result.recordcount );
+ }
function testGetNavigation(){
var result = CUT.getNavigation();
@@ -146,6 +151,10 @@ component extends="mxunit.framework.TestCase"{
result = ArrayLen( pages );
assertEquals( 14, result );
}
+
+ function testShiftPages(){
+ CUT.ShiftPages( affectedpages="1,2,3", shift=0 );
+ }
// ------------------------ IMPLICIT ------------------------ //
@@ -15,11 +15,17 @@ component extends="mxunit.framework.TestCase"{
}
function testGetChildren(){
- var Page = CUT.getPage( 1 );
- var result = CUT.getChildren( Page, true );
- assertEquals( 3, result.RecordCount );
+ var Page = mock().getLeftValue().returns( 1 ).getRightValue().returns( 18 );
+ var result = CUT.getChildren( Page );
+ assertEquals( 2, result.recordcount );
}
-
+
+ function testGetChildrenClearCache(){
+ var Page = mock().getLeftValue().returns( 1 ).getRightValue().returns( 18 );
+ var result = CUT.getChildren( Page=Page, clearcache=true );
+ assertEquals( 2, result.recordcount );
+ }
+
function testGetPageWherePageDoesNotExist(){
var Page = CUT.getPage( 14 );
var result = Page.isPersisted();
@@ -123,7 +123,7 @@ component extends="mxunit.framework.TestCase"{
selenium.waitForPageToLoad( timeout );
assertTrue( selenium.isTextPresent( "regexp:(The page "".*"" has been saved.)" ) );
// delete page
- selenium.click( "//div[@id='content']/table/tbody/tr[10]/td[5]/a/i" );
+ selenium.click( "//div[@id='content']/table/tbody/tr[10]/td[6]/a/i" );
selenium.waitForPageToLoad( timeout );
// when we delete a record a confirmation dialog appears
// calling the getConfirmation method forces the Ok button to be clicked in the dialog
@@ -44,8 +44,7 @@ component accessors="true"{
void function resetpassword( required struct rc ){
param name="rc.username" default="";
rc.result = variables.SecurityService.resetPassword( rc, rc.config.name, rc.config.security, "../../admin/views/security/email.cfm" );
- if( rc.result.getIsSuccess() ) variables.fw.redirect( "security", "result" );
- else variables.fw.redirect( "security.password", "result" );
+ variables.fw.redirect( "security.password", "result" );
}
}
@@ -12,8 +12,7 @@
<th>Last Updated</th>
<th class="center">View</th>
<cfif rc.config.page.enableadddelete><th class="center">Add Page</th></cfif>
- <!--- temporarily disabled sorting of pages until bug is fixed - https://github.com/simonbingham/xindi/issues/101 --->
- <!---<th class="center">Sort Sub Pages</th>--->
+ <th class="center">Sort Sub Pages</th>
<cfif rc.config.page.enableadddelete><th class="center">Delete</th></cfif>
</tr>
</thead>
@@ -32,7 +31,7 @@
<td title="last updated on #DateFormat( rc.navigation.updated, 'medium' )# at #TimeFormat( rc.navigation.updated, 'HH:MM' )#">#getTimeInterval( rc.navigation.updated )# by # rc.navigation.updatedby#</td>
<td class="center"><a href="#buildURL( action="public:" & rc.navigation.slug )#" title="View" target="_blank"><i class="icon-eye-open"></i></a></td>
<cfif rc.config.page.enableadddelete><td class="center"><cfif rc.navigation.depth lt rc.config.page.maxlevels and !ListFind( rc.config.page.suppressaddpage, rc.navigation.pageid )><a href="#buildURL( action='pages.maintain', querystring='ancestorid/#rc.navigation.pageid#' )#" title="Add Page"><i class="icon-plus-sign"></i></a></cfif></td></cfif>
- <!---<td class="center"><cfif rc.navigation.descendants gt 1><a href="#buildURL( action='pages.sort', querystring='pageid/#rc.navigation.pageid#' )#" title="Sort"><i class="icon-retweet"></i></a></cfif></td>--->
+ <td class="center"><cfif rc.navigation.descendants gt 1><a href="#buildURL( action='pages.sort', querystring='pageid/#rc.navigation.pageid#' )#" title="Sort"><i class="icon-retweet"></i></a></cfif></td>
<cfif rc.config.page.enableadddelete><td class="center"><cfif rc.navigation.descendants eq 0 and !ListFind( rc.config.page.suppressdeletepage, rc.navigation.pageid )><a href="#buildURL( 'pages.delete' )#/pageid/#rc.navigation.pageid#" title="Delete"><i class="icon-remove"></i></a></cfif></td></cfif>
</tr>
</cfloop>
@@ -1,15 +0,0 @@
-<!---
- Aaron Greenlee
- http://aarongreenlee.com/
-
- This work is licensed under a Creative Commons Attribution-Share-Alike 3.0
- Unported License.
-
- // Original Info -----------------------------------------------------------
- Author : Aaron Greenlee
- Created : 10/01/2010
-
---->
-<cfcomponent output="false">
- <cfset this.name = "Hoth Tests_" & hash(getCurrentTemplatePath())>
-</cfcomponent>
@@ -1,39 +0,0 @@
-/**
- Aaron Greenlee
- http://aarongreenlee.com/
-
- This work is licensed under a Creative Commons Attribution-Share-Alike 3.0
- Unported License.
-
- // Original Info -----------------------------------------------------------
- Author : Aaron Greenlee
- Created : 10/01/2010
-
- Unit Test Config for Hoth
-
- // Modifications :---------------------------------------------------------
- Modified : 12/13/2010 9:52:41 AM by Aaron Greenlee.
- - Now supporting ColdBox 3.0 RC1
- Modified : 02/18/2011 1:20:12 PM by Aaron Greenlee.
- - Now supporting the HothReportURL value.
-*/
-component
- implements='Hoth.object.iHothConfig'
- extends='Hoth.object.CoreConfig'
- accessors=true {
-
- property name='applicationName' default='HothUnitTests';
- property name='timeToLock' default='1';
- property name='logPath' default='/Hoth/test/logs';
- property name='EmailNewExceptions' default='true';
- property name='EmailNewExceptionsTo' default='aarongreenlee@gmail.com';
- property name='EmailNewExceptionsFrom' default='aarongreenlee@gmail.com';
- property name='EmailNewExceptionsFile' default='true';
- property name='HothReportURL' default='UNIT_TEST_WILL_POPULATE';
-
- public function init ()
- {
- super.init();
- return this;
- }
-}
@@ -1,15 +0,0 @@
-/**
- Aaron Greenlee
- http://aarongreenlee.com/
-
- This work is licensed under a Creative Commons Attribution-Share-Alike 3.0
- Unported License.
-
- // Original Info -----------------------------------------------------------
- Author : Aaron Greenlee
- Created : 10/01/2010
-
- MXUnit Remote Facade
-
-*/
-component extends='mxunit.framework.RemoteFacade' {}
@@ -1,144 +0,0 @@
-/**
- Aaron Greenlee
- http://aarongreenlee.com/
-
- This work is licensed under a Creative Commons Attribution-Share-Alike 3.0
- Unported License.
-
- // Original Info -----------------------------------------------------------
- Author : Aaron Greenlee
- Created : 12/13/2010 10:17:31 AM
-
- Unit Test for HothApplicationManager
-
- // Modifications :---------------------------------------------------------
-
-*/
-
-/** Unit test for Hoth.HothTracker */
-component extends="mxunit.framework.TestCase"
-{
-
- variables.testDB = '/Hoth/test/db/';
- variables.appFile = expandPath(variables.testDB & 'applications.hoth');
-
- /** Constructor */
- public void function setUp()
- {
- // Load our test config
- HothConfig = new Hoth.test.HothConfig();
- HothConfig.setGlobalDatabasePath(variables.testDB);
-
- // Change the global settings for the test
- HothConfig.GlobalHothSettings.globalDatabase = variables.testDB;
-
- // Create our SUT
- HothApplicationManager =
- new Hoth.object.HothApplicationManager(HothConfig);
-
- // Write our test application data
- local.applicationToSave =
- [{
- 'applicationName' = 'HothUnitTestFake'
- ,'logPath' = '/Hoth/test/logs_not_real'
- ,'created' = 0
- }];
- fileWrite(
- variables.appFile
- ,serializeJSON(local.applicationToSave)
- ,'UTF-8'
- );
-
- return;
- }
-
- /** Ensure our test db directory exists. **/
- public void function beforeTests ()
- {
- if (!directoryExists(variables.testDB))
- directoryCreate(variables.testDB);
-
- return;
- }
-
- /** Delete our test db file. **/
- public void function afterTests ()
- {
- // Delete test db unless a test triggered the delete
- if (fileExists(variables.appFile))
- {
- fileDelete(variables.appFile);
- }
- }
-
- // -------------------------------------------------------------------------
- /** Ensure we can read our application database file. **/
- public void function loadApplicationsFromDisk()
- {
- makePublic(HothApplicationManager, 'loadApplicationsFromDisk');
-
- // Confirm we have our application created in beforeTests();
- local.appsFound = arrayLen(
- HothApplicationManager.loadApplicationsFromDisk(HothConfig)
- );
-
- assertEquals(
- 1
- ,local.appsFound
- ,'Invalid application db.'
- );
-
- return;
- }
-
- /** Ensure we delete an invalid application database file. **/
- public void function loadApplicationsFromDisk_Deletes_Invalid_JSON()
- {
- makePublic(HothApplicationManager, 'loadApplicationsFromDisk');
-
- // Save invalid data and expect the file to be deleted
- fileWrite(
- variables.appFile
- ,'I am not JSON'
- ,'UTF-8'
- );
-
- // Now, we expect zero.
- local.appsFound = arrayLen(
- HothApplicationManager.loadApplicationsFromDisk(HothConfig)
- );
-
- assertEquals(
- 0
- ,local.appsFound
- ,'Should have deleted the file and returned zero.'
- );
-
- assert(
- fileExists(variables.testDB & variables.appFile) == false
- ,'Should have deleted the file and returned zero.'
- );
-
- return;
- }
-
- /** Ensure we can learn about our applications. **/
- public void function learnApplication()
- {
-
- local.newApplication =
- HothApplicationManager.learnApplication(HothConfig);
-
- assert(local.newApplication, 'We should have a new application.');
-
- // Performing the same test twice should now return false since we
- // already know about this application.
-
- local.newApplication =
- HothApplicationManager.learnApplication(HothConfig);
-
- assertFalse(local.newApplication, 'We should NOT have a new application.');
-
- return;
- }
-}
@@ -1,42 +0,0 @@
-/**
- Aaron Greenlee
- http://aarongreenlee.com/
-
- This work is licensed under a Creative Commons Attribution-Share-Alike 3.0
- Unported License.
-
- // Original Info -----------------------------------------------------------
- Author : Aaron Greenlee
- Created : 12/13/2010 10:17:31 AM
-
- Unit Test for Hoth Config Object.
-
- // Modifications :---------------------------------------------------------
-
-*/
-
-/** Unit test for Hoth.HothTracker */
-component extends="mxunit.framework.TestCase"
-{
-
- /** Constructor */
- public void function setUp()
- {
- // Load our test config
- HothConfig = new Hoth.test.HothConfig();
-
- return;
- }
-
- // -------------------------------------------------------------------------
- public void function Confirm_Default_Storage() {
- // Confirm the global settings themselves
- assertEquals(
- '/Hoth/db/'
- ,HothConfig.getGlobalDatabasePath()
- ,'Has the default location to store application knowledge changed?'
- );
-
- return;
- }
-}
Oops, something went wrong.

0 comments on commit cd702f6

Please sign in to comment.