diff --git a/.gitignore b/.gitignore index 69569d9c..37ef4a1b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,7 @@ WEB-INF/* -litepost/* -mxunit/* wirebox/* -tests/ci/results -tests/ci/results/* +testbox/* +tests/results/ .project settings.xml .settings/org.eclipse.core.resources.prefs @@ -11,8 +9,4 @@ settings.xml *.iml *.ipr *.idea -.ant-targets-build.xml run-tests.sh -/examples/6helloclojure/target/stale/extract-native.dependencies -/taskmanager/ -/server.json diff --git a/.travis.yml b/.travis.yml index e5abee62..b8196366 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,28 @@ language: java + +sudo: required + env: matrix: - - PLATFORM=acf10-linux64 - - PLATFORM=railo42beta - - PLATFORM=railo41 + - ENGINE=lucee@4.5 + - ENGINE=lucee@5 + - ENGINE=adobe@2016 + - ENGINE=adobe@11 + - ENGINE=adobe@10 + +before_install: +- sudo apt-key adv --keyserver keys.gnupg.net --recv 6DA70622 +- sudo echo "deb http://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a + /etc/apt/sources.list.d/commandbox.list + +install: +- sudo apt-get update && sudo apt-get --assume-yes install commandbox +- box install -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/c3bc8e90100d9446a065 - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: false # default: false +before_script: +- box server start cfengine=$ENGINE port=8500 openbrowser=false -install: ant -Dsource=remote -Dwork.dir=$HOME/work -Dbuild.dir=$TRAVIS_BUILD_DIR -Dplatform=$PLATFORM install-ci-deps -script: ant -Dsource=remote -Dwork.dir=$HOME/work -Dbuild.dir=$TRAVIS_BUILD_DIR -Dplatform=$PLATFORM test-ci +script: > + testResults="echo $(box testbox run reporter=mintext)"; + echo "$testResults"; + if grep -i "\[Failures: [1-9][0-9]\?[0-9]\?\]\|\[Errors: [1-9][0-9]\?[0-9]\?\]\|]*>\|]*>" <<< $testResults; then exit 1; fi diff --git a/README.md b/README.md index c46a3c73..a0251ab9 100644 --- a/README.md +++ b/README.md @@ -23,28 +23,24 @@ Please read the [Framework One Code of Conduct](CODE_OF_CONDUCT.md) - we want FW # Running the Tests -The Ant `build.xml` file is primarily designed to be used by Travis to run the tests automatically, but it is possible to run the tests locally, with some setup: +FW/1 is setup to run tests on [Travis CI](https://travis-ci.org/framework-one/fw1) using the `.travis.yml` file. -* This FW/1 directory needs to be a web root for some test domain on your local machine. I have `fw1.local` setup to resolve to this folder. -* You'll need MXUnit installed and accessible via `/mxunit` for the test domain you use for this project. You can install MXUnit into this FW/1 directory if you want - `mxunit/*` is on the `.gitignore` list. +To run tests manually, you'll need [CommandBox](https://www.ortussolutions.com/products/commandbox) installed. -You can run the build locally using a variant of this command (all on one line): +Then run `box install` once to install the dependencies (TestBox is the only one currently). - ant -Dplatform=railo41 -Dtest.path.root=/Developer/workspace/fw1 \ - -Dcontext.root= -Dserver.name=fw1.local -Dserver.port=8080 \ - run-tests-mxunit +Then start a server on port 8500 with your choice of CFML engine, e.g., -See the `run-tests-example.sh` file for a template (for Mac/Linux). + box server start cfengine=lucee@5 port=8500 -* `platform` needs to be set just to satisfy the build script it doesn't affect anything (so use `railo41` even if you're on ACF or a different version of Railo) -* `test.path.root` should be the filesystem path to this directory, i.e., the web root for the FW/1 project. -* `context.root` should probably be empty (unless you are using a named web application context) -* `server.name` should be the test domain you have configured -* `server.port` should be the port on which you access that test domain -* `run-tests-mxunit` is the actual Ant task that does the testing +This will open a browser, running the FW/1 "Introduction" app. + +You can then run the tests: + + box testbox run reporter=mintext # Copyright and License -Copyright (c) 2009-2016 Sean Corfield (and others -- see individual files for additional copyright holders). All rights reserved. +Copyright (c) 2009-2017 Sean Corfield (and others -- see individual files for additional copyright holders). All rights reserved. The use and distribution terms for this software are covered by the Apache Software License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) which can also be found in the file LICENSE at the root of this distribution and in individual licensed files. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software. diff --git a/box.json b/box.json index df1f869a..f74edda0 100644 --- a/box.json +++ b/box.json @@ -1,32 +1,66 @@ { - "name" : "Framework One", - "slug" : "fw1", - "version" : "4.0.0", - "author" : "Sean Corfield, Marcin Szczepanski, Ryan Cogswell", - "location" : "https://github.com/framework-one/fw1/archive/develop.zip", - "createPackageDirectory" : true, - "packageDirectory" : "framework", - "Homepage" : "http://framework-one.github.io/", - "Documentation" : "http://framework-one.github.io/documentation/", - "Repository" : { - "type" : "git", "URL" : "https://github.com/framework-one/fw1.git" - }, - "Bugs" : "https://github.com/framework-one/fw1/issues", - "shortDescription" : "FW/1 - Framework One - is a family of small, lightweight, convention-over-configuration frameworks, primarily for CFML.", - "description" : "FW/1 - Framework One - is a family of small, lightweight, convention-over-configuration frameworks, primarily for CFML. FW/1 itself provides MVC, DI/1 provides dependency injection (a.k.a. inversion of control), and AOP/1 provides aspect-oriented programming features on top of DI/1.", - "instructions" : "http://framework-one.github.io/documentation/", - "changelog" : "https://github.com/framework-one/fw1/commits/master", - "type" : "mvc", - "keywords" : [ "fw1", "framework one", "mvc", "conventions" ], - "private" : "false", - "engines" : [ - { "type" : "railo", "version" : ">=4.1.x" }, - { "type" : "lucee", "version" : ">=4.5.x" }, - { "type" : "adobe", "version" : ">=10.0.x" } + "name":"Framework One", + "slug":"fw1", + "version":"4.0.0", + "author":"Sean Corfield, Marcin Szczepanski, Ryan Cogswell", + "location":"https://github.com/framework-one/fw1/archive/develop.zip", + "createPackageDirectory":true, + "packageDirectory":"framework", + "Homepage":"http://framework-one.github.io/", + "Documentation":"http://framework-one.github.io/documentation/", + "Repository":{ + "type":"git", + "URL":"https://github.com/framework-one/fw1.git" + }, + "Bugs":"https://github.com/framework-one/fw1/issues", + "shortDescription":"FW/1 - Framework One - is a family of small, lightweight, convention-over-configuration frameworks, primarily for CFML.", + "description":"FW/1 - Framework One - is a family of small, lightweight, convention-over-configuration frameworks, primarily for CFML. FW/1 itself provides MVC, DI/1 provides dependency injection (a.k.a. inversion of control), and AOP/1 provides aspect-oriented programming features on top of DI/1.", + "instructions":"http://framework-one.github.io/documentation/", + "changelog":"https://github.com/framework-one/fw1/commits/master", + "type":"mvc", + "keywords":[ + "fw1", + "framework one", + "mvc", + "conventions" ], - "License" : [ - { "type" : "Apache 2.0", "URL" : "http://www.apache.org/licenses/LICENSE-2.0" } + "private":"false", + "engines":[ + { + "type":"railo", + "version":">=4.1.x" + }, + { + "type":"lucee", + "version":">=4.5.x" + }, + { + "type":"adobe", + "version":">=10.0.x" + } ], - "Contributors" : [ {"name": "Contributors List", "url": "https://github.com/framework-one/fw1/graphs/contributors"} ], - "ignore" : [ ] -} + "License":[ + { + "type":"Apache 2.0", + "URL":"http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "Contributors":[ + { + "name":"Contributors List", + "url":"https://github.com/framework-one/fw1/graphs/contributors" + } + ], + "ignore":[ + + ], + "devDependencies":{ + "testbox":"^2.3.0+00044" + }, + "installPaths":{ + "testbox":"testbox" + }, + "testbox":{ + "runner":"http://localhost:8500/tests/runner.cfm" + } +} \ No newline at end of file diff --git a/build.xml b/build.xml deleted file mode 100644 index a6503415..00000000 --- a/build.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Unkown platform ${platform} for source ${source}. - -Valid values are: - railo41 - railo41-osx - railo42beta - acf10-linux32 - acf10-linux64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/run-tests-example.sh b/run-tests-example.sh deleted file mode 100755 index ce2fb21b..00000000 --- a/run-tests-example.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# DO NOT MODIFY THIS FILE! -# -# COPY IT TO run-tests.sh AND MODIFY IT TO MATCH YOUR LOCAL -# ENVIRONMENT: test.path.root should be the file system path to your -# local repo, which should be an active web root for your CFML engine; -# server.name should be the local DNS entry that points to this -# project; server.port should be the local port you use for this -# project; You will need MXUnit (and WireBox I think) installed in -# this project's webroot (they are ignored by Git). - -ant -Dplatform=railo41 -Dtest.path.root=/Developer/workspace/fw1 \ - -Dcontext.root= -Dserver.name=fw1.local -Dserver.port=8080 \ - run-tests-mxunit diff --git a/server.json b/server.json new file mode 100644 index 00000000..a959a464 --- /dev/null +++ b/server.json @@ -0,0 +1,11 @@ +{ + "app":{ + "cfengine":"lucee@5" + }, + "web":{ + "http":{ + "port":"8500" + } + }, + "openbrowser":"false" +} \ No newline at end of file diff --git a/tests/AddBeanTest.cfc b/tests/AddBeanTest.cfc index 9937d57c..e1e11993 100644 --- a/tests/AddBeanTest.cfc +++ b/tests/AddBeanTest.cfc @@ -6,15 +6,15 @@ component extends="mxunit.framework.TestCase" { .declare( "known" ).asValue( 42 ).done(); } - function shouldHaveKnownValue() { + function testHaveKnownValue() { assertEquals( 42, variables.added.getBean( "known" ) ); } - function shouldBeSingleton() { + function testBeSingleton() { assertTrue( variables.added.isSingleton( "known" ) ); } - function shouldHaveKnownMetadata() { + function testHaveKnownMetadata() { var info = variables.added.getBeanInfo( "known" ); assertEquals( 42, info.value ); assertTrue( info.isSingleton ); diff --git a/tests/Application.cfc b/tests/Application.cfc index 2120ce9b..bf55b707 100644 --- a/tests/Application.cfc +++ b/tests/Application.cfc @@ -1,8 +1,8 @@ component{ this.name = 'fw1 test'; - variables.here = getDirectoryFromPath(getCurrentTemplatePath()); - this.mappings['/mxunit'] = variables.here & "../../mxunit"; + variables.here = getDirectoryFromPath(getCurrentTemplatePath()); + this.mappings['/mxunit'] = variables.here & "../testbox/system/compat"; this.mappings['/framework'] = variables.here & "../framework"; this.mappings['/tests'] = variables.here; - this.mappings['/goldfish/trumpets'] = variables.here & "extrabeans"; + this.mappings['/goldfish/trumpets'] = variables.here & "extrabeans"; } diff --git a/tests/BeanInfoTest.cfc b/tests/BeanInfoTest.cfc index 68b0b7c3..45a185a9 100644 --- a/tests/BeanInfoTest.cfc +++ b/tests/BeanInfoTest.cfc @@ -4,14 +4,14 @@ component extends="mxunit.framework.TestCase" { variables.factory = new framework.ioc( "" ); } - function shouldBeAStruct() { + function testBeAStruct() { var info = variables.factory.getBeanInfo(); assertTrue( isStruct( info ) ); assertEquals( 1, structCount( info ) ); assertEquals( "beaninfo", structKeyList( info ) ); } - function shouldContainMetadata() { + function testContainMetadata() { var info = variables.factory.getBeanInfo( "beanfactory" ); assertTrue( isStruct( info ) ); assertEquals( 2, structCount( info ) ); @@ -19,7 +19,7 @@ component extends="mxunit.framework.TestCase" { assertTrue( info.isSingleTon ); } - function shouldContainParent() { + function testContainParent() { var parent = new framework.ioc( "" ); variables.factory.setParent( parent ); var info = variables.factory.getBeanInfo(); @@ -27,7 +27,7 @@ component extends="mxunit.framework.TestCase" { assertTrue( structKeyExists( info.parent, "beaninfo" ) ); } - function shouldBeFlat() { + function testBeFlat() { var parent = new framework.ioc( "" ); parent.declare( "father" ).asValue( "figure" ); variables.factory.setParent( parent ); @@ -37,7 +37,7 @@ component extends="mxunit.framework.TestCase" { assertTrue( structKeyExists( info.beaninfo, "father" ) ); } - function shouldMatchRegex() { + function testMatchRegex() { variables.factory .declare( "father" ).asValue( "figure" ).done() .addBean( "mother", "figure" ); @@ -56,7 +56,7 @@ component extends="mxunit.framework.TestCase" { } - function shouldMatchRegexWithParent() { + function testMatchRegexWithParent() { variables.factory.addBean( "father", "figure" ); var parent = new framework.ioc( "" ); variables.factory.setParent( parent ); diff --git a/tests/CircularTest.cfc b/tests/CircularTest.cfc index 0ab68b98..65ed679c 100644 --- a/tests/CircularTest.cfc +++ b/tests/CircularTest.cfc @@ -1,6 +1,6 @@ component extends="mxunit.framework.TestCase" { - function shouldResolveCircular() { + function testResolveCircular() { var bf = new framework.ioc( "/tests/circular" ); var a = bf.getBean( "a" ); var b = bf.getBean( "b" ); @@ -14,7 +14,7 @@ component extends="mxunit.framework.TestCase" { assertFalse( structKeyExists( b, "name" ) ); } - function shouldResolveAndConfigureCircular() { + function testResolveAndConfigureCircular() { var bf = new framework.ioc( "/tests/circular", { initMethod = "configure" } ); var a = bf.getBean( "a" ); var b = bf.getBean( "b" ); diff --git a/tests/ConstantTest.cfc b/tests/ConstantTest.cfc index 174ca29f..fde91774 100644 --- a/tests/ConstantTest.cfc +++ b/tests/ConstantTest.cfc @@ -4,15 +4,15 @@ component extends="mxunit.framework.TestCase" { variables.constants = new framework.ioc( "", { constants = { known = 42 } } ); } - function shouldHaveKnownValue() { + function testHaveKnownValue() { assertEquals( 42, variables.constants.getBean( "known" ) ); } - function shouldBeSingleton() { + function testBeSingleton() { assertTrue( variables.constants.isSingleton( "known" ) ); } - function shouldHaveKnownMetadata() { + function testHaveKnownMetadata() { var info = variables.constants.getBeanInfo( "known" ); assertEquals( 42, info.value ); assertTrue( info.isSingleton ); diff --git a/tests/DeclareBeanTest.cfc b/tests/DeclareBeanTest.cfc index 0f0df62c..1cf70e8b 100644 --- a/tests/DeclareBeanTest.cfc +++ b/tests/DeclareBeanTest.cfc @@ -1,6 +1,6 @@ component extends="mxunit.framework.TestCase" { - function shouldDeclareSingleton() { + function testDeclareSingleton() { var bf = new framework.ioc( "" ) .declare( "foo" ).instanceOf( "tests.extrabeans.sheep.item" ).done(); structDelete( application, "itemCount" ); @@ -11,7 +11,7 @@ component extends="mxunit.framework.TestCase" { assertSame( item1, item2 ); } - function shouldDeclareTransient() { + function testDeclareTransient() { var bf = new framework.ioc( "" ) .declare( "foo" ) .instanceOf( "tests.extrabeans.sheep.item" ) @@ -25,7 +25,7 @@ component extends="mxunit.framework.TestCase" { assertNotSame( item1, item2 ); } - function shouldDeclareSingletonWithOverride() { + function testDeclareSingletonWithOverride() { var bf = new framework.ioc( "" ) .declare( "foo" ) .instanceOf( "tests.extrabeans.sheep.item" ) @@ -39,7 +39,7 @@ component extends="mxunit.framework.TestCase" { assertSame( item1, item2 ); } - function shouldDeclareTransientWithOverride() { + function testDeclareTransientWithOverride() { var bf = new framework.ioc( "" ) .declare( "foo" ) .instanceOf( "tests.extrabeans.sheep.item" ) @@ -54,7 +54,7 @@ component extends="mxunit.framework.TestCase" { assertNotSame( item1, item2 ); } - function shouldDeclareAndAdd() { + function testDeclareAndAdd() { var bf = new framework.ioc( "", { omitTypedProperties = false } ) .declare( "foo" ).instanceOf( "tests.declared.things.myconfig" ).done() .declare( "name" ).asValue( "test" ).done() @@ -64,7 +64,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( "some", item.getConfig() ); } - function shouldDeclareWithOverride() { + function testDeclareWithOverride() { var bf = new framework.ioc( "", { omitTypedProperties = false } ) .declare( "foo" ) .instanceOf( "tests.declared.things.myconfig" ) @@ -75,7 +75,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( "some", item.getConfig() ); } - function shouldDeclareInteractWithDefault() { + function testDeclareInteractWithDefault() { var bf = new framework.ioc( "", { omitDefaultedProperties = false } ).declareBean( "foo", "tests.declared.things.myconfig" ) .addBean( "dftname", "injected" ); var item = bf.getBean( "foo" ); diff --git a/tests/DisableLayoutTest.cfc b/tests/DisableLayoutTest.cfc index 80bd1bce..3668372f 100644 --- a/tests/DisableLayoutTest.cfc +++ b/tests/DisableLayoutTest.cfc @@ -10,7 +10,6 @@ component extends="tests.InjectableTest" { } function testEnabledLayout() { - variables.fw.enableLayout(); var output = ""; variables.fw.onRequestStart( "" ); savecontent variable="output" { @@ -21,6 +20,7 @@ component extends="tests.InjectableTest" { } function testExplicitlyEnabledLayout() { + variables.fw.enableLayout(); var output = ""; variables.fw.onRequestStart( "" ); savecontent variable="output" { diff --git a/tests/EmptyTest.cfc b/tests/EmptyTest.cfc index 5ff96a3a..20cadd1c 100644 --- a/tests/EmptyTest.cfc +++ b/tests/EmptyTest.cfc @@ -4,11 +4,11 @@ component extends="mxunit.framework.TestCase" { variables.emptyFactory = new framework.ioc( "" ); } - function shouldContainBeanFactory() { + function testContainBeanFactory() { assertTrue( variables.emptyFactory.containsBean( "beanFactory" ) ); } - function shouldContainJustOneBean() { + function testContainJustOneBean() { var info = variables.emptyFactory.getBeanInfo(); assertEquals( 1, structCount( info.beaninfo ) ); assertEquals( "beanfactory", structKeyList( info.beaninfo ) ); diff --git a/tests/ExtraBeansTest.cfc b/tests/ExtraBeansTest.cfc index 8cbb7205..0737b111 100644 --- a/tests/ExtraBeansTest.cfc +++ b/tests/ExtraBeansTest.cfc @@ -1,6 +1,6 @@ component extends="mxunit.framework.TestCase" { - function shouldResolveMapping() { + function testResolveMapping() { var factory = new framework.ioc( "/tests/extrabeans" ); application.itemCount = 0; assertTrue( factory.containsBean( "item" ) ); @@ -13,7 +13,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( 1, application.itemCount ); } - function shouldResolveMappingWithSingular() { + function testResolveMappingWithSingular() { var factory = new framework.ioc( "/tests/extrabeans", { singulars = { sheep = "bean" } } ); application.itemCount = 0; @@ -27,7 +27,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( 2, application.itemCount ); } - function shouldNotInjectTypedProperty() { + function testNotInjectTypedProperty() { structDelete( application, "itemCount" ); variables.factory = new framework.ioc( "/tests/model, /tests/extrabeans", { singulars = { sheep = "lamb" }, diff --git a/tests/FactoryBeanTest.cfc b/tests/FactoryBeanTest.cfc index 162ec4d6..5303ee42 100644 --- a/tests/FactoryBeanTest.cfc +++ b/tests/FactoryBeanTest.cfc @@ -1,12 +1,12 @@ component extends="mxunit.framework.TestCase" { - function shouldSupportBasicFactoryMethod() { + function testSupportBasicFactoryMethod() { var bf = new framework.ioc( "/tests/model" ); bf.declare( "a" ).fromFactory( "factory", "makeMeAnA" ); assertEquals( "I am an A", bf.getBean( "a" ) ); } - function shouldSupportFactoryFunction() { + function testSupportFactoryFunction() { var bf = new framework.ioc( "/tests/model" ); bf.declare( "a" ).fromFactory( function() { return "I am an A"; @@ -14,14 +14,14 @@ component extends="mxunit.framework.TestCase" { assertEquals( "I am an A", bf.getBean( "a" ) ); } - function shouldSupportFactoryMethodViaBean() { + function testSupportFactoryMethodViaBean() { var bf = new framework.ioc( "" ); var factory = new tests.model.services.factory(); bf.factoryBean( "a", factory, "makeMeAnA" ); assertEquals( "I am an A", bf.getBean( "a" ) ); } - function shouldSupportFactoryMethodWithBeanArg() { + function testSupportFactoryMethodWithBeanArg() { var bf = new framework.ioc( "/tests/model" ); bf.declare( "a" ) .fromFactory( "factory", "makeAWithFava" ) @@ -29,7 +29,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( "I am a fava bean", bf.getBean( "a" ) ); } - function shouldSupportFactoryMethodWithLocalArg() { + function testSupportFactoryMethodWithLocalArg() { var bf = new framework.ioc( "/tests/model" ); bf.declare( "a" ) .fromFactory( "factory", "makeAWithFava" ) diff --git a/tests/InitMethodWithConstantsTest.cfc b/tests/InitMethodWithConstantsTest.cfc index 8e166d61..a694f2b8 100644 --- a/tests/InitMethodWithConstantsTest.cfc +++ b/tests/InitMethodWithConstantsTest.cfc @@ -9,12 +9,12 @@ component extends="mxunit.framework.TestCase" { } - function shouldHaveCalledConfigure () { + function testHaveCalledConfigure () { var myService = beanFactory.getBean("myService"); assertEquals( 42, myService.getResult()); } - function shouldNotConfigureConstants () { + function testNotConfigureConstants () { var constObj = beanFactory.getBean("constObj"); assertFalse( constObj.getBooleanValue() ); diff --git a/tests/InjectPropertiesTest.cfc b/tests/InjectPropertiesTest.cfc index 9d25b7d3..7582b1a5 100644 --- a/tests/InjectPropertiesTest.cfc +++ b/tests/InjectPropertiesTest.cfc @@ -5,7 +5,7 @@ component extends="mxunit.framework.TestCase" { variables.ioc2 = new framework.ioc( "/tests/model" ); } - function shouldInjectWithType() { + function testInjectWithType() { var bean = ioc.injectProperties( "tests.declared.things.myconfig", { name = "ByType" } ); assertEquals( "ByType", bean.getName() ); try { @@ -16,7 +16,7 @@ component extends="mxunit.framework.TestCase" { } } - function shouldInjectWithObject() { + function testInjectWithObject() { var bean = ioc.injectProperties( new declared.things.myconfig( "object" ), { name = "ByObject" } ); @@ -24,7 +24,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( "object", bean.getConfig() ); } - function shouldInjectWithName() { + function testInjectWithName() { variables.ioc .addBean( "data", "data" ) .declareBean( "configObject", "tests.declared.things.myconfig" ); @@ -33,7 +33,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( "data", bean.getConfig() ); } - function shouldInjectWithNullValues( numeric userid, string username ) { + function testInjectWithNullValues( numeric userid, string username ) { // use arguments to pass into bean, argument values are null var bean = variables.ioc2.injectProperties( "user2Bean", arguments ); assertEquals( "0", bean.getUserid() ); diff --git a/tests/MappingTest.cfc b/tests/MappingTest.cfc index 85ac163e..5cc187fc 100644 --- a/tests/MappingTest.cfc +++ b/tests/MappingTest.cfc @@ -1,6 +1,6 @@ component extends="mxunit.framework.TestCase" { - function shouldResolveMapping() { + function testResolveMapping() { var factory = new framework.ioc( "/goldfish/trumpets" ); application.itemCount = 0; assertTrue( factory.containsBean( "item" ) ); @@ -13,7 +13,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( 1, application.itemCount ); } - function shouldResolveMappingWithSingular() { + function testResolveMappingWithSingular() { var factory = new framework.ioc( "/goldfish/trumpets", { singulars = { sheep = "bean" } } ); application.itemCount = 0; @@ -28,7 +28,7 @@ component extends="mxunit.framework.TestCase" { } /* - function shouldAcceptExpandedPath() { + function testAcceptExpandedPath() { // on CI, webroot does not match current directory so this becomes // an undeducible path... var servicePath = expandPath( "/tests/services" ); @@ -41,7 +41,7 @@ component extends="mxunit.framework.TestCase" { } */ - function shouldAcceptRelativePath() { + function testAcceptRelativePath() { var servicePath = "/tests/services"; var factory = new framework.ioc( servicePath ); assertTrue( factory.containsBean( "user" ) ); diff --git a/tests/ModelServiceTest.cfc b/tests/ModelServiceTest.cfc index 7eb2ce9d..e711b594 100644 --- a/tests/ModelServiceTest.cfc +++ b/tests/ModelServiceTest.cfc @@ -5,7 +5,7 @@ component extends="mxunit.framework.TestCase" { variables.factory = new framework.ioc( "/tests/model, /tests/services", { transients = [ "fish" ] } ); } - function shouldHaveUserFishAndUserService() { + function testHaveUserFishAndUserService() { assertTrue( variables.factory.containsBean( "userFish" ) ); assertTrue( variables.factory.containsBean( "userService" ) ); assertFalse( variables.factory.containsBean( "user" ) ); @@ -14,7 +14,7 @@ component extends="mxunit.framework.TestCase" { assertNotSame( user1, user2 ); } - function shouldInjectUserServiceIntoProduct() { + function testInjectUserServiceIntoProduct() { assertEquals( 0, application.userServiceCount ); var svc1 = variables.factory.getBean( "userService" ); assertEquals( 1, application.userServiceCount ); diff --git a/tests/ModelTest.cfc b/tests/ModelTest.cfc index e220218d..a905ee50 100644 --- a/tests/ModelTest.cfc +++ b/tests/ModelTest.cfc @@ -4,13 +4,13 @@ component extends="mxunit.framework.TestCase" { variables.factory = new framework.ioc( "/tests/model", { transients = [ "fish" ] } ); } - function shouldHaveBeanServiceButNoShortForm() { + function testHaveBeanServiceButNoShortForm() { assertTrue( variables.factory.containsBean( "favaBean" ) ); assertTrue( variables.factory.containsBean( "favaService" ) ); assertFalse( variables.factory.containsBean( "fava" ) ); } - function shouldHaveProductAndProductService() { + function testHaveProductAndProductService() { assertTrue( variables.factory.containsBean( "productService" ) ); assertTrue( variables.factory.containsBean( "product" ) ); var svc1 = variables.factory.getBean( "productService" ); @@ -18,7 +18,7 @@ component extends="mxunit.framework.TestCase" { assertSame( svc1, svc2 ); } - function shouldHavePintoAndPintoBean() { + function testHavePintoAndPintoBean() { assertTrue( variables.factory.containsBean( "pintoBean" ) ); assertTrue( variables.factory.containsBean( "pinto" ) ); var bean1 = variables.factory.getBean( "pintoBean" ); @@ -26,7 +26,7 @@ component extends="mxunit.framework.TestCase" { assertNotSame( bean1, bean2 ); } - function shouldHaveUserAndUserFish() { + function testHaveUserAndUserFish() { assertTrue( variables.factory.containsBean( "userFish" ) ); assertTrue( variables.factory.containsBean( "user" ) ); var user1 = variables.factory.getBean( "userFish" ); diff --git a/tests/OnLoadTest-cf10.cfm b/tests/OnLoadTest-cf10.cfm deleted file mode 100644 index 12eda7e5..00000000 --- a/tests/OnLoadTest-cf10.cfm +++ /dev/null @@ -1,6 +0,0 @@ -var onLoadHasFired = false; -var bf = new framework.ioc("/tests/model").onLoad(function(beanFactory){ - onLoadHasFired = true; - }); -var q = bf.containsBean( "foo" ); -assertTrue( onLoadHasFired ); \ No newline at end of file diff --git a/tests/OnLoadTest.cfc b/tests/OnLoadTest.cfc index 3ab30c00..01a44b77 100644 --- a/tests/OnLoadTest.cfc +++ b/tests/OnLoadTest.cfc @@ -4,14 +4,14 @@ component extends="mxunit.framework.TestCase" { application.loadCount = 0; } - function shouldCallOnLoadListener() { + function testCallOnLoadListener() { var bf = new framework.ioc( "" ).onLoad( variables.loader ); assertEquals( 0, application.loadCount ); var q = bf.containsBean( "foo" ); assertEquals( 1, application.loadCount ); } - function shouldNotCallListenerWhenReloaded() { + function testNotCallListenerWhenReloaded() { var bf = new framework.ioc( "" ).onLoad( variables.loader ); assertEquals( 0, application.loadCount ); var q = bf.containsBean( "foo" ); @@ -20,14 +20,14 @@ component extends="mxunit.framework.TestCase" { assertEquals( 1, application.loadCount ); } - function shouldCallMultipleOnLoadListeners() { + function testCallMultipleOnLoadListeners() { var bf = new framework.ioc( "" ).onLoad( variables.loader ).onLoad( variables.loader ); assertEquals( 0, application.loadCount ); var q = bf.containsBean( "foo" ); assertEquals( 2, application.loadCount ); } - function shouldBeAbleToUseObjectListener() { + function testBeAbleToUseObjectListener() { var listener = new tests.model.services.listener(); var bf = new framework.ioc( "" ).onLoad( listener ); assertFalse( listener.isLoaded() ); @@ -35,26 +35,26 @@ component extends="mxunit.framework.TestCase" { assertTrue( listener.isLoaded() ); } - function shouldBeAbleToUseBeanListener() { + function testBeAbleToUseBeanListener() { var bf = new framework.ioc( "/tests/model" ).onLoad( "listenerService" ); var q = bf.containsBean( "foo" ); assertTrue( bf.getBean( "listener" ).isLoaded() ); } - function shouldBeAbleToUseFunctionExpressionListener() { - - if (listFirst(server.coldfusion.productVersion) >= 10) { - //splitting this out so that it doesnt break the tests when running on cf9 - include "OnLoadTest-cf10.cfm"; - } - + function testBeAbleToUseFunctionExpressionListener() { + var onLoadHasFired = false; + var bf = new framework.ioc("/tests/model").onLoad(function(beanFactory){ + onLoadHasFired = true; + }); + var q = bf.containsBean( "foo" ); + assertTrue( onLoadHasFired ); } private void function loader( any factory ) { ++application.loadCount; } - function shouldBeAbleToListenViaConfig() { + function testBeAbleToListenViaConfig() { var listener = new tests.model.services.listener(); var bf = new framework.ioc( "", { loadListener = listener } ); assertFalse( listener.isLoaded() ); diff --git a/tests/ParentTest.cfc b/tests/ParentTest.cfc index 38807ce1..a52050ce 100644 --- a/tests/ParentTest.cfc +++ b/tests/ParentTest.cfc @@ -6,36 +6,36 @@ component extends="mxunit.framework.TestCase" { variables.factory.setParent( variables.parent ); } - function shouldFindInParent() { + function testFindInParent() { assertEquals( 2, variables.factory.getBean( "two" ) ); } - function shouldFindInChild() { + function testFindInChild() { assertEquals( "I", variables.factory.getBean( "one" ) ); assertEquals( "III", variables.factory.getBean( "three" ) ); } - function shouldContainViaParent() { + function testContainViaParent() { assertTrue( variables.factory.containsBean( "two" ) ); } - function shouldGetMetadataViaParent() { + function testGetMetadataViaParent() { var info = variables.factory.getBeanInfo( "two" ); assertEquals( 2, info.value ); assertTrue( info.isSingleton ); } - function shouldBeSingletonViaParent() { + function testBeSingletonViaParent() { assertTrue( variables.factory.isSingleton( "two" ) ); } - function shouldHaveParentInMetadata() { + function testHaveParentInMetadata() { var info = variables.factory.getBeanInfo(); assertTrue( structKeyExists( info, "parent" ) ); assertEquals( variables.parent.getBeanInfo(), info.parent ); } - function shouldNotHaveParentWithRegex() { + function testNotHaveParentWithRegex() { var info = variables.factory.getBeanInfo( regex = "X" ); assertFalse( structKeyExists( info, "parent" ) ); } diff --git a/tests/TransientInjectionTest.cfc b/tests/TransientInjectionTest.cfc index 9a8d70c0..949e6827 100644 --- a/tests/TransientInjectionTest.cfc +++ b/tests/TransientInjectionTest.cfc @@ -1,6 +1,6 @@ component extends="mxunit.framework.TestCase" { - function shouldReturnWiredTransient() { + function testReturnWiredTransient() { // issue #420 var bf = new framework.ioc( "" ); bf.declareBean("transient", "tests.issue420.transient", false); diff --git a/tests/TransientTest.cfc b/tests/TransientTest.cfc index f6613f50..9632e7c4 100644 --- a/tests/TransientTest.cfc +++ b/tests/TransientTest.cfc @@ -1,6 +1,6 @@ component extends="mxunit.framework.TestCase" { - function shouldNotInjectTransient() { + function testNotInjectTransient() { variables.factory = new framework.ioc( "/tests/model, /tests/extrabeans", { transients = [ "fish" ], singulars = { sheep = "bean" } } ); assertTrue( variables.factory.containsBean( "item" ) ); @@ -11,7 +11,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( "missing", item ); } - function shouldConstructWithTransient() { + function testConstructWithTransient() { variables.factory = new framework.ioc( "/tests/model", { transients = [ "fish", "services" ] } ); assertTrue( variables.factory.containsBean( "product" ) ); @@ -21,7 +21,7 @@ component extends="mxunit.framework.TestCase" { assertTrue( isObject( product ) ); } - function shouldInitializeWithBeans() { + function testInitializeWithBeans() { variables.factory = new framework.ioc( "/tests/model, /tests/extrabeans", { transients = [ "fish" ], singulars = { sheep = "bean" } } ) .addBean( "one", 1 ).addBean( "two", "two" ); @@ -33,7 +33,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( n1 + 1, application.itemCount ); } - function shouldInitializeWithConstructorArgs() { + function testInitializeWithConstructorArgs() { variables.factory = new framework.ioc( "/tests/model, /tests/extrabeans", { transients = [ "fish" ], singulars = { sheep = "bean" } } ) .addBean( "one", 1 ).addBean( "two", "two" ); @@ -45,7 +45,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( n1, application.itemCount ); } - function shouldInitializeWithOnlyConstructorArgs() { + function testInitializeWithOnlyConstructorArgs() { variables.factory = new framework.ioc( "/tests/extrabeans", { singulars = { sheep = "bean" } } ); var i = variables.factory.getBean( "item" ); diff --git a/tests/ci/HttpAntRunner.cfc b/tests/ci/HttpAntRunner.cfc deleted file mode 100644 index 1633d332..00000000 --- a/tests/ci/HttpAntRunner.cfc +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - if(arguments.type is "testcase"){ - suite = createObject("component","mxunit.framework.TestSuite").TestSuite(); - suite.addAll(arguments.value); - results = suite.run(); - } - if(arguments.type is "dir"){ - //To Do: add args for recursion, includes, and excludes - if(not isBoolean(arguments.recurse)){ - arguments.recurse = false; - } - - results = createObject("component","mxunit.runner.DirectoryTestSuite").run(directory=arguments.value, componentPath=arguments.componentPath, recurse=arguments.recurse, excludes=arguments.excludes); - } - //package name for JUnit reports - results.setPackage(arguments.packagename); - - - - - - - - - - - - - - - - - #trim(arguments.results.getHTMLResults())# - - - #trim(arguments.results.getXMLResults())# - - - #trim(arguments.results.getJUnitXMLResults())# - - #trim(arguments.results.getJUnitXMLResults())# - - - - - - - - - - - - - - - - - if(arguments.type is "testcase"){ - suite = createObject("component","mxunit.framework.TestSuite").TestSuite(); - suite.addAll(arguments.value); - results = suite.run(); - } - if(arguments.type is "dir"){ - //To Do: add args for recursion, includes, and excludes - if(not isBoolean(arguments.recurse)){ - arguments.recurse = false; - } - - results = createObject("component","DirectoryTestSuite").run(directory=arguments.value, componentPath=arguments.componentPath, recurse=arguments.recurse, excludes=arguments.excludes); - } - //package name for JUnit reports - results.setPackage(arguments.packagename); - - - - - - - - diff --git a/tests/ci/mxunit-ant.jar b/tests/ci/mxunit-ant.jar deleted file mode 100644 index 1731e2a7..00000000 Binary files a/tests/ci/mxunit-ant.jar and /dev/null differ diff --git a/tests/ci/mxunit-output-ant.jar b/tests/ci/mxunit-output-ant.jar deleted file mode 100644 index 69b84deb..00000000 Binary files a/tests/ci/mxunit-output-ant.jar and /dev/null differ diff --git a/tests/ci/scripts/acf9-control.sh b/tests/ci/scripts/acf9-control.sh deleted file mode 100755 index 14e40214..00000000 --- a/tests/ci/scripts/acf9-control.sh +++ /dev/null @@ -1,10 +0,0 @@ -pushd $WORK_DIR/jrun4/bin > /dev/null -case $1 in - start) - ./jrun -start cfusion>/dev/null& - ;; - stop) - ./jrun -stop cfusion>/dev/null& - ;; -esac -popd > /dev/null \ No newline at end of file diff --git a/tests/ci/scripts/ci-helper-acf.sh b/tests/ci/scripts/ci-helper-acf.sh deleted file mode 100755 index a6a4cd29..00000000 --- a/tests/ci/scripts/ci-helper-acf.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -CONTROL_SCRIPT='coldfusion10/cfusion/bin/coldfusion' - -PLATFORM_DIR="coldfusion10" -WEBROOT="coldfusion10/cfusion/wwwroot" -MY_DIR=`dirname $0` -source $MY_DIR/ci-helper-base.sh $1 $2 - -case $1 in - install) - echo "Fixing ACF install directory..." - grep -rl "/opt/coldfusion10/" --exclude-dir=$WEBROOT . | xargs -n 1 sed -i "s#/opt/coldfusion10/#$WORK_DIR/coldfusion10/#g" - - sed -i "s/8500/$SERVER_PORT/g" coldfusion10/cfusion/runtime/conf/server.xml - ;; - start|stop) - ;; - *) - echo "Usage: $0 {install|start|stop}" - exit 1 - ;; -esac - -exit 0 \ No newline at end of file diff --git a/tests/ci/scripts/ci-helper-acf9.sh b/tests/ci/scripts/ci-helper-acf9.sh deleted file mode 100755 index dd6a3fe5..00000000 --- a/tests/ci/scripts/ci-helper-acf9.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -PLATFORM_DIR="jrun4" -WEBROOT="jrun4/servers/cfusion/cfusion-ear/cfusion-war" - -MY_DIR=`dirname $0` -CONTROL_SCRIPT="`pwd`/$MY_DIR/acf9-control.sh" - -source $MY_DIR/ci-helper-base.sh $1 $2 - -case $1 in - install) - echo "Fixing ACF install directory..." - grep -rl "/opt/jrun4/" --exclude-dir=$WEBROOT . | xargs -n 1 sed -i "s#/opt/jrun4/#$WORK_DIR/jrun4/#g" - - sed -i "s/8300/$SERVER_PORT/g" jrun4/servers/cfusion/SERVER-INF/jrun.xml - ;; - start|stop) - ;; - *) - echo "Usage: $0 {install|start|stop}" - exit 1 - ;; -esac - -exit 0 \ No newline at end of file diff --git a/tests/ci/scripts/ci-helper-base.sh b/tests/ci/scripts/ci-helper-base.sh deleted file mode 100755 index 5843f37c..00000000 --- a/tests/ci/scripts/ci-helper-base.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/bash -if [ ! -n "$WORK_DIR" ]; then - echo "WORK_DIR must be set!" - exit 1 -fi - -if [ ! -n "$BUILD_DIR" ]; then - BUILD_DIR=`pwd` -fi - -echo "Working directory: $WORK_DIR, Build directory: $BUILD_DIR" - -if [ ! "$1" == "install" ]; then - - if [ ! -d $WORK_DIR ]; then - echo "Working directory doesn't exist and this isn't an install!" - exit 1 - else - cd $WORK_DIR - fi -else - if [ ! -n "$2" ]; then - echo "usage: $0 install PROJECTNAME"; - exit 1 - fi -fi - -WGET_OPTS="-nv" - -function download_and_extract { - FILENAME=`echo $1|awk '{split($0,a,"/"); print a[length(a)]}'` - if [[ "$1" == /* ]]; then - echo "Copying $1 to $FILENAME" - cp $1 $FILENAME - else - echo "Downloading $1 to $FILENAME" - wget $WGET_OPTS $1 -O $FILENAME - fi - - if [[ "$FILENAME" == *zip ]]; then - unzip -q $FILENAME - else - tar -zxf $FILENAME - fi - rm $FILENAME - result=$FILENAME -} - - -if [ ! -n "$SERVER_PORT" ]; then - SERVER_PORT="8500" -fi - -HEALTHCHECK_URL="http://localhost:$SERVER_PORT" - - -case $1 in - install) - if [ -d $WORK_DIR ]; then - echo "Removing $WORK_DIR" - rm -rf $WORK_DIR - fi - - mkdir -p $WORK_DIR - cd $WORK_DIR - - download_and_extract $PLATFORM_URL - - # assume platform dir is the only dir - FIRST_DIR=`ls -b` - if [ "$FIRST_DIR" != "$PLATFORM_DIR" ]; then - mv $FIRST_DIR $PLATFORM_DIR - fi - download_and_extract $TESTFRAMEWORK_URL - - case $TESTFRAMEWORK in - mxunit) - mv mxunit* "$WEBROOT/$TESTFRAMEWORK" - ;; - testbox) - mv testbox "$WEBROOT/$TESTFRAMEWORK" - ;; - esac - ln -s $BUILD_DIR $WEBROOT/$2 - ;; - start) - if [ ! -f $CONTROL_SCRIPT ]; then - echo "Control script does not exist!" - exit 1 - fi - echo "Starting server... ($HEALTHCHECK_URL)" - $CONTROL_SCRIPT start& - until [ "`curl --connect-timeout 2 -m 2 -s -o /dev/null -w "%{http_code}" $HEALTHCHECK_URL`" == "200" ] - do - echo "Waiting for server to start..." - sleep 2 - done - ;; - stop) - echo "Stopping server..." - $CONTROL_SCRIPT stop - while curl --connect-timeout 2 --max-time 2 -s $HEALTHCHECK_URL>/dev/null - do - echo "Waiting for server to stop..." - sleep 1 - done - ;; - *) - echo "Usage: $0 {install|start|stop}" - exit 1 - ;; -esac \ No newline at end of file diff --git a/tests/ci/scripts/ci-helper-railo.sh b/tests/ci/scripts/ci-helper-railo.sh deleted file mode 100755 index 4941796e..00000000 --- a/tests/ci/scripts/ci-helper-railo.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -set -e - -case $1 in - start) - CONTROL_SCRIPT='railo/start' - ;; - stop) - CONTROL_SCRIPT='railo/stop' - ;; -esac - -PLATFORM_DIR="railo" -WEBROOT="railo/webapps/www" -MY_DIR=`dirname $0` -source $MY_DIR/ci-helper-base.sh $1 $2 - -case $1 in - install) - chmod a+x railo/start - chmod a+x railo/stop - - sed -i "s/jetty.port=8888/jetty.port=$SERVER_PORT/g" railo/start - sed -i "s/STOP.PORT=8887/STOP.PORT=$STOP_PORT/g" railo/start - sed -i "s/STOP.PORT=8887/STOP.PORT=$STOP_PORT/g" railo/stop - ;; - start|stop) - ;; - *) - echo "Usage: $0 {install|start|stop}" - exit 1 - ;; -esac - -exit 0 \ No newline at end of file diff --git a/tests/defaultPropertyTest.cfc b/tests/defaultPropertyTest.cfc index f05e0369..b327397a 100644 --- a/tests/defaultPropertyTest.cfc +++ b/tests/defaultPropertyTest.cfc @@ -7,7 +7,7 @@ component extends=mxunit.framework.TestCase { .done(); } - function shouldHaveDefaultValue() { + function testHaveDefaultValue() { var data = { viaNew : new tests.extrabeans.sheep.default(), viaDI1 : variables.bf.getBean( "default" ) diff --git a/tests/defaultargTest.cfc b/tests/defaultargTest.cfc index 311b25e1..6a8d2224 100644 --- a/tests/defaultargTest.cfc +++ b/tests/defaultargTest.cfc @@ -1,6 +1,6 @@ component extends="mxunit.framework.TestCase" { - - function checkDefaultInitArgWorks() { + + function testDefaultInitArgWorks() { var factory = new framework.ioc( "/tests/model", { constants = { dsn = "sample" } } ); var user37 = factory.getBean( "user37" ); assertEquals( "sample", user37.getDSN() ); @@ -11,7 +11,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( 0, user37b.getID() ); } - function checkDefaultInitArgThreeArgs() { + function testDefaultInitArgThreeArgs() { var factory = new framework.ioc( "/tests/model", { constants = { dsn = "sample" } } ); var user37c = factory.getBean( "user37c" ); @@ -27,8 +27,8 @@ component extends="mxunit.framework.TestCase" { assertEquals( "John", user37c.getName() ); } - - function checkDefaultInitArgWorksStrict() { + + function testDefaultInitArgWorksStrict() { var factory = new framework.ioc( "/tests/model", { strict = true, constants = { dsn = "sample" } } ); @@ -41,7 +41,7 @@ component extends="mxunit.framework.TestCase" { assertEquals( 0, user37b.getID() ); } - function checkDefaultInitArgThreeArgsStrict() { + function testDefaultInitArgThreeArgsStrict() { var factory = new framework.ioc( "/tests/model", { strict = true, constants = { dsn = "sample" } } ); diff --git a/tests/onSessionStartBuildURLTest.cfc b/tests/onSessionStartBuildURLTest.cfc index d1a3999c..3e6f1834 100644 --- a/tests/onSessionStartBuildURLTest.cfc +++ b/tests/onSessionStartBuildURLTest.cfc @@ -27,7 +27,7 @@ component extends="tests.InjectableTest" { public void function testURLandURI() { variables.fw.onRequestStart("/index.cfm"); assertEquals( "useCgiScriptName", variables.fw.getBaseURL() ); - var suffix = "/tests/ci/"; + var suffix = "/tests/"; assertEquals( suffix, right( variables.fw.buildURL( action = 'main.default' ), len( suffix ) ) ); suffix &= "main/default"; diff --git a/tests/runner.cfm b/tests/runner.cfm new file mode 100644 index 00000000..d8d30ce1 --- /dev/null +++ b/tests/runner.cfm @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/tests/singletonPatternTest.cfc b/tests/singletonPatternTest.cfc index a729004e..b488cbe6 100644 --- a/tests/singletonPatternTest.cfc +++ b/tests/singletonPatternTest.cfc @@ -1,16 +1,19 @@ component extends="mxunit.framework.TestCase" { - + function setup() { - /** + /** * Note that although 'BeerFactory' and 'BarService' match the singletonpattern * they are considered transients as in the beans folder - **/ + **/ transients = ['BarService','Beer','BeerFactory','Wine','Coffee','Tea','Burger','Pizza']; singletons = ['DrinksService','FoodFactory']; - + variables.factory = new framework.ioc( "/tests/singletonPattern", { singletonPattern = ".+(Service|Factory)$" } ); } - + + function testForSingletons() { + for ( var s in singletons ) checkForSingletons( s ); + } function checkForSingletons( required beanname ) dataprovider="singletons" { assertTrue( variables.factory.containsBean( arguments.beanname ) ); assertTrue( variables.factory.isSingleton( arguments.beanname ) ); @@ -18,7 +21,10 @@ component extends="mxunit.framework.TestCase" { instanceB = variables.factory.getBean( arguments.beanname ); assertSame( instanceA, instanceB ); } - + + function testForTransients() { + for ( var t in transients ) checkForTransients( t ); + } function checkForTransients( beanname ) dataprovider="transients" { //assertTrue( variables.factory.containsBean( beanname ) ); assertFalse( variables.factory.isSingleton( beanname ) ); @@ -27,7 +33,7 @@ component extends="mxunit.framework.TestCase" { assertNotSame( instanceA, instanceB ); } - function checkPatternsAreExclusive() { + function testPatternsAreExclusive() { try { var bad = new framework.ioc( '', { singletonPattern = '', transientPattern = '' } ); fail( 'Both arguments were allowed' ); diff --git a/tests/transientPatternTest.cfc b/tests/transientPatternTest.cfc index ab4fc762..e8d525bd 100644 --- a/tests/transientPatternTest.cfc +++ b/tests/transientPatternTest.cfc @@ -1,12 +1,15 @@ component extends="mxunit.framework.TestCase" { - + function setup() { transients = ['BarService','Beer','BeerFactory','Wine','CoffeeFoo','PizzaFoo']; singletons = ['Drinks','Tea','Burger','FoodFactory']; - + variables.factory = new framework.ioc( "/tests/transientPattern", { transientPattern = ".+(Foo)$" } ); } - + + function testForSingletons() { + for ( var s in singletons ) checkForSingletons( s ); + } function checkForSingletons( required beanname ) dataprovider="singletons" { assertTrue( variables.factory.containsBean( arguments.beanname ) ); assertTrue( variables.factory.isSingleton( arguments.beanname ) ); @@ -14,7 +17,10 @@ component extends="mxunit.framework.TestCase" { instanceB = variables.factory.getBean( arguments.beanname ); assertSame( instanceA, instanceB ); } - + + function testForTransients() { + for ( var t in transients ) checkForTransients( t ); + } function checkForTransients( beanname ) dataprovider="transients" { //assertTrue( variables.factory.containsBean( beanname ) ); assertFalse( variables.factory.isSingleton( beanname ) );