PageRenderTime 38ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/_plugins/install_and_uninstall.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 55 lines | 49 code | 6 blank | 0 comment | 0 complexity | 68e988cdd5d41ef06048c700ce7d7b69 MD5 | raw file
Possible License(s): Apache-2.0, CPL-1.0
  1. <cfcomponent>
  2. <cfinclude template="testhelper.cfm">
  3. <cffunction name="test_installing_and_uninstall_lastest_version_of_plugin">
  4. <cfset loc = {}>
  5. <cfset loc.e = "0.3.5">
  6. <cfset loc.r = global.plugins.$installPlugin("TestScaffold")>
  7. <cfset assert("!structisempty(loc.r)")>
  8. <cfset assert("loc.r.version eq loc.e")>
  9. <cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq true")>
  10. <cfset global.plugins.$uninstallPlugin('TestScaffold', loc.e)>
  11. <cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq false")>
  12. </cffunction>
  13. <cffunction name="test_installing_and_uninstall_previous_version_of_plugin">
  14. <cfset loc = {}>
  15. <cfset loc.e = "0.3.1">
  16. <cfset loc.r = global.plugins.$installPlugin("TestScaffold", loc.e)>
  17. <cfset assert("!structisempty(loc.r)")>
  18. <cfset assert("loc.r.version eq loc.e")>
  19. <cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq true")>
  20. <cfset global.plugins.$uninstallPlugin('TestScaffold', loc.e)>
  21. <cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq false")>
  22. </cffunction>
  23. <cffunction name="test_installing_and_uninstall_nonexistent_version_of_plugin_which_should_install_the_latest">
  24. <cfset loc = {}>
  25. <cfset loc.e = "0.3.5">
  26. <cfset loc.r = global.plugins.$installPlugin("TestScaffold", "0.1.9")>
  27. <cfset assert("!structisempty(loc.r)")>
  28. <cfset assert("loc.r.version eq loc.e")>
  29. <cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq true")>
  30. <cfset global.plugins.$uninstallPlugin('TestScaffold', loc.e)>
  31. <cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq false")>
  32. </cffunction>
  33. <cffunction name="test_unpack_and_load_manually_added_plugins">
  34. <cfset loc = {}>
  35. <!--- first download the plugins --->
  36. <cfset loc.plugin = global.plugins.$selectPlugin("TestScaffold")>
  37. <cfset global.plugins.$downloadPlugin(loc.plugin.fullname, loc.plugin.link)>
  38. <cfset loc.plugin = global.plugins.$selectPlugin("TestModelValidators")>
  39. <cfset global.plugins.$downloadPlugin(loc.plugin.fullname, loc.plugin.link)>
  40. <!--- now unpack all of them --->
  41. <cfset global.plugins.$unpackAllPlugins()>
  42. <!--- make sure they are installed --->
  43. <cfset assert("global.plugins.$isInstalledPlugin('TestScaffold') eq true")>
  44. <cfset assert("global.plugins.$isInstalledPlugin('TestModelValidators') eq true")>
  45. <!--- uninstall them --->
  46. <cfset global.plugins.$uninstallPlugin('TestScaffold')>
  47. <cfset global.plugins.$uninstallPlugin('TestModelValidators')>
  48. </cffunction>
  49. </cfcomponent>