PageRenderTime 203ms CodeModel.GetById 101ms app.highlight 1ms RepoModel.GetById 99ms 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
 1<cfcomponent>
 2
 3	<cfinclude template="testhelper.cfm">
 4
 5	<cffunction name="test_installing_and_uninstall_lastest_version_of_plugin">
 6		<cfset loc = {}>
 7		<cfset loc.e = "0.3.5">
 8		<cfset loc.r = global.plugins.$installPlugin("TestScaffold")>
 9		<cfset assert("!structisempty(loc.r)")>
10		<cfset assert("loc.r.version eq loc.e")>
11		<cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq true")>
12		<cfset global.plugins.$uninstallPlugin('TestScaffold', loc.e)>
13		<cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq false")>
14	</cffunction>
15
16	<cffunction name="test_installing_and_uninstall_previous_version_of_plugin">
17		<cfset loc = {}>
18		<cfset loc.e = "0.3.1">
19		<cfset loc.r = global.plugins.$installPlugin("TestScaffold", loc.e)>
20		<cfset assert("!structisempty(loc.r)")>
21		<cfset assert("loc.r.version eq loc.e")>
22		<cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq true")>
23		<cfset global.plugins.$uninstallPlugin('TestScaffold', loc.e)>
24		<cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq false")>
25	</cffunction>
26
27	<cffunction name="test_installing_and_uninstall_nonexistent_version_of_plugin_which_should_install_the_latest">
28		<cfset loc = {}>
29		<cfset loc.e = "0.3.5">
30		<cfset loc.r = global.plugins.$installPlugin("TestScaffold", "0.1.9")>
31		<cfset assert("!structisempty(loc.r)")>
32		<cfset assert("loc.r.version eq loc.e")>
33		<cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq true")>
34		<cfset global.plugins.$uninstallPlugin('TestScaffold', loc.e)>
35		<cfset assert("global.plugins.$isInstalledPlugin('TestScaffold', loc.e) eq false")>
36	</cffunction>
37
38	<cffunction name="test_unpack_and_load_manually_added_plugins">
39		<cfset loc = {}>
40		<!--- first download the plugins --->
41		<cfset loc.plugin = global.plugins.$selectPlugin("TestScaffold")>
42		<cfset global.plugins.$downloadPlugin(loc.plugin.fullname, loc.plugin.link)>
43		<cfset loc.plugin = global.plugins.$selectPlugin("TestModelValidators")>
44		<cfset global.plugins.$downloadPlugin(loc.plugin.fullname, loc.plugin.link)>
45		<!--- now unpack all of them --->
46		<cfset global.plugins.$unpackAllPlugins()>
47		<!--- make sure they are installed --->
48		<cfset assert("global.plugins.$isInstalledPlugin('TestScaffold') eq true")>
49		<cfset assert("global.plugins.$isInstalledPlugin('TestModelValidators') eq true")>
50		<!--- uninstall them --->
51		<cfset global.plugins.$uninstallPlugin('TestScaffold')>
52		<cfset global.plugins.$uninstallPlugin('TestModelValidators')>
53	</cffunction>
54
55</cfcomponent>