summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2016-03-25 17:55:51 +0100
committerFabio Bas <ctrlaltca@gmail.com>2016-03-25 17:55:51 +0100
commita3388622287e218beddfa14a47ed677d4307b36b (patch)
tree1b4c7ac8597b1cc798b6683d4a81c90d38de12f6 /tests
parentc7fd3e1167b6f2fa7746edbd0fb8f8c1694c61f9 (diff)
Removed simpletest and moved all tests in the unit tree
Tests are executed now, but a lot of them need fixing.
Diffstat (limited to 'tests')
-rw-r--r--tests/simple_unit/ActiveRecord/ActiveRecordRegistryTestCase.php165
-rw-r--r--tests/simple_unit/SqlMap/Dynamic/DynamicTest.php9
-rw-r--r--tests/simple_unit/unit.php7
-rwxr-xr-xtests/test_tools/simpletest/CHANGELOG6
-rwxr-xr-xtests/test_tools/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE312
-rw-r--r--tests/test_tools/simpletest/HtmlReporterWithCoverage.php267
-rwxr-xr-xtests/test_tools/simpletest/LICENSE502
-rwxr-xr-xtests/test_tools/simpletest/README108
-rwxr-xr-xtests/test_tools/simpletest/VERSION1
-rw-r--r--tests/test_tools/simpletest/authentication.php237
-rw-r--r--tests/test_tools/simpletest/browser.php1056
-rw-r--r--tests/test_tools/simpletest/collector.php113
-rw-r--r--tests/test_tools/simpletest/compatibility.php183
-rw-r--r--tests/test_tools/simpletest/cookies.php379
-rw-r--r--tests/test_tools/simpletest/detached.php95
-rwxr-xr-xtests/test_tools/simpletest/docs/en/authentication_documentation.html336
-rwxr-xr-xtests/test_tools/simpletest/docs/en/browser_documentation.html391
-rwxr-xr-xtests/test_tools/simpletest/docs/en/docs.css84
-rwxr-xr-xtests/test_tools/simpletest/docs/en/expectation_documentation.html346
-rwxr-xr-xtests/test_tools/simpletest/docs/en/form_testing_documentation.html276
-rwxr-xr-xtests/test_tools/simpletest/docs/en/group_test_documentation.html354
-rwxr-xr-xtests/test_tools/simpletest/docs/en/index.html461
-rwxr-xr-xtests/test_tools/simpletest/docs/en/mock_objects_documentation.html727
-rwxr-xr-xtests/test_tools/simpletest/docs/en/overview.html406
-rwxr-xr-xtests/test_tools/simpletest/docs/en/partial_mocks_documentation.html423
-rwxr-xr-xtests/test_tools/simpletest/docs/en/reporter_documentation.html512
-rwxr-xr-xtests/test_tools/simpletest/docs/en/server_stubs_documentation.html388
-rwxr-xr-xtests/test_tools/simpletest/docs/en/unit_test_documentation.html390
-rwxr-xr-xtests/test_tools/simpletest/docs/en/web_tester_documentation.html511
-rw-r--r--tests/test_tools/simpletest/dumper.php401
-rw-r--r--tests/test_tools/simpletest/encoding.php520
-rw-r--r--tests/test_tools/simpletest/errors.php181
-rw-r--r--tests/test_tools/simpletest/exceptions.php45
-rw-r--r--tests/test_tools/simpletest/expectation.php719
-rw-r--r--tests/test_tools/simpletest/form.php351
-rw-r--r--tests/test_tools/simpletest/frames.php587
-rw-r--r--tests/test_tools/simpletest/http.php623
-rw-r--r--tests/test_tools/simpletest/invoker.php138
-rw-r--r--tests/test_tools/simpletest/mock_objects.php1272
-rw-r--r--tests/test_tools/simpletest/options.php365
-rw-r--r--tests/test_tools/simpletest/page.php974
-rw-r--r--tests/test_tools/simpletest/parser.php772
-rw-r--r--tests/test_tools/simpletest/reflection_php4.php114
-rw-r--r--tests/test_tools/simpletest/reflection_php5.php274
-rw-r--r--tests/test_tools/simpletest/remote.php114
-rw-r--r--tests/test_tools/simpletest/reporter.php366
-rw-r--r--tests/test_tools/simpletest/runner.php299
-rw-r--r--tests/test_tools/simpletest/scorer.php776
-rw-r--r--tests/test_tools/simpletest/selector.php132
-rw-r--r--tests/test_tools/simpletest/shell_tester.php305
-rw-r--r--tests/test_tools/simpletest/simple_test.php552
-rw-r--r--tests/test_tools/simpletest/simpletest.php281
-rw-r--r--tests/test_tools/simpletest/socket.php215
-rw-r--r--tests/test_tools/simpletest/tag.php1391
-rw-r--r--tests/test_tools/simpletest/test_case.php689
-rw-r--r--tests/test_tools/simpletest/unit_tester.php372
-rw-r--r--tests/test_tools/simpletest/url.php524
-rw-r--r--tests/test_tools/simpletest/user_agent.php332
-rw-r--r--tests/test_tools/simpletest/web_tester.php1454
-rw-r--r--tests/test_tools/simpletest/xml.php613
-rw-r--r--tests/unit/AllTests.php2
-rw-r--r--tests/unit/Caching/AllTests.php29
-rw-r--r--tests/unit/Collections/AllTests.php37
-rw-r--r--tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php (renamed from tests/simple_unit/ActiveRecord/ActiveRecordDynamicCallTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/ActiveRecordFinderTest.php (renamed from tests/simple_unit/ActiveRecord/ActiveRecordFinderTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/ActiveRecordMySql5Test.php (renamed from tests/simple_unit/ActiveRecord/ActiveRecordMySql5TestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/BaseActiveRecordTest.php (renamed from tests/simple_unit/ActiveRecord/BaseActiveRecordTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/CountRecordsTest.php (renamed from tests/simple_unit/ActiveRecord/CountRecordsTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/CriteriaTest.php (renamed from tests/simple_unit/ActiveRecord/CriteriaTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/DeleteByPkTest.php (renamed from tests/simple_unit/ActiveRecord/DeleteByPkTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/FindByPksTest.php (renamed from tests/simple_unit/ActiveRecord/FindByPksTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/FindBySqlTest.php (renamed from tests/simple_unit/ActiveRecord/FindBySqlTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/ForeignKeyTest.php (renamed from tests/simple_unit/ActiveRecord/ForeignKeyTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/ForeignObjectUpdateTest.php (renamed from tests/simple_unit/ActiveRecord/ForeignObjectUpdateTest.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/MultipleForeignKeyTest.php (renamed from tests/simple_unit/ActiveRecord/MultipleForeignKeyTestCase.php)13
-rw-r--r--tests/unit/Data/ActiveRecord/RecordEventTest.php (renamed from tests/simple_unit/ActiveRecord/RecordEventTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/SqliteTest.php (renamed from tests/simple_unit/ActiveRecord/SqliteTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/UserRecordTest.php (renamed from tests/simple_unit/ActiveRecord/UserRecordTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/ViewRecordTest.php (renamed from tests/simple_unit/ActiveRecord/ViewRecordTestCase.php)5
-rw-r--r--tests/unit/Data/ActiveRecord/ar_test.db (renamed from tests/simple_unit/ActiveRecord/ar_test.db)bin5120 -> 5120 bytes
-rw-r--r--tests/unit/Data/ActiveRecord/blog.db (renamed from tests/simple_unit/ActiveRecord/blog.db)bin4096 -> 4096 bytes
-rw-r--r--tests/unit/Data/ActiveRecord/fk_tests.db (renamed from tests/simple_unit/ActiveRecord/fk_tests.db)bin9216 -> 9216 bytes
-rw-r--r--tests/unit/Data/ActiveRecord/mysql4text.sql (renamed from tests/simple_unit/ActiveRecord/mysql4text.sql)102
-rw-r--r--tests/unit/Data/ActiveRecord/records/Blogs.php (renamed from tests/simple_unit/ActiveRecord/records/Blogs.php)0
-rw-r--r--tests/unit/Data/ActiveRecord/records/DepSections.php (renamed from tests/simple_unit/ActiveRecord/records/DepSections.php)0
-rw-r--r--tests/unit/Data/ActiveRecord/records/DepartmentRecord.php (renamed from tests/simple_unit/ActiveRecord/records/DepartmentRecord.php)0
-rw-r--r--tests/unit/Data/ActiveRecord/records/ItemRecord.php (renamed from tests/simple_unit/ActiveRecord/records/ItemRecord.php)0
-rw-r--r--tests/unit/Data/ActiveRecord/records/SimpleUser.php (renamed from tests/simple_unit/ActiveRecord/records/SimpleUser.php)0
-rw-r--r--tests/unit/Data/ActiveRecord/records/SqliteUsers.php (renamed from tests/simple_unit/ActiveRecord/records/SqliteUsers.php)0
-rw-r--r--tests/unit/Data/ActiveRecord/records/UserRecord.php (renamed from tests/simple_unit/ActiveRecord/records/UserRecord.php)0
-rw-r--r--tests/unit/Data/ActiveRecord/sqlite.sql (renamed from tests/simple_unit/ActiveRecord/sqlite.sql)90
-rw-r--r--tests/unit/Data/ActiveRecord/test1.sqlite (renamed from tests/simple_unit/ActiveRecord/test1.sqlite)bin6144 -> 6144 bytes
-rw-r--r--tests/unit/Data/DataGateway/AllTests.php27
-rw-r--r--tests/unit/Data/DbCommon/CommandBuilderMssqlTest.php (renamed from tests/simple_unit/DbCommon/CommandBuilderMssqlTest.php)5
-rw-r--r--tests/unit/Data/DbCommon/CommandBuilderMysqlTest.php (renamed from tests/simple_unit/DbCommon/CommandBuilderMysqlTest.php)5
-rw-r--r--tests/unit/Data/DbCommon/CommandBuilderPgsqlTest.php (renamed from tests/simple_unit/DbCommon/CommandBuilderPgsqlTest.php)5
-rw-r--r--tests/unit/Data/DbCommon/MssqlColumnTest.php (renamed from tests/simple_unit/DbCommon/MssqlColumnTest.php)5
-rw-r--r--tests/unit/Data/DbCommon/Mysql4ColumnTest.php (renamed from tests/simple_unit/DbCommon/Mysql4ColumnTest.php)5
-rw-r--r--tests/unit/Data/DbCommon/MysqlColumnTest.php (renamed from tests/simple_unit/DbCommon/MysqlColumnTest.php)5
-rw-r--r--tests/unit/Data/DbCommon/PgsqlColumnTest.php (renamed from tests/simple_unit/DbCommon/PgsqlColumnTest.php)6
-rw-r--r--tests/unit/Data/DbCommon/SqliteColumnTest.php (renamed from tests/simple_unit/DbCommon/SqliteColumnTest.php)6
-rw-r--r--tests/unit/Data/SqlMap/ActiveRecordSqlMapTest.php (renamed from tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php)3
-rw-r--r--tests/unit/Data/SqlMap/AllTests.php29
-rw-r--r--tests/unit/Data/SqlMap/BaseCase.php (renamed from tests/simple_unit/SqlMap/BaseCase.php)4
-rw-r--r--tests/unit/Data/SqlMap/CacheTest.php (renamed from tests/simple_unit/SqlMap/CacheTest.php)2
-rw-r--r--tests/unit/Data/SqlMap/DataMapper/AllTests.php27
-rw-r--r--tests/unit/Data/SqlMap/DelegateTest.php (renamed from tests/simple_unit/SqlMap/DelegateTest.php)2
-rw-r--r--tests/unit/Data/SqlMap/GroupByTest.php (renamed from tests/simple_unit/SqlMap/GroupByTest.php)6
-rw-r--r--tests/unit/Data/SqlMap/InheritanceTest.php (renamed from tests/simple_unit/SqlMap/InheritanceTest.php)2
-rw-r--r--tests/unit/Data/SqlMap/ParameterMapTest.php (renamed from tests/simple_unit/SqlMap/ParameterMapTest.php)2
-rw-r--r--tests/unit/Data/SqlMap/PropertyAccessTest.php (renamed from tests/simple_unit/SqlMap/PropertyAccessTest.php)2
-rw-r--r--tests/unit/Data/SqlMap/ResultClassTest.php (renamed from tests/simple_unit/SqlMap/ResultClassTest.php)2
-rw-r--r--tests/unit/Data/SqlMap/ResultMapTest.php (renamed from tests/simple_unit/SqlMap/ResultMapTest.php)2
-rw-r--r--tests/unit/Data/SqlMap/SelectKeyTest.php (renamed from tests/simple_unit/SqlMap/SelectKeyTest.php)2
-rw-r--r--tests/unit/Data/SqlMap/SqlMapCacheTest.php (renamed from tests/simple_unit/SqlMap/SqlMapCacheTest.php)4
-rw-r--r--tests/unit/Data/SqlMap/StatementExtendsTest.php (renamed from tests/simple_unit/SqlMap/StatementExtendsTest.php)6
-rw-r--r--tests/unit/Data/SqlMap/StatementTest.php (renamed from tests/simple_unit/SqlMap/StatementTest.php)2
-rw-r--r--tests/unit/Data/SqlMap/TestQueryForMap.php (renamed from tests/simple_unit/SqlMap/TestQueryForMap.php)3
-rw-r--r--tests/unit/Data/SqlMap/Ticket589Test.php (renamed from tests/simple_unit/Tickets/Ticket589Test.php)5
-rw-r--r--tests/unit/Data/SqlMap/common.php (renamed from tests/simple_unit/SqlMap/common.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/A.php (renamed from tests/simple_unit/SqlMap/domain/A.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/Account.php (renamed from tests/simple_unit/SqlMap/domain/Account.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/AccountBis.php (renamed from tests/simple_unit/SqlMap/domain/AccountBis.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/AccountCollection.php (renamed from tests/simple_unit/SqlMap/domain/AccountCollection.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/B.php (renamed from tests/simple_unit/SqlMap/domain/B.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/Book.php (renamed from tests/simple_unit/SqlMap/domain/Book.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/C.php (renamed from tests/simple_unit/SqlMap/domain/C.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/Category.php (renamed from tests/simple_unit/SqlMap/domain/Category.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/Complex.php (renamed from tests/simple_unit/SqlMap/domain/Complex.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/D.php (renamed from tests/simple_unit/SqlMap/domain/D.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/Document.php (renamed from tests/simple_unit/SqlMap/domain/Document.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/DocumentCollection.php (renamed from tests/simple_unit/SqlMap/domain/DocumentCollection.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/E.php (renamed from tests/simple_unit/SqlMap/domain/E.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/F.php (renamed from tests/simple_unit/SqlMap/domain/F.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/LineItem.php (renamed from tests/simple_unit/SqlMap/domain/LineItem.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/LineItemCollection.php (renamed from tests/simple_unit/SqlMap/domain/LineItemCollection.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/Newspaper.php (renamed from tests/simple_unit/SqlMap/domain/Newspaper.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/Order.php (renamed from tests/simple_unit/SqlMap/domain/Order.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/Other.php (renamed from tests/simple_unit/SqlMap/domain/Other.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/Sample.php (renamed from tests/simple_unit/SqlMap/domain/Sample.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/Search.php (renamed from tests/simple_unit/SqlMap/domain/Search.php)0
-rw-r--r--tests/unit/Data/SqlMap/domain/User.php (renamed from tests/simple_unit/SqlMap/domain/User.php)0
-rw-r--r--tests/unit/Data/SqlMap/gen.php (renamed from tests/simple_unit/SqlMap/gen.php)0
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/Account.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/Account.xml)1246
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/ActiveRecord.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/ActiveRecord.xml)0
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/Category.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/Category.xml)324
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/Complex.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/Complex.xml)46
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/Document.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/Document.xml)104
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/DynamicAccount.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/DynamicAccount.xml)896
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/Enumeration.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/Enumeration.xml)118
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/LineItem.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/LineItem.xml)374
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/Order.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/Order.xml)934
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/Other.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/Other.xml)340
-rw-r--r--tests/unit/Data/SqlMap/maps/MySql/ResultClass.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/ResultClass.xml)258
-rw-r--r--tests/unit/Data/SqlMap/maps/mssql/Account.xml (renamed from tests/simple_unit/SqlMap/maps/mssql/Account.xml)1210
-rw-r--r--tests/unit/Data/SqlMap/maps/mssql/Category.xml (renamed from tests/simple_unit/SqlMap/maps/mssql/Category.xml)342
-rw-r--r--tests/unit/Data/SqlMap/maps/mssql/Complex.xml (renamed from tests/simple_unit/SqlMap/maps/mssql/Complex.xml)42
-rw-r--r--tests/unit/Data/SqlMap/maps/mssql/Document.xml (renamed from tests/simple_unit/SqlMap/maps/mssql/Document.xml)104
-rw-r--r--tests/unit/Data/SqlMap/maps/mssql/DynamicAccount.xml (renamed from tests/simple_unit/SqlMap/maps/mssql/DynamicAccount.xml)874
-rw-r--r--tests/unit/Data/SqlMap/maps/mssql/Enumeration.xml (renamed from tests/simple_unit/SqlMap/maps/mssql/Enumeration.xml)94
-rw-r--r--tests/unit/Data/SqlMap/maps/mssql/LineItem.xml (renamed from tests/simple_unit/SqlMap/maps/mssql/LineItem.xml)362
-rw-r--r--tests/unit/Data/SqlMap/maps/mssql/Order.xml (renamed from tests/simple_unit/SqlMap/maps/mssql/Order.xml)948
-rw-r--r--tests/unit/Data/SqlMap/maps/mssql/Other.xml (renamed from tests/simple_unit/SqlMap/maps/mssql/Other.xml)342
-rw-r--r--tests/unit/Data/SqlMap/maps/mssql/ResultClass.xml (renamed from tests/simple_unit/SqlMap/maps/mssql/ResultClass.xml)248
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/Account.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/Account.xml)1280
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/ActiveRecord.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/ActiveRecord.xml)30
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/Category.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/Category.xml)324
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/Complex.xml (renamed from tests/simple_unit/SqlMap/maps/MySql/Complex.xml)46
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/Document.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/Document.xml)104
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/DynamicAccount.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/DynamicAccount.xml)892
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/Enumeration.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/Enumeration.xml)110
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/LineItem.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/LineItem.xml)364
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/Order.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/Order.xml)1004
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/Other.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/Other.xml)340
-rw-r--r--tests/unit/Data/SqlMap/maps/sqlite/ResultClass.xml (renamed from tests/simple_unit/SqlMap/maps/sqlite/ResultClass.xml)258
-rw-r--r--tests/unit/Data/SqlMap/maps/tests.xml (renamed from tests/simple_unit/SqlMap/maps/tests.xml)36
-rw-r--r--tests/unit/Data/SqlMap/mssql.xml (renamed from tests/simple_unit/SqlMap/mssql.xml)64
-rw-r--r--tests/unit/Data/SqlMap/mysql.xml (renamed from tests/simple_unit/SqlMap/mysql.xml)56
-rw-r--r--tests/unit/Data/SqlMap/properties.config (renamed from tests/simple_unit/SqlMap/properties.config)16
-rw-r--r--tests/unit/Data/SqlMap/queryForListLimitTest.php (renamed from tests/simple_unit/SqlMap/queryForListLimitTest.php)2
-rw-r--r--tests/unit/Data/SqlMap/resources/data.db (renamed from tests/simple_unit/SqlMap/resources/data.db)bin5120 -> 5120 bytes
-rw-r--r--tests/unit/Data/SqlMap/resources/person.xml (renamed from tests/simple_unit/SqlMap/resources/person.xml)50
-rw-r--r--tests/unit/Data/SqlMap/resources/sqlmap.xml (renamed from tests/simple_unit/SqlMap/resources/sqlmap.xml)22
-rw-r--r--tests/unit/Data/SqlMap/resources/test.db (renamed from tests/simple_unit/SqlMap/resources/test.db)bin5120 -> 5120 bytes
-rw-r--r--tests/unit/Data/SqlMap/resources/tests.db (renamed from tests/simple_unit/SqlMap/resources/tests.db)0
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/DBCreation.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/DBCreation.sql)176
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/DataBase.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/DataBase.sql)356
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/README-embed-param.txt (renamed from tests/simple_unit/SqlMap/scripts/mssql/README-embed-param.txt)16
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/account-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/account-init.sql)94
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/account-procedure.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/account-procedure.sql)24
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/category-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/category-init.sql)34
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/category-procedure.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/category-procedure.sql)18
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/documents-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/documents-init.sql)68
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/embed-param-setup-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/embed-param-setup-init.sql)186
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/embed-param-test-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/embed-param-test-init.sql)62
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/enumeration-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/enumeration-init.sql)60
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/line-item-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/line-item-init.sql)106
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/more-account-records.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/more-account-records.sql)22
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/order-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/order-init.sql)108
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/other-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/other-init.sql)288
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/ps_SelectAccount.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/ps_SelectAccount.sql)18
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/swap-procedure.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/swap-procedure.sql)68
-rw-r--r--tests/unit/Data/SqlMap/scripts/mssql/user-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mssql/user-init.sql)34
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/DataBase.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/DataBase.sql)712
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/account-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/account-init.sql)12
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/account-procedure.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/account-procedure.sql)2
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/category-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/category-init.sql)2
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/category-procedure.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/category-procedure.sql)0
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/documents-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/documents-init.sql)16
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/enumeration-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/enumeration-init.sql)12
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/line-item-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/line-item-init.sql)48
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/more-account-records.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/more-account-records.sql)14
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/order-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/order-init.sql)30
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/other-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/other-init.sql)34
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/swap-procedure.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/swap-procedure.sql)0
-rw-r--r--tests/unit/Data/SqlMap/scripts/mysql/user-init.sql (renamed from tests/simple_unit/SqlMap/scripts/mysql/user-init.sql)4
-rw-r--r--tests/unit/Data/SqlMap/scripts/sqlite/database.sql (renamed from tests/simple_unit/SqlMap/scripts/sqlite/database.sql)484
-rw-r--r--tests/unit/Data/SqlMap/sqlite.xml (renamed from tests/simple_unit/SqlMap/sqlite.xml)60
-rw-r--r--tests/unit/Data/SqlMap/sqlite/backup.db (renamed from tests/simple_unit/SqlMap/sqlite/backup.db)bin24576 -> 24576 bytes
-rw-r--r--tests/unit/Data/SqlMap/sqlite/tests.db (renamed from tests/simple_unit/SqlMap/sqlite/tests.db)bin24576 -> 24576 bytes
-rw-r--r--tests/unit/Data/SqlMap/sqlmap.xml (renamed from tests/simple_unit/Tickets/sqlmap.xml)40
-rw-r--r--tests/unit/Data/TableGateway/BaseGatewayTest.php (renamed from tests/simple_unit/TableGateway/BaseGatewayTest.php)5
-rw-r--r--tests/unit/Data/TableGateway/CountTest.php (renamed from tests/simple_unit/TableGateway/CountTest.php)3
-rw-r--r--tests/unit/Data/TableGateway/MagicCallTest.php (renamed from tests/simple_unit/TableGateway/MagicCallTest.php)3
-rw-r--r--tests/unit/Data/TableGateway/TableGatewayDeleteByPkTest.php (renamed from tests/simple_unit/TableGateway/DeleteByPkTest.php)5
-rw-r--r--tests/unit/Data/TableGateway/TableGatewayPgsqlTest.php (renamed from tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php)3
-rw-r--r--tests/unit/Data/TableGateway/TableInfoGatewayTest.php (renamed from tests/simple_unit/TableGateway/TableInfoGatewayTest.php)3
-rw-r--r--tests/unit/Data/TableGateway/TestFindByPk.php (renamed from tests/simple_unit/TableGateway/TestFindByPk.php)3
-rw-r--r--tests/unit/I18N/MysqlMessageSourceTest.php (renamed from tests/simple_unit/I18N/MysqlMessageSourceTestCase.php)5
-rw-r--r--tests/unit/I18N/core/AllTests.php34
-rw-r--r--tests/unit/IO/AllTests.php27
-rw-r--r--tests/unit/Security/AllTests.php33
-rw-r--r--tests/unit/Soap/ContactManager.php (renamed from tests/simple_unit/Soap/ContactManager.php)0
-rw-r--r--tests/unit/Soap/SoapTest.php (renamed from tests/simple_unit/Soap/SoapTestCase.php)5
-rw-r--r--tests/unit/Soap/mockapp/application.xml (renamed from tests/simple_unit/application.xml)16
-rw-r--r--tests/unit/Soap/mockapp/pages/.gitignore (renamed from tests/simple_unit/pages/.gitignore)0
-rwxr-xr-xtests/unit/Soap/mockapp/runtime/.gitignore (renamed from tests/simple_unit/runtime/.gitignore)0
-rw-r--r--tests/unit/Soap/mockapp/ws.php (renamed from tests/simple_unit/ws.php)0
-rw-r--r--tests/unit/Util/AllTests.php27
-rw-r--r--tests/unit/Web/AllTests.php45
-rw-r--r--tests/unit/Web/UI/ActiveControls/AllTests.php25
-rw-r--r--tests/unit/Web/UI/AllTests.php50
-rw-r--r--tests/unit/Web/UI/WebControls/AllTests.php32
-rw-r--r--tests/unit/Xml/AllTests.php29
244 files changed, 8976 insertions, 34107 deletions
diff --git a/tests/simple_unit/ActiveRecord/ActiveRecordRegistryTestCase.php b/tests/simple_unit/ActiveRecord/ActiveRecordRegistryTestCase.php
deleted file mode 100644
index 12b0796c..00000000
--- a/tests/simple_unit/ActiveRecord/ActiveRecordRegistryTestCase.php
+++ /dev/null
@@ -1,165 +0,0 @@
-<?php
-Prado::using('System.Data.ActiveRecord.TActiveRecordStateRegistry');
-Prado::using('System.Data.ActiveRecord.Exceptions.*');
-
-class StateTestObject
-{
- public $propA = 'a';
- public $propB;
-}
-
-class ActiveRecordRegistryTestCase extends UnitTestCase
-{
- function test_new_object()
- {
- $obj = new StateTestObject();
- $registry = new TActiveRecordStateRegistry();
-
- $this->assertTrue($registry->isNewObject($obj));
- $this->assertFalse($registry->isDirtyObject($obj));
- $this->assertFalse($registry->isRemovedObject($obj));
- $this->assertFalse($registry->isCleanObject($obj));
- }
-
- function test_clean_object_registers_without_error()
- {
- $obj = new StateTestObject();
- $registry = new TActiveRecordStateRegistry();
- $registry->registerClean($obj);
-
- $this->assertFalse($registry->isNewObject($obj));
- $this->assertFalse($registry->isDirtyObject($obj));
- $this->assertFalse($registry->isRemovedObject($obj));
- $this->assertTrue($registry->isCleanObject($obj));
- }
-
- function test_clean_object_becomes_dirty_when_changed()
- {
- $obj = new StateTestObject();
- $registry = new TActiveRecordStateRegistry();
-
- $registry->registerClean($obj);
-
- $obj->propB='b';
-
- $this->assertFalse($registry->isNewObject($obj));
- $this->assertTrue($registry->isDirtyObject($obj));
- $this->assertFalse($registry->isRemovedObject($obj));
- $this->assertFalse($registry->isCleanObject($obj));
- }
-
- function test_removed_object_must_register_as_clean_first()
- {
- $obj = new StateTestObject();
- $registry = new TActiveRecordStateRegistry();
-
- try
- {
- $registry->registerRemoved($obj);
- $this->fail();
- }
- catch(TActiveRecordException $e)
- {
- $this->pass();
- }
- }
-
- function test_removed_object_registers_without_error()
- {
- $obj = new StateTestObject();
- $registry = new TActiveRecordStateRegistry();
- $registry->registerClean($obj);
-
- $registry->registerRemoved($obj);
-
- $this->assertFalse($registry->isNewObject($obj));
- $this->assertFalse($registry->isDirtyObject($obj));
- $this->assertTrue($registry->isRemovedObject($obj));
- $this->assertFalse($registry->isCleanObject($obj));
- }
-
-
- function test_removed_object_can_not_become_clean()
- {
- $obj = new StateTestObject();
- $registry = new TActiveRecordStateRegistry();
- $registry->registerClean($obj);
-
- $registry->registerRemoved($obj);
-
- try
- {
- $registry->registerClean($obj);
- $this->fail();
- }
- catch(TActiveRecordException $e)
- {
- $this->pass();
- }
-
- $this->assertFalse($registry->isNewObject($obj));
- $this->assertFalse($registry->isDirtyObject($obj));
- $this->assertTrue($registry->isRemovedObject($obj));
- $this->assertFalse($registry->isCleanObject($obj));
- }
-
- function test_remove_dirty_object()
- {
- $obj = new StateTestObject();
- $registry = new TActiveRecordStateRegistry();
-
- $registry->registerClean($obj);
-
- $obj->propB='b';
-
- $this->assertFalse($registry->isNewObject($obj));
- $this->assertTrue($registry->isDirtyObject($obj));
- $this->assertFalse($registry->isRemovedObject($obj));
- $this->assertFalse($registry->isCleanObject($obj));
-
- $registry->registerRemoved($obj);
-
- $this->assertFalse($registry->isNewObject($obj));
- $this->assertFalse($registry->isDirtyObject($obj));
- $this->assertTrue($registry->isRemovedObject($obj));
- $this->assertFalse($registry->isCleanObject($obj));
-
- try
- {
- $registry->registerClean($obj);
- $this->fail();
- }
- catch(TActiveRecordException $e)
- {
- $this->pass();
- }
- }
-
- function test_clean_dirty_clean_object()
- {
- $obj = new StateTestObject();
- $registry = new TActiveRecordStateRegistry();
-
- $registry->registerClean($obj);
-
- $this->assertFalse($registry->isNewObject($obj));
- $this->assertFalse($registry->isDirtyObject($obj));
- $this->assertFalse($registry->isRemovedObject($obj));
- $this->assertTrue($registry->isCleanObject($obj));
-
- $obj->propB='b';
-
- $this->assertFalse($registry->isNewObject($obj));
- $this->assertTrue($registry->isDirtyObject($obj));
- $this->assertFalse($registry->isRemovedObject($obj));
- $this->assertFalse($registry->isCleanObject($obj));
-
- $registry->registerClean($obj);
-
- $this->assertFalse($registry->isNewObject($obj));
- $this->assertFalse($registry->isDirtyObject($obj));
- $this->assertFalse($registry->isRemovedObject($obj));
- $this->assertTrue($registry->isCleanObject($obj));
- }
-
-}
diff --git a/tests/simple_unit/SqlMap/Dynamic/DynamicTest.php b/tests/simple_unit/SqlMap/Dynamic/DynamicTest.php
deleted file mode 100644
index be7a1820..00000000
--- a/tests/simple_unit/SqlMap/Dynamic/DynamicTest.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-class DynamicTest extends UnitTestCase
-{
- function testConditional()
- {
-
- }
-}
diff --git a/tests/simple_unit/unit.php b/tests/simple_unit/unit.php
deleted file mode 100644
index b0e7874d..00000000
--- a/tests/simple_unit/unit.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-include_once '../test_tools/unit_tests.php';
-$test_cases = dirname(__FILE__)."/";
-
-$tester = new PradoUnitTester($test_cases);
-$tester->run(new HtmlReporter());
diff --git a/tests/test_tools/simpletest/CHANGELOG b/tests/test_tools/simpletest/CHANGELOG
deleted file mode 100755
index a7f890c5..00000000
--- a/tests/test_tools/simpletest/CHANGELOG
+++ /dev/null
@@ -1,6 +0,0 @@
-June 7, 2005, by Qiang Xue (qiang.xue@gmail.com)
-------------------------------------------------
-- changed all class memeber declarations from 'var $varname' to 'private $varname'.
-- removed all reference usages, including creating new objects, returning and passing objects.
-- modified expectation.php line 106 from 'function test($compare, $nasty=false) {' to 'function test($compare) {'.
-- added HtmlReporterWithCoverage.php \ No newline at end of file
diff --git a/tests/test_tools/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE b/tests/test_tools/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE
deleted file mode 100755
index 4be59649..00000000
--- a/tests/test_tools/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE
+++ /dev/null
@@ -1,312 +0,0 @@
-Simple Test interface changes
-=============================
-Because the SimpleTest tool set is still evolving it is likely that tests
-written with earlier versions will fail with the newest ones. The most
-dramatic changes are in the alpha releases. Here is a list of possible
-problems and their fixes...
-
-Failure to connect now emits failures
--------------------------------------
-It used to be that you would have to use the
-getTransferError() call on the web tester to see if
-there was a socket level error in a fetch. This check
-is now always carried out by the WebTestCase unless
-the fetch is prefaced with WebTestCase::ignoreErrors().
-The ignore directive only lasts for test case fetching
-action such as get() and click().
-
-No method SimpleTestOptions::ignore()
--------------------------------------
-This is deprecated in version 1.0.1beta and has been moved
-to SimpleTest::ignore() as that is more readable. In
-addition, parent classes are also ignored automatically.
-If you are using PHP5 you can skip this directive simply
-by marking your test case as abstract.
-
-No method assertCopy()
-----------------------
-This is deprecated in 1.0.1 in favour of assertClone().
-The assertClone() method is slightly different in that
-the objects must be identical, but without being a
-reference. It is thus not a strict inversion of
-assertReference().
-
-Constructor wildcard override has no effect in mocks
-----------------------------------------------------
-As of 1.0.1beta this is now set with setWildcard() instead
-of in the constructor.
-
-No methods setStubBaseClass()/getStubBaseClass()
-------------------------------------------------
-As mocks are now used instead of stubs, these methods
-stopped working and are now removed as of the 1.0.1beta
-release. The mock objects may be freely used instead.
-
-No method addPartialMockCode()
-------------------------------
-The ability to insert arbitrary partial mock code
-has been removed. This was a low value feature
-causing needless complications.It was removed
-in the 1.0.1beta release.
-
-No method setMockBaseClass()
-----------------------------
-The ability to change the mock base class has been
-scheduled for removal and is deprecated since the
-1.0.1beta version. This was a rarely used feature
-except as a workaround for PHP5 limitations. As
-these limitations are being resolved it's hoped
-that the bundled mocks can be used directly.
-
-No class Stub
--------------
-Server stubs are deprecated from 1.0.1 as the mocks now
-have exactly the same interface. Just use mock objects
-instead.
-
-No class SimpleTestOptions
---------------------------
-This was replced by the shorter SimpleTest in 1.0.1beta1
-and is since deprecated.
-
-No file simple_test.php
------------------------
-This was renamed test_case.php in 1.0.1beta to more accurately
-reflect it's purpose. This file should never be directly
-included in test suites though, as it's part of the
-underlying mechanics and has a tendency to be refactored.
-
-No class WantedPatternExpectation
----------------------------------
-This was deprecated in 1.0.1alpha in favour of the simpler
-name PatternExpectation.
-
-No class NoUnwantedPatternExpectation
--------------------------------------
-This was deprecated in 1.0.1alpha in favour of the simpler
-name NoPatternExpectation.
-
-No method assertNoUnwantedPattern()
------------------------------------
-This has been renamed to assertNoPattern() in 1.0.1alpha and
-the old form is deprecated.
-
-No method assertWantedPattern()
--------------------------------
-This has been renamed to assertPattern() in 1.0.1alpha and
-the old form is deprecated.
-
-No method assertExpectation()
------------------------------
-This was renamed as assert() in 1.0.1alpha and the old form
-has been deprecated.
-
-No class WildcardExpectation
-----------------------------
-This was a mostly internal class for the mock objects. It was
-renamed AnythingExpectation to bring it closer to JMock and
-NMock in version 1.0.1alpha.
-
-Missing UnitTestCase::assertErrorPattern()
-------------------------------------------
-This method is deprecated for version 1.0.1 onwards.
-This method has been subsumed by assertError() that can now
-take an expectation. Simply pass a PatternExpectation
-into assertError() to simulate the old behaviour.
-
-No HTML when matching page elements
------------------------------------
-This behaviour has been switched to using plain text as if it
-were seen by the user of the browser. This means that HTML tags
-are suppressed, entities are converted and whitespace is
-normalised. This should make it easier to match items in forms.
-Also images are replaced with their "alt" text so that they
-can be matched as well.
-
-No method SimpleRunner::_getTestCase()
---------------------------------------
-This was made public as getTestCase() in 1.0RC2.
-
-No method restartSession()
---------------------------
-This was renamed to restart() in the WebTestCase, SimpleBrowser
-and the underlying SimpleUserAgent in 1.0RC2. Because it was
-undocumented anyway, no attempt was made at backward
-compatibility.
-
-My custom test case ignored by tally()
---------------------------------------
-The _assertTrue method has had it's signature changed due to a bug
-in the PHP 5.0.1 release. You must now use getTest() from within
-that method to get the test case. Mock compatibility with other
-unit testers is now deprecated as of 1.0.1alpha as PEAR::PHUnit2
-should soon have mock support of it's own.
-
-Broken code extending SimpleRunner
-----------------------------------
-This was replaced with SimpleScorer so that I could use the runner
-name in another class. This happened in RC1 development and there
-is no easy backward compatibility fix. The solution is simply to
-extend SimpleScorer instead.
-
-Missing method getBaseCookieValue()
------------------------------------
-This was renamed getCurrentCookieValue() in RC1.
-
-Missing files from the SimpleTest suite
----------------------------------------
-Versions of SimpleTest prior to Beta6 required a SIMPLE_TEST constant
-to point at the SimpleTest folder location before any of the toolset
-was loaded. This is no longer documented as it is now unnecessary
-for later versions. If you are using an earlier version you may
-need this constant. Consult the documentation that was bundled with
-the release that you are using or upgrade to Beta6 or later.
-
-No method SimpleBrowser::getCurrentUrl()
---------------------------------------
-This is replaced with the more versatile showRequest() for
-debugging. It only existed in this context for version Beta5.
-Later versions will have SimpleBrowser::getHistory() for tracking
-paths through pages. It is renamed as getUrl() since 1.0RC1.
-
-No method Stub::setStubBaseClass()
-----------------------------------
-This method has finally been removed in 1.0RC1. Use
-SimpleTestOptions::setStubBaseClass() instead.
-
-No class CommandLineReporter
-----------------------------
-This was renamed to TextReporter in Beta3 and the deprecated version
-was removed in 1.0RC1.
-
-No method requireReturn()
--------------------------
-This was deprecated in Beta3 and is now removed.
-
-No method expectCookie()
-------------------------
-This method was abruptly removed in Beta4 so as to simplify the internals
-until another mechanism can replace it. As a workaround it is necessary
-to assert that the cookie has changed by setting it before the page
-fetch and then assert the desired value.
-
-No method clickSubmitByFormId()
--------------------------------
-This method had an incorrect name as no button was involved. It was
-renamed to submitByFormId() in Beta4 and the old version deprecated.
-Now removed.
-
-No method paintStart() or paintEnd()
-------------------------------------
-You should only get this error if you have subclassed the lower level
-reporting and test runner machinery. These methods have been broken
-down into events for test methods, events for test cases and events
-for group tests. The new methods are...
-
-paintStart() --> paintMethodStart(), paintCaseStart(), paintGroupStart()
-paintEnd() --> paintMethodEnd(), paintCaseEnd(), paintGroupEnd()
-
-This change was made in Beta3, ironically to make it easier to subclass
-the inner machinery. Simply duplicating the code you had in the previous
-methods should provide a temporary fix.
-
-No class TestDisplay
---------------------
-This has been folded into SimpleReporter in Beta3 and is now deprecated.
-It was removed in RC1.
-
-No method WebTestCase::fetch()
-------------------------------
-This was renamed get() in Alpha8. It is removed in Beta3.
-
-No method submit()
-------------------
-This has been renamed clickSubmit() in Beta1. The old method was
-removed in Beta2.
-
-No method clearHistory()
-------------------------
-This method is deprecated in Beta2 and removed in RC1.
-
-No method getCallCount()
-------------------------
-This method has been deprecated since Beta1 and has now been
-removed. There are now more ways to set expectations on counts
-and so this method should be unecessery. Removed in RC1.
-
-Cannot find file *
-------------------
-The following public name changes have occoured...
-
-simple_html_test.php --> reporter.php
-simple_mock.php --> mock_objects.php
-simple_unit.php --> unit_tester.php
-simple_web.php --> web_tester.php
-
-The old names were deprecated in Alpha8 and removed in Beta1.
-
-No method attachObserver()
---------------------------
-Prior to the Alpha8 release the old internal observer pattern was
-gutted and replaced with a visitor. This is to trade flexibility of
-test case expansion against the ease of writing user interfaces.
-
-Code such as...
-
-$test = new MyTestCase();
-$test->attachObserver(new TestHtmlDisplay());
-$test->run();
-
-...should be rewritten as...
-
-$test = new MyTestCase();
-$test->run(new HtmlReporter());
-
-If you previously attached multiple observers then the workaround
-is to run the tests twice, once with each, until they can be combined.
-For one observer the old method is simulated in Alpha 8, but is
-removed in Beta1.
-
-No class TestHtmlDisplay
-------------------------
-This class has been renamed to HtmlReporter in Alpha8. It is supported,
-but deprecated in Beta1 and removed in Beta2. If you have subclassed
-the display for your own design, then you will have to extend this
-class (HtmlReporter) instead.
-
-If you have accessed the event queue by overriding the notify() method
-then I am afraid you are in big trouble :(. The reporter is now
-carried around the test suite by the runner classes and the methods
-called directly. In the unlikely event that this is a problem and
-you don't want to upgrade the test tool then simplest is to write your
-own runner class and invoke the tests with...
-
-$test->accept(new MyRunner(new MyReporter()));
-
-...rather than the run method. This should be easier to extend
-anyway and gives much more control. Even this method is overhauled
-in Beta3 where the runner class can be set within the test case. Really
-the best thing to do is to upgrade to this version as whatever you were
-trying to achieve before should now be very much easier.
-
-Missing set options method
---------------------------
-All test suite options are now in one class called SimpleTestOptions.
-This means that options are set differently...
-
-GroupTest::ignore() --> SimpleTestOptions::ignore()
-Mock::setMockBaseClass() --> SimpleTestOptions::setMockBaseClass()
-
-These changed in Alpha8 and the old versions are now removed in RC1.
-
-No method setExpected*()
-------------------------
-The mock expectations changed their names in Alpha4 and the old names
-ceased to be supported in Alpha8. The changes are...
-
-setExpectedArguments() --> expectArguments()
-setExpectedArgumentsSequence() --> expectArgumentsAt()
-setExpectedCallCount() --> expectCallCount()
-setMaximumCallCount() --> expectMaximumCallCount()
-
-The parameters remained the same.
diff --git a/tests/test_tools/simpletest/HtmlReporterWithCoverage.php b/tests/test_tools/simpletest/HtmlReporterWithCoverage.php
deleted file mode 100644
index f3ae2391..00000000
--- a/tests/test_tools/simpletest/HtmlReporterWithCoverage.php
+++ /dev/null
@@ -1,267 +0,0 @@
-<?php
-
-if (!defined('T_ML_COMMENT'))
- define('T_ML_COMMENT', T_COMMENT);
-else
- define('T_DOC_COMMENT', T_ML_COMMENT);
-
-class HtmlReporterWithCoverage extends HtmlReporter
-{
- protected $coverage = array();
-
- protected $painter;
-
- protected $base_dir;
-
- function __construct($painter = 'index.php', $base_dir)
- {
- $this->painter = $painter;
- $this->base_dir = $base_dir;
- }
-
- function paintHeader($test_name, $charset="UTF-8")
- {
- $this->sendNoCacheHeaders();
- header('Content-Type: text/html; Charset='.$charset);
- print "<html>\n<head>\n<title>$test_name</title>\n";
- print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$charset}\"/>";
- print "<style type=\"text/css\">\n";
- print $this->_getCss() . "\n";
- print "</style>\n";
- print "</head>\n<body>\n";
- print "<h1>$test_name</h1>\n";
- flush();
-
- if (extension_loaded('xdebug'))
- xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
-
- }
-
- /**
- *
- */
- function _getCss()
- {
- $contents = parent::_getCss()."\n ";
- $contents .= '
- .bar { float: left; display: inline; border: 1px solid #eee; width: 300px; white-space: nowrap;}
- .percentage { float: left; background-color: #eef; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 0.65em; padding: 5px; margin-right: }
- .coverage {margin: 0.4em; }
- .coverage a {
- padding-left: 0.5em;
- }
- .coverage:after {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
- }
- .coverage {display: inline-block;}
- /* Hides from IE-mac \*/
- * html .coverage {height: 1%;}
- .coverage {display: block;}
- /* End hide from IE-mac */
- ';
- Return $contents;
- }
-
- function paintFooter($test_name)
- {
- if (extension_loaded('xdebug'))
- {
- $this->coverage = xdebug_get_code_coverage();
- xdebug_stop_code_coverage();
- }
-
- $colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green");
- print "<div style=\"";
- print "padding: 8px; margin-top: 1em; background-color: $colour; color: white;";
- print "\">";
- print $this->getTestCaseProgress() . "/" . $this->getTestCaseCount();
- print " test cases complete:\n";
- print "<strong>" . $this->getPassCount() . "</strong> passes, ";
- print "<strong>" . $this->getFailCount() . "</strong> fails and ";
- print "<strong>" . $this->getExceptionCount() . "</strong> exceptions.";
- print "</div>\n";
- $this->paintCoverage();
- print "</body>\n</html>\n";
- }
-
- function paintCoverage()
- {
- $dir = dirname(__FILE__);
- if(count($this->coverage) > 0)
- print '<h2>Code Coverage</h2>';
-
-
- ksort($this->coverage);
-
- $details = array();
- foreach($this->coverage as $file => $coverage)
- {
- if(is_int(strpos($file, $dir)) == false
- && is_int(strpos($file, 'simpletest')) == false
- && is_int(strpos($file, $this->base_dir)))
- {
- $total = HTMLCoverageReport::codelines($file);
- $executed = count($coverage);
- $percentage = sprintf('%01d',$executed/$total*100);
- $width = $percentage * 3;
- $filename = str_replace($this->base_dir, '',$file);
- $link = $this->constructURL($filename, $coverage);
-
- $detail['total'] = $total;
- $detail['executed'] = $executed;
- $detail['width'] = $width;
- $detail['filename'] = $filename;
- $detail['link'] = $link;
- $details[$percentage][] = $detail;
- }
- }
- krsort($details);
- foreach($details as $percentage => $files)
- {
- foreach($files as $detail)
- {
- $total = $detail['total'];
- $executed = $detail['executed'];
- $width = $detail['width'];
- $filename = $detail['filename'];
- $link = $detail['link'];
-
- print "<div class=\"coverage\">";
- print "<span class=\"bar\">";
- print "<span class=\"percentage\" style=\"width:{$width}px\">";
- print "$executed/$total\n";
- print "$percentage%</span></span>\n";
- print "<a href=\"{$link}\">{$filename}</a>\n";
- print "</div>\n";
- }
- }
- }
-
- function constructURL($file, $coverage)
- {
- $file = rawurlencode($file);
- $lines = implode(',', array_keys($coverage));
- return $this->painter.'?file='.$file.'&amp;lines='.$lines;
- }
-}
-
-
-class HTMLCoverageReport extends HtmlReporter
-{
- protected $file;
- protected $lines;
- protected $name;
-
- function __construct($file, $name, $lines)
- {
- $this->file = $file;
- $this->lines = $lines;
- $this->name = $name;
- }
-
- function show()
- {
- $this->paintHeader($this->name);
-
- $contents = file($this->file);
- foreach($contents as $count => $line)
- {
- $num = ($count+1);
- $line = preg_replace("/\\n|\\r/",'',$line);
- $line = htmlspecialchars($line);
- $line = str_replace(' ','&nbsp;',$line);
- $line = str_replace("\t",'&nbsp;&nbsp;&nbsp;&nbsp;',$line);
- if(in_array($count+1, $this->lines))
- echo "<div class=\"highlight\"><tt>$num $line</tt></div>\n";
- else
- echo "<tt>$num $line</tt><br />\n";
- }
-
- $this->paintFooter();
- }
-
- function paintHeader($file, $charset="UTF-8")
- {
- $total = $this->codelines($this->file);
- $executed = count($this->lines);
- $percentage = sprintf('%01.2f',$executed/$total*100);
-
- $this->sendNoCacheHeaders();
- header('Content-Type: text/html Charset='.$charset);
- print "<html>\n<head>\n<title>Code Coverage: $file</title>\n";
- print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$charset}\"/>";
- print "<style type=\"text/css\">\n";
- print $this->_getCss() . "\n";
- print ".highlight { background-color: #eef; } \n";
- print ".filename { margin-bottom: 2em; } \n";
- print "</style>\n";
- print "</head>\n<body>\n";
- print "<h1>Code Coverage</h1>\n";
- print "<div class=\"filename\"><strong>$file</strong></div>";
- print "<div class=\"filename\"><tt>&nbsp;&nbsp;&nbsp;&nbsp;Total code lines: {$total} <br /> Total lines executed: {$executed} ({$percentage}%)</tt></div>";
- flush();
- }
-
- function paintFooter($test_name)
- {
- print "</body>\n</html>\n";
- }
-
- static function codelines($file)
- {
- $source = file_get_contents($file);
- $tokens = @token_get_all($source);
-
- $lines = '';
-
- foreach ($tokens as $token)
- {
- if (is_string($token))
- {
- // simple 1-character token
- $lines .= $token;
- }
- else
- {
- // token array
- list($id, $text) = $token;
-
- switch ($id)
- {
- case T_COMMENT:
- case T_ML_COMMENT: // we've defined this
- case T_DOC_COMMENT: // and this
- // no action on comments
- break;
-
- default:
- // anything else -> output "as is"
- //echo $text;
- $lines .= $text;
- break;
- }
- }
- }
-
- $lines = preg_replace('/\\n\s*$/m',"",$lines);
- $codelines = explode("\n",$lines);
- $count = 0;
- $patterns[] = '^\s*{\s*$';
- $patterns[] = '<\?';
- $patterns[] = '^\s*(private|protected|public)\s+\$';
- $pattern = '/'.implode('|', $patterns).'/';
- foreach($codelines as $line)
- {
- if(!preg_match($pattern, $line))
- $count++;
- }
- return $count;
- //var_dump($codelines);
- //return count($codelines);
- }
-}
-
diff --git a/tests/test_tools/simpletest/LICENSE b/tests/test_tools/simpletest/LICENSE
deleted file mode 100755
index 4a1f7201..00000000
--- a/tests/test_tools/simpletest/LICENSE
+++ /dev/null
@@ -1,502 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/tests/test_tools/simpletest/README b/tests/test_tools/simpletest/README
deleted file mode 100755
index c2ff9b75..00000000
--- a/tests/test_tools/simpletest/README
+++ /dev/null
@@ -1,108 +0,0 @@
-SimpleTest
-==========
-You probably got this package from...
-http://sourceforge.net/projects/simpletest/
-
-If there is no licence agreement with this package please download
-a version from the location above. You must read and accept that
-licence to use this software. The file is titled simply LICENSE.
-
-What is it? It's a framework for unit testing, web site testing and
-mock objects for PHP 4.2.0+.
-
-If you have used JUnit you will find this PHP unit testing version very
-similar. Also included is a mock objects and server stubs generator.
-The stubs can have return values set for different arguments, can have
-sequences set also by arguments and can return items by reference.
-The mocks inherit all of this functionality and can also have
-expectations set, again in sequences and for different arguments.
-
-A web tester similar in concept to JWebUnit is also included. There is no
-JavaScript or tables support, but forms, authentication, cookies and
-frames are handled.
-
-You can see a release schedule at http://www.lastcraft.com/overview.php
-which is also copied to the documentation folder with this release.
-A full PHPDocumenter API documentation exists at
-http://simpletest.sourceforge.net/.
-
-The user interface is minimal
-in the extreme, but a lot of information flows from the test suite.
-After version 1.0 we will release a better web UI, but we are leaving XUL
-and GTk versions to volunteers as everybody has their own opinion
-on a good GUI, and we don't want to discourage development by shipping
-one with the toolkit.
-
-You are looking at a first full release. The unit tests for SimpleTest
-itself can be run here...
-
-simpletest/test/unit_tests.php
-
-And tests involving live network connections as well are here...
-
-simpletest/test/all_tests.php
-
-The full tests will typically overrun the 8Mb limit usually allowed
-to a PHP process. A workaround is to run the tests on the command
-with a custom php.ini file if you do not have access to your server
-version.
-
-You will have to edit the all_tests.php file if you are accesssing
-the internet through a proxy server. See the comments in all_tests.php
-for instructions.
-
-The full tests read some test data from the LastCraft site. If the site
-is down or has been modified for a later version then you will get
-spurious errors. A unit_tests.php failure on the other hand would be
-very serious. As far as we know we haven't yet managed to check in any
-unit test failures so please correct us if you find one.
-
-Even if all of the tests run please verify that your existing test suites
-also function as expected. If they don't see the file...
-
-HELP_MY_TESTS_DONT_WORK_ANYMORE
-
-This contains information on interface changes. It also points out
-deprecated interfaces so you should read this even if all of
-your current tests appear to run.
-
-There is a documentation folder which contains the core reference information
-in English and French, although this information is fairly basic.
-You can find a tutorial on...
-
-http://www.lastcraft.com/first_test_tutorial.php
-
-...to get you started and this material will eventually become included
-with the project documentation. A French translation exists at...
-
-http://www.onpk.net/index.php/2005/01/12/254-tutoriel-simpletest-decouvrir-les-tests-unitaires.
-
-If you download and use and possibly even extend this tool, please let us
-know. Any feedback, even bad, is always welcome and we will work to get
-your suggestions into the next release. Ideally please send your
-comments to...
-
-simpletest-support@lists.sourceforge.net
-
-...so that others can read them too. We usually try to respond within 48
-hours.
-
-There is no change log as yet except at Sourceforge. You can visit the
-release notes to see the completed TODO list after each cycle and also the
-status of any bugs, but if the bug is recent then it will be fixed in CVS only.
-The CVS check-ins always have all the tests passing and so CVS snapshots should
-be pretty usable, although the code may not look so good internally.
-
-Oh, yes. It is called "Simple" because it should be simple to
-use. We intend to add a complete set of tools for a test first
-and "test as you code" type of development. "Simple" does not
-mean "Lite" in this context.
-
-Thanks to everyone who has sent comments and offered suggestions. They
-really are invaluable, but sadly you are too many to mention in full.
-Thanks to all on the advanced PHP forum on SitePoint, especially Harry
-Feucks. Early adopters are always an inspiration.
-
-yours Marcus Baker, Jason Sweat, Travis Swicegood and Perrick Penet.
---
-marcus@lastcraft.com
diff --git a/tests/test_tools/simpletest/VERSION b/tests/test_tools/simpletest/VERSION
deleted file mode 100755
index 9980c7df..00000000
--- a/tests/test_tools/simpletest/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-1.0.1alpha3 \ No newline at end of file
diff --git a/tests/test_tools/simpletest/authentication.php b/tests/test_tools/simpletest/authentication.php
deleted file mode 100644
index 86b68402..00000000
--- a/tests/test_tools/simpletest/authentication.php
+++ /dev/null
@@ -1,237 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: authentication.php 1532 2006-12-01 12:28:55Z xue $
- */
- /**
- * include http class
- */
- require_once(dirname(__FILE__) . '/http.php');
-
- /**
- * Represents a single security realm's identity.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleRealm {
- protected $_type;
- protected $_root;
- protected $_username;
- protected $_password;
-
- /**
- * Starts with the initial entry directory.
- * @param string $type Authentication type for this
- * realm. Only Basic authentication
- * is currently supported.
- * @param SimpleUrl $url Somewhere in realm.
- * @access public
- */
- function SimpleRealm($type, $url) {
- $this->_type = $type;
- $this->_root = $url->getBasePath();
- $this->_username = false;
- $this->_password = false;
- }
-
- /**
- * Adds another location to the realm.
- * @param SimpleUrl $url Somewhere in realm.
- * @access public
- */
- function stretch($url) {
- $this->_root = $this->_getCommonPath($this->_root, $url->getPath());
- }
-
- /**
- * Finds the common starting path.
- * @param string $first Path to compare.
- * @param string $second Path to compare.
- * @return string Common directories.
- * @access private
- */
- function _getCommonPath($first, $second) {
- $first = explode('/', $first);
- $second = explode('/', $second);
- for ($i = 0; $i < min(count($first), count($second)); $i++) {
- if ($first[$i] != $second[$i]) {
- return implode('/', array_slice($first, 0, $i)) . '/';
- }
- }
- return implode('/', $first) . '/';
- }
-
- /**
- * Sets the identity to try within this realm.
- * @param string $username Username in authentication dialog.
- * @param string $username Password in authentication dialog.
- * @access public
- */
- function setIdentity($username, $password) {
- $this->_username = $username;
- $this->_password = $password;
- }
-
- /**
- * Accessor for current identity.
- * @return string Last succesful username.
- * @access public
- */
- function getUsername() {
- return $this->_username;
- }
-
- /**
- * Accessor for current identity.
- * @return string Last succesful password.
- * @access public
- */
- function getPassword() {
- return $this->_password;
- }
-
- /**
- * Test to see if the URL is within the directory
- * tree of the realm.
- * @param SimpleUrl $url URL to test.
- * @return boolean True if subpath.
- * @access public
- */
- function isWithin($url) {
- if ($this->_isIn($this->_root, $url->getBasePath())) {
- return true;
- }
- if ($this->_isIn($this->_root, $url->getBasePath() . $url->getPage() . '/')) {
- return true;
- }
- return false;
- }
-
- /**
- * Tests to see if one string is a substring of
- * another.
- * @param string $part Small bit.
- * @param string $whole Big bit.
- * @return boolean True if the small bit is
- * in the big bit.
- * @access private
- */
- function _isIn($part, $whole) {
- return strpos($whole, $part) === 0;
- }
- }
-
- /**
- * Manages security realms.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleAuthenticator {
- protected $_realms;
-
- /**
- * Clears the realms.
- * @access public
- */
- function SimpleAuthenticator() {
- $this->restartSession();
- }
-
- /**
- * Starts with no realms set up.
- * @access public
- */
- function restartSession() {
- $this->_realms = array();
- }
-
- /**
- * Adds a new realm centered the current URL.
- * Browsers vary wildly on their behaviour in this
- * regard. Mozilla ignores the realm and presents
- * only when challenged, wasting bandwidth. IE
- * just carries on presenting until a new challenge
- * occours. SimpleTest tries to follow the spirit of
- * the original standards committee and treats the
- * base URL as the root of a file tree shaped realm.
- * @param SimpleUrl $url Base of realm.
- * @param string $type Authentication type for this
- * realm. Only Basic authentication
- * is currently supported.
- * @param string $realm Name of realm.
- * @access public
- */
- function addRealm($url, $type, $realm) {
- $this->_realms[$url->getHost()][$realm] = new SimpleRealm($type, $url);
- }
-
- /**
- * Sets the current identity to be presented
- * against that realm.
- * @param string $host Server hosting realm.
- * @param string $realm Name of realm.
- * @param string $username Username for realm.
- * @param string $password Password for realm.
- * @access public
- */
- function setIdentityForRealm($host, $realm, $username, $password) {
- if (isset($this->_realms[$host][$realm])) {
- $this->_realms[$host][$realm]->setIdentity($username, $password);
- }
- }
-
- /**
- * Finds the name of the realm by comparing URLs.
- * @param SimpleUrl $url URL to test.
- * @return SimpleRealm Name of realm.
- * @access private
- */
- function _findRealmFromUrl($url) {
- if (! isset($this->_realms[$url->getHost()])) {
- return false;
- }
- foreach ($this->_realms[$url->getHost()] as $name => $realm) {
- if ($realm->isWithin($url)) {
- return $realm;
- }
- }
- return false;
- }
-
- /**
- * Presents the appropriate headers for this location.
- * @param SimpleHttpRequest $request Request to modify.
- * @param SimpleUrl $url Base of realm.
- * @access public
- */
- function addHeaders($request, $url) {
- if ($url->getUsername() && $url->getPassword()) {
- $username = $url->getUsername();
- $password = $url->getPassword();
- } elseif ($realm = $this->_findRealmFromUrl($url)) {
- $username = $realm->getUsername();
- $password = $realm->getPassword();
- } else {
- return;
- }
- $this->addBasicHeaders($request, $username, $password);
- }
-
- /**
- * Presents the appropriate headers for this
- * location for basic authentication.
- * @param SimpleHttpRequest $request Request to modify.
- * @param string $username Username for realm.
- * @param string $password Password for realm.
- * @access public
- * @static
- */
- static function addBasicHeaders($request, $username, $password) {
- if ($username && $password) {
- $request->addHeaderLine(
- 'Authorization: Basic ' . base64_encode("$username:$password"));
- }
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/browser.php b/tests/test_tools/simpletest/browser.php
deleted file mode 100644
index 410b18b9..00000000
--- a/tests/test_tools/simpletest/browser.php
+++ /dev/null
@@ -1,1056 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: browser.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/simpletest.php');
- require_once(dirname(__FILE__) . '/http.php');
- require_once(dirname(__FILE__) . '/encoding.php');
- require_once(dirname(__FILE__) . '/page.php');
- require_once(dirname(__FILE__) . '/selector.php');
- require_once(dirname(__FILE__) . '/frames.php');
- require_once(dirname(__FILE__) . '/user_agent.php');
- /**#@-*/
-
- if (!defined('DEFAULT_MAX_NESTED_FRAMES')) {
- define('DEFAULT_MAX_NESTED_FRAMES', 3);
- }
-
- /**
- * Browser history list.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleBrowserHistory {
- protected $_sequence;
- protected $_position;
-
- /**
- * Starts empty.
- * @access public
- */
- function SimpleBrowserHistory() {
- $this->_sequence = array();
- $this->_position = -1;
- }
-
- /**
- * Test for no entries yet.
- * @return boolean True if empty.
- * @access private
- */
- function _isEmpty() {
- return ($this->_position == -1);
- }
-
- /**
- * Test for being at the beginning.
- * @return boolean True if first.
- * @access private
- */
- function _atBeginning() {
- return ($this->_position == 0) && ! $this->_isEmpty();
- }
-
- /**
- * Test for being at the last entry.
- * @return boolean True if last.
- * @access private
- */
- function _atEnd() {
- return ($this->_position + 1 >= count($this->_sequence)) && ! $this->_isEmpty();
- }
-
- /**
- * Adds a successfully fetched page to the history.
- * @param SimpleUrl $url URL of fetch.
- * @param SimpleEncoding $parameters Any post data with the fetch.
- * @access public
- */
- function recordEntry($url, $parameters) {
- $this->_dropFuture();
- array_push(
- $this->_sequence,
- array('url' => $url, 'parameters' => $parameters));
- $this->_position++;
- }
-
- /**
- * Last fully qualified URL for current history
- * position.
- * @return SimpleUrl URL for this position.
- * @access public
- */
- function getUrl() {
- if ($this->_isEmpty()) {
- return false;
- }
- return $this->_sequence[$this->_position]['url'];
- }
-
- /**
- * Parameters of last fetch from current history
- * position.
- * @return SimpleFormEncoding Post parameters.
- * @access public
- */
- function getParameters() {
- if ($this->_isEmpty()) {
- return false;
- }
- return $this->_sequence[$this->_position]['parameters'];
- }
-
- /**
- * Step back one place in the history. Stops at
- * the first page.
- * @return boolean True if any previous entries.
- * @access public
- */
- function back() {
- if ($this->_isEmpty() || $this->_atBeginning()) {
- return false;
- }
- $this->_position--;
- return true;
- }
-
- /**
- * Step forward one place. If already at the
- * latest entry then nothing will happen.
- * @return boolean True if any future entries.
- * @access public
- */
- function forward() {
- if ($this->_isEmpty() || $this->_atEnd()) {
- return false;
- }
- $this->_position++;
- return true;
- }
-
- /**
- * Ditches all future entries beyond the current
- * point.
- * @access private
- */
- function _dropFuture() {
- if ($this->_isEmpty()) {
- return;
- }
- while (! $this->_atEnd()) {
- array_pop($this->_sequence);
- }
- }
- }
-
- /**
- * Simulated web browser. This is an aggregate of
- * the user agent, the HTML parsing, request history
- * and the last header set.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleBrowser {
- protected $_user_agent;
- protected $_page;
- protected $_history;
- protected $_ignore_frames;
- protected $_maximum_nested_frames;
-
- /**
- * Starts with a fresh browser with no
- * cookie or any other state information. The
- * exception is that a default proxy will be
- * set up if specified in the options.
- * @access public
- */
- function SimpleBrowser() {
- $this->_user_agent = $this->_createUserAgent();
- $this->_user_agent->useProxy(
- SimpleTest::getDefaultProxy(),
- SimpleTest::getDefaultProxyUsername(),
- SimpleTest::getDefaultProxyPassword());
- $this->_page = new SimplePage();
- $this->_history = $this->_createHistory();
- $this->_ignore_frames = false;
- $this->_maximum_nested_frames = DEFAULT_MAX_NESTED_FRAMES;
- }
-
- /**
- * Creates the underlying user agent.
- * @return SimpleFetcher Content fetcher.
- * @access protected
- */
- function &_createUserAgent() {
- $user_agent = new SimpleUserAgent();
- return $user_agent;
- }
-
- /**
- * Creates a new empty history list.
- * @return SimpleBrowserHistory New list.
- * @access protected
- */
- function &_createHistory() {
- $history = new SimpleBrowserHistory();
- return $history;
- }
-
- /**
- * Disables frames support. Frames will not be fetched
- * and the frameset page will be used instead.
- * @access public
- */
- function ignoreFrames() {
- $this->_ignore_frames = true;
- }
-
- /**
- * Enables frames support. Frames will be fetched from
- * now on.
- * @access public
- */
- function useFrames() {
- $this->_ignore_frames = false;
- }
-
- /**
- * Switches off cookie sending and recieving.
- * @access public
- */
- function ignoreCookies() {
- $this->_user_agent->ignoreCookies();
- }
-
- /**
- * Switches back on the cookie sending and recieving.
- * @access public
- */
- function useCookies() {
- $this->_user_agent->useCookies();
- }
-
- /**
- * Parses the raw content into a page. Will load further
- * frame pages unless frames are disabled.
- * @param SimpleHttpResponse $response Response from fetch.
- * @param integer $depth Nested frameset depth.
- * @return SimplePage Parsed HTML.
- * @access private
- */
- function &_parse($response, $depth = 0) {
- $page = $this->_buildPage($response);
- if ($this->_ignore_frames || ! $page->hasFrames() || ($depth > $this->_maximum_nested_frames)) {
- return $page;
- }
- $frameset = new SimpleFrameset($page);
- foreach ($page->getFrameset() as $key => $url) {
- $frame = $this->_fetch($url, new SimpleGetEncoding(), $depth + 1);
- $frameset->addFrame($frame, $key);
- }
- return $frameset;
- }
-
- /**
- * Assembles the parsing machinery and actually parses
- * a single page. Frees all of the builder memory and so
- * unjams the PHP memory management.
- * @param SimpleHttpResponse $response Response from fetch.
- * @return SimplePage Parsed top level page.
- * @access protected
- */
- function &_buildPage($response) {
- $builder = new SimplePageBuilder();
- $page = $builder->parse($response);
- $builder->free();
- unset($builder);
- return $page;
- }
-
- /**
- * Fetches a page. Jointly recursive with the _parse()
- * method as it descends a frameset.
- * @param string/SimpleUrl $url Target to fetch.
- * @param SimpleEncoding $encoding GET/POST parameters.
- * @param integer $depth Nested frameset depth protection.
- * @return SimplePage Parsed page.
- * @access private
- */
- function &_fetch($url, $encoding, $depth = 0) {
- $response = $this->_user_agent->fetchResponse($url, $encoding);
- if ($response->isError()) {
- $page = new SimplePage($response);
- } else {
- $page = $this->_parse($response, $depth);
- }
- return $page;
- }
-
- /**
- * Fetches a page or a single frame if that is the current
- * focus.
- * @param SimpleUrl $url Target to fetch.
- * @param SimpleEncoding $parameters GET/POST parameters.
- * @return string Raw content of page.
- * @access private
- */
- function _load($url, $parameters) {
- $frame = $url->getTarget();
- if (! $frame || ! $this->_page->hasFrames() || (strtolower($frame) == '_top')) {
- return $this->_loadPage($url, $parameters);
- }
- return $this->_loadFrame(array($frame), $url, $parameters);
- }
-
- /**
- * Fetches a page and makes it the current page/frame.
- * @param string/SimpleUrl $url Target to fetch as string.
- * @param SimplePostEncoding $parameters POST parameters.
- * @return string Raw content of page.
- * @access private
- */
- function _loadPage($url, $parameters) {
- $this->_page = $this->_fetch($url, $parameters);
- $this->_history->recordEntry(
- $this->_page->getUrl(),
- $this->_page->getRequestData());
- return $this->_page->getRaw();
- }
-
- /**
- * Fetches a frame into the existing frameset replacing the
- * original.
- * @param array $frames List of names to drill down.
- * @param string/SimpleUrl $url Target to fetch as string.
- * @param SimpleFormEncoding $parameters POST parameters.
- * @return string Raw content of page.
- * @access private
- */
- function _loadFrame($frames, $url, $parameters) {
- $page = $this->_fetch($url, $parameters);
- $this->_page->setFrame($frames, $page);
- }
-
- /**
- * Removes expired and temporary cookies as if
- * the browser was closed and re-opened.
- * @param string/integer $date Time when session restarted.
- * If omitted then all persistent
- * cookies are kept.
- * @access public
- */
- function restart($date = false) {
- $this->_user_agent->restart($date);
- }
-
- /**
- * Adds a header to every fetch.
- * @param string $header Header line to add to every
- * request until cleared.
- * @access public
- */
- function addHeader($header) {
- $this->_user_agent->addHeader($header);
- }
-
- /**
- * Ages the cookies by the specified time.
- * @param integer $interval Amount in seconds.
- * @access public
- */
- function ageCookies($interval) {
- $this->_user_agent->ageCookies($interval);
- }
-
- /**
- * Sets an additional cookie. If a cookie has
- * the same name and path it is replaced.
- * @param string $name Cookie key.
- * @param string $value Value of cookie.
- * @param string $host Host upon which the cookie is valid.
- * @param string $path Cookie path if not host wide.
- * @param string $expiry Expiry date.
- * @access public
- */
- function setCookie($name, $value, $host = false, $path = '/', $expiry = false) {
- $this->_user_agent->setCookie($name, $value, $host, $path, $expiry);
- }
-
- /**
- * Reads the most specific cookie value from the
- * browser cookies.
- * @param string $host Host to search.
- * @param string $path Applicable path.
- * @param string $name Name of cookie to read.
- * @return string False if not present, else the
- * value as a string.
- * @access public
- */
- function getCookieValue($host, $path, $name) {
- return $this->_user_agent->getCookieValue($host, $path, $name);
- }
-
- /**
- * Reads the current cookies for the current URL.
- * @param string $name Key of cookie to find.
- * @return string Null if there is no current URL, false
- * if the cookie is not set.
- * @access public
- */
- function getCurrentCookieValue($name) {
- return $this->_user_agent->getBaseCookieValue($name, $this->_page->getUrl());
- }
-
- /**
- * Sets the maximum number of redirects before
- * a page will be loaded anyway.
- * @param integer $max Most hops allowed.
- * @access public
- */
- function setMaximumRedirects($max) {
- $this->_user_agent->setMaximumRedirects($max);
- }
-
- /**
- * Sets the maximum number of nesting of framed pages
- * within a framed page to prevent loops.
- * @param integer $max Highest depth allowed.
- * @access public
- */
- function setMaximumNestedFrames($max) {
- $this->_maximum_nested_frames = $max;
- }
-
- /**
- * Sets the socket timeout for opening a connection.
- * @param integer $timeout Maximum time in seconds.
- * @access public
- */
- function setConnectionTimeout($timeout) {
- $this->_user_agent->setConnectionTimeout($timeout);
- }
-
- /**
- * Sets proxy to use on all requests for when
- * testing from behind a firewall. Set URL
- * to false to disable.
- * @param string $proxy Proxy URL.
- * @param string $username Proxy username for authentication.
- * @param string $password Proxy password for authentication.
- * @access public
- */
- function useProxy($proxy, $username = false, $password = false) {
- $this->_user_agent->useProxy($proxy, $username, $password);
- }
-
- /**
- * Fetches the page content with a HEAD request.
- * Will affect cookies, but will not change the base URL.
- * @param string/SimpleUrl $url Target to fetch as string.
- * @param hash/SimpleHeadEncoding $parameters Additional parameters for
- * HEAD request.
- * @return boolean True if successful.
- * @access public
- */
- function head($url, $parameters = false) {
- if (! is_object($url)) {
- $url = new SimpleUrl($url);
- }
- if ($this->getUrl()) {
- $url = $url->makeAbsolute($this->getUrl());
- }
- $response = $this->_user_agent->fetchResponse($url, new SimpleHeadEncoding($parameters));
- return ! $response->isError();
- }
-
- /**
- * Fetches the page content with a simple GET request.
- * @param string/SimpleUrl $url Target to fetch.
- * @param hash/SimpleFormEncoding $parameters Additional parameters for
- * GET request.
- * @return string Content of page or false.
- * @access public
- */
- function get($url, $parameters = false) {
- if (! is_object($url)) {
- $url = new SimpleUrl($url);
- }
- if ($this->getUrl()) {
- $url = $url->makeAbsolute($this->getUrl());
- }
- return $this->_load($url, new SimpleGetEncoding($parameters));
- }
-
- /**
- * Fetches the page content with a POST request.
- * @param string/SimpleUrl $url Target to fetch as string.
- * @param hash/SimpleFormEncoding $parameters POST parameters.
- * @return string Content of page.
- * @access public
- */
- function post($url, $parameters = false) {
- if (! is_object($url)) {
- $url = new SimpleUrl($url);
- }
- if ($this->getUrl()) {
- $url = $url->makeAbsolute($this->getUrl());
- }
- return $this->_load($url, new SimplePostEncoding($parameters));
- }
-
- /**
- * Equivalent to hitting the retry button on the
- * browser. Will attempt to repeat the page fetch. If
- * there is no history to repeat it will give false.
- * @return string/boolean Content if fetch succeeded
- * else false.
- * @access public
- */
- function retry() {
- $frames = $this->_page->getFrameFocus();
- if (count($frames) > 0) {
- $this->_loadFrame(
- $frames,
- $this->_page->getUrl(),
- $this->_page->getRequestData());
- return $this->_page->getRaw();
- }
- if ($url = $this->_history->getUrl()) {
- $this->_page = $this->_fetch($url, $this->_history->getParameters());
- return $this->_page->getRaw();
- }
- return false;
- }
-
- /**
- * Equivalent to hitting the back button on the
- * browser. The browser history is unchanged on
- * failure. The page content is refetched as there
- * is no concept of content caching in SimpleTest.
- * @return boolean True if history entry and
- * fetch succeeded
- * @access public
- */
- function back() {
- if (! $this->_history->back()) {
- return false;
- }
- $content = $this->retry();
- if (! $content) {
- $this->_history->forward();
- }
- return $content;
- }
-
- /**
- * Equivalent to hitting the forward button on the
- * browser. The browser history is unchanged on
- * failure. The page content is refetched as there
- * is no concept of content caching in SimpleTest.
- * @return boolean True if history entry and
- * fetch succeeded
- * @access public
- */
- function forward() {
- if (! $this->_history->forward()) {
- return false;
- }
- $content = $this->retry();
- if (! $content) {
- $this->_history->back();
- }
- return $content;
- }
-
- /**
- * Retries a request after setting the authentication
- * for the current realm.
- * @param string $username Username for realm.
- * @param string $password Password for realm.
- * @return boolean True if successful fetch. Note
- * that authentication may still have
- * failed.
- * @access public
- */
- function authenticate($username, $password) {
- if (! $this->_page->getRealm()) {
- return false;
- }
- $url = $this->_page->getUrl();
- if (! $url) {
- return false;
- }
- $this->_user_agent->setIdentity(
- $url->getHost(),
- $this->_page->getRealm(),
- $username,
- $password);
- return $this->retry();
- }
-
- /**
- * Accessor for a breakdown of the frameset.
- * @return array Hash tree of frames by name
- * or index if no name.
- * @access public
- */
- function getFrames() {
- return $this->_page->getFrames();
- }
-
- /**
- * Accessor for current frame focus. Will be
- * false if no frame has focus.
- * @return integer/string/boolean Label if any, otherwise
- * the position in the frameset
- * or false if none.
- * @access public
- */
- function getFrameFocus() {
- return $this->_page->getFrameFocus();
- }
-
- /**
- * Sets the focus by index. The integer index starts from 1.
- * @param integer $choice Chosen frame.
- * @return boolean True if frame exists.
- * @access public
- */
- function setFrameFocusByIndex($choice) {
- return $this->_page->setFrameFocusByIndex($choice);
- }
-
- /**
- * Sets the focus by name.
- * @param string $name Chosen frame.
- * @return boolean True if frame exists.
- * @access public
- */
- function setFrameFocus($name) {
- return $this->_page->setFrameFocus($name);
- }
-
- /**
- * Clears the frame focus. All frames will be searched
- * for content.
- * @access public
- */
- function clearFrameFocus() {
- return $this->_page->clearFrameFocus();
- }
-
- /**
- * Accessor for last error.
- * @return string Error from last response.
- * @access public
- */
- function getTransportError() {
- return $this->_page->getTransportError();
- }
-
- /**
- * Accessor for current MIME type.
- * @return string MIME type as string; e.g. 'text/html'
- * @access public
- */
- function getMimeType() {
- return $this->_page->getMimeType();
- }
-
- /**
- * Accessor for last response code.
- * @return integer Last HTTP response code received.
- * @access public
- */
- function getResponseCode() {
- return $this->_page->getResponseCode();
- }
-
- /**
- * Accessor for last Authentication type. Only valid
- * straight after a challenge (401).
- * @return string Description of challenge type.
- * @access public
- */
- function getAuthentication() {
- return $this->_page->getAuthentication();
- }
-
- /**
- * Accessor for last Authentication realm. Only valid
- * straight after a challenge (401).
- * @return string Name of security realm.
- * @access public
- */
- function getRealm() {
- return $this->_page->getRealm();
- }
-
- /**
- * Accessor for current URL of page or frame if
- * focused.
- * @return string Location of current page or frame as
- * a string.
- */
- function getUrl() {
- $url = $this->_page->getUrl();
- return $url ? $url->asString() : false;
- }
-
- /**
- * Accessor for raw bytes sent down the wire.
- * @return string Original text sent.
- * @access public
- */
- function getRequest() {
- return $this->_page->getRequest();
- }
-
- /**
- * Accessor for raw header information.
- * @return string Header block.
- * @access public
- */
- function getHeaders() {
- return $this->_page->getHeaders();
- }
-
- /**
- * Accessor for raw page information.
- * @return string Original text content of web page.
- * @access public
- */
- function getContent() {
- return $this->_page->getRaw();
- }
-
- /**
- * Accessor for plain text version of the page.
- * @return string Normalised text representation.
- * @access public
- */
- function getContentAsText() {
- return $this->_page->getText();
- }
-
- /**
- * Accessor for parsed title.
- * @return string Title or false if no title is present.
- * @access public
- */
- function getTitle() {
- return $this->_page->getTitle();
- }
-
- /**
- * Accessor for a list of all fixed links in current page.
- * @return array List of urls with scheme of
- * http or https and hostname.
- * @access public
- */
- function getAbsoluteUrls() {
- return $this->_page->getAbsoluteUrls();
- }
-
- /**
- * Accessor for a list of all relative links.
- * @return array List of urls without hostname.
- * @access public
- */
- function getRelativeUrls() {
- return $this->_page->getRelativeUrls();
- }
-
- /**
- * Sets all form fields with that name.
- * @param string $label Name or label of field in forms.
- * @param string $value New value of field.
- * @return boolean True if field exists, otherwise false.
- * @access public
- */
- function setField($label, $value) {
- return $this->_page->setField(new SimpleByLabelOrName($label), $value);
- }
-
- /**
- * Sets all form fields with that name. Will use label if
- * one is available (not yet implemented).
- * @param string $name Name of field in forms.
- * @param string $value New value of field.
- * @return boolean True if field exists, otherwise false.
- * @access public
- */
- function setFieldByName($name, $value) {
- return $this->_page->setField(new SimpleByName($name), $value);
- }
-
- /**
- * Sets all form fields with that id attribute.
- * @param string/integer $id Id of field in forms.
- * @param string $value New value of field.
- * @return boolean True if field exists, otherwise false.
- * @access public
- */
- function setFieldById($id, $value) {
- return $this->_page->setField(new SimpleById($id), $value);
- }
-
- /**
- * Accessor for a form element value within the page.
- * Finds the first match.
- * @param string $label Field label.
- * @return string/boolean A value if the field is
- * present, false if unchecked
- * and null if missing.
- * @access public
- */
- function getField($label) {
- return $this->_page->getField(new SimpleByLabelOrName($label));
- }
-
- /**
- * Accessor for a form element value within the page.
- * Finds the first match.
- * @param string $name Field name.
- * @return string/boolean A string if the field is
- * present, false if unchecked
- * and null if missing.
- * @access public
- */
- function getFieldByName($name) {
- return $this->_page->getField(new SimpleByName($name));
- }
-
- /**
- * Accessor for a form element value within the page.
- * @param string/integer $id Id of field in forms.
- * @return string/boolean A string if the field is
- * present, false if unchecked
- * and null if missing.
- * @access public
- */
- function getFieldById($id) {
- return $this->_page->getField(new SimpleById($id));
- }
-
- /**
- * Clicks the submit button by label. The owning
- * form will be submitted by this.
- * @param string $label Button label. An unlabeled
- * button can be triggered by 'Submit'.
- * @param hash $additional Additional form data.
- * @return string/boolean Page on success.
- * @access public
- */
- function clickSubmit($label = 'Submit', $additional = false) {
- if (! ($form = $this->_page->getFormBySubmit(new SimpleByLabel($label)))) {
- return false;
- }
- $success = $this->_load(
- $form->getAction(),
- $form->submitButton(new SimpleByLabel($label), $additional));
- return ($success ? $this->getContent() : $success);
- }
-
- /**
- * Clicks the submit button by name attribute. The owning
- * form will be submitted by this.
- * @param string $name Button name.
- * @param hash $additional Additional form data.
- * @return string/boolean Page on success.
- * @access public
- */
- function clickSubmitByName($name, $additional = false) {
- if (! ($form = $this->_page->getFormBySubmit(new SimpleByName($name)))) {
- return false;
- }
- $success = $this->_load(
- $form->getAction(),
- $form->submitButton(new SimpleByName($name), $additional));
- return ($success ? $this->getContent() : $success);
- }
-
- /**
- * Clicks the submit button by ID attribute of the button
- * itself. The owning form will be submitted by this.
- * @param string $id Button ID.
- * @param hash $additional Additional form data.
- * @return string/boolean Page on success.
- * @access public
- */
- function clickSubmitById($id, $additional = false) {
- if (! ($form = $this->_page->getFormBySubmit(new SimpleById($id)))) {
- return false;
- }
- $success = $this->_load(
- $form->getAction(),
- $form->submitButton(new SimpleById($id), $additional));
- return ($success ? $this->getContent() : $success);
- }
-
- /**
- * Clicks the submit image by some kind of label. Usually
- * the alt tag or the nearest equivalent. The owning
- * form will be submitted by this. Clicking outside of
- * the boundary of the coordinates will result in
- * a failure.
- * @param string $label ID attribute of button.
- * @param integer $x X-coordinate of imaginary click.
- * @param integer $y Y-coordinate of imaginary click.
- * @param hash $additional Additional form data.
- * @return string/boolean Page on success.
- * @access public
- */
- function clickImage($label, $x = 1, $y = 1, $additional = false) {
- if (! ($form = $this->_page->getFormByImage(new SimpleByLabel($label)))) {
- return false;
- }
- $success = $this->_load(
- $form->getAction(),
- $form->submitImage(new SimpleByLabel($label), $x, $y, $additional));
- return ($success ? $this->getContent() : $success);
- }
-
- /**
- * Clicks the submit image by the name. Usually
- * the alt tag or the nearest equivalent. The owning
- * form will be submitted by this. Clicking outside of
- * the boundary of the coordinates will result in
- * a failure.
- * @param string $name Name attribute of button.
- * @param integer $x X-coordinate of imaginary click.
- * @param integer $y Y-coordinate of imaginary click.
- * @param hash $additional Additional form data.
- * @return string/boolean Page on success.
- * @access public
- */
- function clickImageByName($name, $x = 1, $y = 1, $additional = false) {
- if (! ($form = $this->_page->getFormByImage(new SimpleByName($name)))) {
- return false;
- }
- $success = $this->_load(
- $form->getAction(),
- $form->submitImage(new SimpleByName($name), $x, $y, $additional));
- return ($success ? $this->getContent() : $success);
- }
-
- /**
- * Clicks the submit image by ID attribute. The owning
- * form will be submitted by this. Clicking outside of
- * the boundary of the coordinates will result in
- * a failure.
- * @param integer/string $id ID attribute of button.
- * @param integer $x X-coordinate of imaginary click.
- * @param integer $y Y-coordinate of imaginary click.
- * @param hash $additional Additional form data.
- * @return string/boolean Page on success.
- * @access public
- */
- function clickImageById($id, $x = 1, $y = 1, $additional = false) {
- if (! ($form = $this->_page->getFormByImage(new SimpleById($id)))) {
- return false;
- }
- $success = $this->_load(
- $form->getAction(),
- $form->submitImage(new SimpleById($id), $x, $y, $additional));
- return ($success ? $this->getContent() : $success);
- }
-
- /**
- * Submits a form by the ID.
- * @param string $id The form ID. No submit button value
- * will be sent.
- * @return string/boolean Page on success.
- * @access public
- */
- function submitFormById($id) {
- if (! ($form = $this->_page->getFormById($id))) {
- return false;
- }
- $success = $this->_load(
- $form->getAction(),
- $form->submit());
- return ($success ? $this->getContent() : $success);
- }
-
- /**
- * Follows a link by label. Will click the first link
- * found with this link text by default, or a later
- * one if an index is given. The match ignores case and
- * white space issues.
- * @param string $label Text between the anchor tags.
- * @param integer $index Link position counting from zero.
- * @return string/boolean Page on success.
- * @access public
- */
- function clickLink($label, $index = 0) {
- $urls = $this->_page->getUrlsByLabel($label);
- if (count($urls) == 0) {
- return false;
- }
- if (count($urls) < $index + 1) {
- return false;
- }
- $this->_load($urls[$index], new SimpleGetEncoding());
- return $this->getContent();
- }
-
- /**
- * Tests to see if a link is present by label.
- * @param string $label Text of value attribute.
- * @return boolean True if link present.
- * @access public
- */
- function isLink($label) {
- return (count($this->_page->getUrlsByLabel($label)) > 0);
- }
-
- /**
- * Follows a link by id attribute.
- * @param string $id ID attribute value.
- * @return string/boolean Page on success.
- * @access public
- */
- function clickLinkById($id) {
- if (! ($url = $this->_page->getUrlById($id))) {
- return false;
- }
- $this->_load($url, new SimpleGetEncoding());
- return $this->getContent();
- }
-
- /**
- * Tests to see if a link is present by ID attribute.
- * @param string $id Text of id attribute.
- * @return boolean True if link present.
- * @access public
- */
- function isLinkById($id) {
- return (boolean)$this->_page->getUrlById($id);
- }
-
- /**
- * Clicks a visible text item. Will first try buttons,
- * then links and then images.
- * @param string $label Visible text or alt text.
- * @return string/boolean Raw page or false.
- * @access public
- */
- function click($label) {
- $raw = $this->clickSubmit($label);
- if (! $raw) {
- $raw = $this->clickLink($label);
- }
- if (! $raw) {
- $raw = $this->clickImage($label);
- }
- return $raw;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/collector.php b/tests/test_tools/simpletest/collector.php
deleted file mode 100644
index ded847c9..00000000
--- a/tests/test_tools/simpletest/collector.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-/**
- * This file contains the following classes: {@link SimpleCollector},
- * {@link SimplePatternCollector}.
- *
- * @author Travis Swicegood <development@domain51.com>
- * @package SimpleTest
- * @subpackage UnitTester
- */
-
-/**
- * The basic collector for {@link GroupTest}
- *
- * @see collect(), GroupTest::collect()
- * @package SimpleTest
- * @subpackage UnitTester
- */
-class SimpleCollector {
-
- /**
- * Strips off any kind of slash at the end so as to normalise the path
- *
- * @param string $path Path to normalise.
- */
- function _removeTrailingSlash($path) {
- return preg_replace('|[\\/]$|', '', $path);
-
- /**
- * @internal
- * Try benchmarking the following. It's more code, but by not using the
- * regex, it may be faster? Also, shouldn't be looking for
- * DIRECTORY_SEPERATOR instead of a manual "/"?
- */
- if (substr($path, -1) == DIRECTORY_SEPERATOR) {
- return substr($path, 0, -1);
- } else {
- return $path;
- }
- }
-
- /**
- * Scans the directory and adds what it can.
- * @param object $test Group test with {@link GroupTest::addTestFile()} method.
- * @param string $path Directory to scan.
- * @see _attemptToAdd()
- */
- function collect($test, $path) {
- $path = $this->_removeTrailingSlash($path);
- if ($handle = opendir($path)) {
- while (($entry = readdir($handle)) !== false) {
- $this->_handle($test, $path . DIRECTORY_SEPARATOR . $entry);
- }
- closedir($handle);
- }
- }
-
- /**
- * This method determines what should be done with a given file and adds
- * it via {@link GroupTest::addTestFile()} if necessary.
- *
- * This method should be overriden to provide custom matching criteria,
- * such as pattern matching, recursive matching, etc. For an example, see
- * {@link SimplePatternCollector::_handle()}.
- *
- * @param object $test Group test with {@link GroupTest::addTestFile()} method.
- * @param string $filename A filename as generated by {@link collect()}
- * @see collect()
- * @access protected
- */
- function _handle($test, $file) {
- if (!is_dir($file)) {
- $test->addTestFile($file);
- }
- }
-}
-
-/**
- * An extension to {@link SimpleCollector} that only adds files matching a
- * given pattern.
- *
- * @package SimpleTest
- * @subpackage UnitTester
- * @see SimpleCollector
- */
-class SimplePatternCollector extends SimpleCollector {
- protected $_pattern;
-
-
- /**
- *
- * @param string $pattern Perl compatible regex to test name against
- * See {@link http://us4.php.net/manual/en/reference.pcre.pattern.syntax.php PHP's PCRE}
- * for full documentation of valid pattern.s
- */
- function SimplePatternCollector($pattern = '/php$/i') {
- $this->_pattern = $pattern;
- }
-
-
- /**
- * Attempts to add files that match a given pattern.
- *
- * @see SimpleCollector::_handle()
- * @param object $test Group test with {@link GroupTest::addTestFile()} method.
- * @param string $path Directory to scan.
- * @access protected
- */
- function _handle($test, $filename) {
- if (preg_match($this->_pattern, $filename)) {
- parent::_handle($test, $filename);
- }
- }
-} \ No newline at end of file
diff --git a/tests/test_tools/simpletest/compatibility.php b/tests/test_tools/simpletest/compatibility.php
deleted file mode 100644
index a181793e..00000000
--- a/tests/test_tools/simpletest/compatibility.php
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @version $Id: compatibility.php 1532 2006-12-01 12:28:55Z xue $
- */
-
- /**
- * Static methods for compatibility between different
- * PHP versions.
- * @package SimpleTest
- */
- class SimpleTestCompatibility {
-
- /**
- * Creates a copy whether in PHP5 or PHP4.
- * @param object $object Thing to copy.
- * @return object A copy.
- * @access public
- * @static
- */
- static function copy($object) {
- if (version_compare(phpversion(), '5') >= 0) {
- eval('$copy = clone $object;');
- return $copy;
- }
- return $object;
- }
-
- /**
- * Identity test. Drops back to equality + types for PHP5
- * objects as the === operator counts as the
- * stronger reference constraint.
- * @param mixed $first Test subject.
- * @param mixed $second Comparison object.
- * @return boolean True if identical.
- * @access public
- * @static
- */
- static function isIdentical($first, $second) {
- if ($first != $second) {
- return false;
- }
- if (version_compare(phpversion(), '5') >= 0) {
- return SimpleTestCompatibility::_isIdenticalType($first, $second);
- }
- return ($first === $second);
- }
-
- /**
- * Recursive type test.
- * @param mixed $first Test subject.
- * @param mixed $second Comparison object.
- * @return boolean True if same type.
- * @access private
- * @static
- */
- static function _isIdenticalType($first, $second) {
- if (gettype($first) != gettype($second)) {
- return false;
- }
- if (is_object($first) && is_object($second)) {
- if (get_class($first) != get_class($second)) {
- return false;
- }
- return SimpleTestCompatibility::_isArrayOfIdenticalTypes(
- get_object_vars($first),
- get_object_vars($second));
- }
- if (is_array($first) && is_array($second)) {
- return SimpleTestCompatibility::_isArrayOfIdenticalTypes($first, $second);
- }
- return true;
- }
-
- /**
- * Recursive type test for each element of an array.
- * @param mixed $first Test subject.
- * @param mixed $second Comparison object.
- * @return boolean True if identical.
- * @access private
- * @static
- */
- static function _isArrayOfIdenticalTypes($first, $second) {
- if (array_keys($first) != array_keys($second)) {
- return false;
- }
- foreach (array_keys($first) as $key) {
- $is_identical = SimpleTestCompatibility::_isIdenticalType(
- $first[$key],
- $second[$key]);
- if (! $is_identical) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Test for two variables being aliases.
- * @param mixed $first Test subject.
- * @param mixed $second Comparison object.
- * @return boolean True if same.
- * @access public
- * @static
- */
- static function isReference($first, $second) {
- if (version_compare(phpversion(), '5', '>=')
- && is_object($first)) {
- return ($first === $second);
- }
- if (is_object($first) && is_object($second)) {
- $id = uniqid("test");
- $first->$id = true;
- $is_ref = isset($second->$id);
- unset($first->$id);
- return $is_ref;
- }
- $temp = $first;
- $first = uniqid("test");
- $is_ref = ($first === $second);
- $first = $temp;
- return $is_ref;
- }
-
- /**
- * Test to see if an object is a member of a
- * class hiearchy.
- * @param object $object Object to test.
- * @param string $class Root name of hiearchy.
- * @return boolean True if class in hiearchy.
- * @access public
- * @static
- */
- static function isA($object, $class) {
- if (version_compare(phpversion(), '5') >= 0) {
- if (! class_exists($class, false)) {
- if (function_exists('interface_exists')) {
- if (! interface_exists($class, false)) {
- return false;
- }
- }
- }
- eval("\$is_a = \$object instanceof $class;");
- return $is_a;
- }
- if (function_exists('is_a')) {
- return is_a($object, $class);
- }
- return ((strtolower($class) == get_class($object))
- or (is_subclass_of($object, $class)));
- }
-
- /**
- * Sets a socket timeout for each chunk.
- * @param resource $handle Socket handle.
- * @param integer $timeout Limit in seconds.
- * @access public
- * @static
- */
- static function setTimeout($handle, $timeout) {
- if (function_exists('stream_set_timeout')) {
- stream_set_timeout($handle, $timeout, 0);
- } elseif (function_exists('socket_set_timeout')) {
- socket_set_timeout($handle, $timeout, 0);
- } elseif (function_exists('set_socket_timeout')) {
- set_socket_timeout($handle, $timeout, 0);
- }
- }
-
- /**
- * Gets the current stack trace topmost first.
- * @return array List of stack frames.
- * @access public
- * @static
- */
- static function getStackTrace() {
- if (function_exists('debug_backtrace')) {
- return array_reverse(debug_backtrace());
- }
- return array();
- }
- }
diff --git a/tests/test_tools/simpletest/cookies.php b/tests/test_tools/simpletest/cookies.php
deleted file mode 100644
index eba8776e..00000000
--- a/tests/test_tools/simpletest/cookies.php
+++ /dev/null
@@ -1,379 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: cookies.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/url.php');
- /**#@-*/
-
- /**
- * Cookie data holder. Cookie rules are full of pretty
- * arbitary stuff. I have used...
- * http://wp.netscape.com/newsref/std/cookie_spec.html
- * http://www.cookiecentral.com/faq/
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleCookie {
- protected $_host;
- protected $_name;
- protected $_value;
- protected $_path;
- protected $_expiry;
- protected $_is_secure;
-
- /**
- * Constructor. Sets the stored values.
- * @param string $name Cookie key.
- * @param string $value Value of cookie.
- * @param string $path Cookie path if not host wide.
- * @param string $expiry Expiry date as string.
- * @param boolean $is_secure Currently ignored.
- */
- function SimpleCookie($name, $value = false, $path = false, $expiry = false, $is_secure = false) {
- $this->_host = false;
- $this->_name = $name;
- $this->_value = $value;
- $this->_path = ($path ? $this->_fixPath($path) : "/");
- $this->_expiry = false;
- if (is_string($expiry)) {
- $this->_expiry = strtotime($expiry);
- } elseif (is_integer($expiry)) {
- $this->_expiry = $expiry;
- }
- $this->_is_secure = $is_secure;
- }
-
- /**
- * Sets the host. The cookie rules determine
- * that the first two parts are taken for
- * certain TLDs and three for others. If the
- * new host does not match these rules then the
- * call will fail.
- * @param string $host New hostname.
- * @return boolean True if hostname is valid.
- * @access public
- */
- function setHost($host) {
- if ($host = $this->_truncateHost($host)) {
- $this->_host = $host;
- return true;
- }
- return false;
- }
-
- /**
- * Accessor for the truncated host to which this
- * cookie applies.
- * @return string Truncated hostname.
- * @access public
- */
- function getHost() {
- return $this->_host;
- }
-
- /**
- * Test for a cookie being valid for a host name.
- * @param string $host Host to test against.
- * @return boolean True if the cookie would be valid
- * here.
- */
- function isValidHost($host) {
- return ($this->_truncateHost($host) === $this->getHost());
- }
-
- /**
- * Extracts just the domain part that determines a
- * cookie's host validity.
- * @param string $host Host name to truncate.
- * @return string Domain or false on a bad host.
- * @access private
- */
- function _truncateHost($host) {
- $tlds = SimpleUrl::getAllTopLevelDomains();
- if (preg_match('/[a-z\-]+\.(' . $tlds . ')$/i', $host, $matches)) {
- return $matches[0];
- } elseif (preg_match('/[a-z\-]+\.[a-z\-]+\.[a-z\-]+$/i', $host, $matches)) {
- return $matches[0];
- }
- return false;
- }
-
- /**
- * Accessor for name.
- * @return string Cookie key.
- * @access public
- */
- function getName() {
- return $this->_name;
- }
-
- /**
- * Accessor for value. A deleted cookie will
- * have an empty string for this.
- * @return string Cookie value.
- * @access public
- */
- function getValue() {
- return $this->_value;
- }
-
- /**
- * Accessor for path.
- * @return string Valid cookie path.
- * @access public
- */
- function getPath() {
- return $this->_path;
- }
-
- /**
- * Tests a path to see if the cookie applies
- * there. The test path must be longer or
- * equal to the cookie path.
- * @param string $path Path to test against.
- * @return boolean True if cookie valid here.
- * @access public
- */
- function isValidPath($path) {
- return (strncmp(
- $this->_fixPath($path),
- $this->getPath(),
- strlen($this->getPath())) == 0);
- }
-
- /**
- * Accessor for expiry.
- * @return string Expiry string.
- * @access public
- */
- function getExpiry() {
- if (! $this->_expiry) {
- return false;
- }
- return gmdate("D, d M Y H:i:s", $this->_expiry) . " GMT";
- }
-
- /**
- * Test to see if cookie is expired against
- * the cookie format time or timestamp.
- * Will give true for a session cookie.
- * @param integer/string $now Time to test against. Result
- * will be false if this time
- * is later than the cookie expiry.
- * Can be either a timestamp integer
- * or a cookie format date.
- * @access public
- */
- function isExpired($now) {
- if (! $this->_expiry) {
- return true;
- }
- if (is_string($now)) {
- $now = strtotime($now);
- }
- return ($this->_expiry < $now);
- }
-
- /**
- * Ages the cookie by the specified number of
- * seconds.
- * @param integer $interval In seconds.
- * @public
- */
- function agePrematurely($interval) {
- if ($this->_expiry) {
- $this->_expiry -= $interval;
- }
- }
-
- /**
- * Accessor for the secure flag.
- * @return boolean True if cookie needs SSL.
- * @access public
- */
- function isSecure() {
- return $this->_is_secure;
- }
-
- /**
- * Adds a trailing and leading slash to the path
- * if missing.
- * @param string $path Path to fix.
- * @access private
- */
- function _fixPath($path) {
- if (substr($path, 0, 1) != '/') {
- $path = '/' . $path;
- }
- if (substr($path, -1, 1) != '/') {
- $path .= '/';
- }
- return $path;
- }
- }
-
- /**
- * Repository for cookies. This stuff is a
- * tiny bit browser dependent.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleCookieJar {
- protected $_cookies;
-
- /**
- * Constructor. Jar starts empty.
- * @access public
- */
- function SimpleCookieJar() {
- $this->_cookies = array();
- }
-
- /**
- * Removes expired and temporary cookies as if
- * the browser was closed and re-opened.
- * @param string/integer $now Time to test expiry against.
- * @access public
- */
- function restartSession($date = false) {
- $surviving_cookies = array();
- for ($i = 0; $i < count($this->_cookies); $i++) {
- if (! $this->_cookies[$i]->getValue()) {
- continue;
- }
- if (! $this->_cookies[$i]->getExpiry()) {
- continue;
- }
- if ($date && $this->_cookies[$i]->isExpired($date)) {
- continue;
- }
- $surviving_cookies[] = $this->_cookies[$i];
- }
- $this->_cookies = $surviving_cookies;
- }
-
- /**
- * Ages all cookies in the cookie jar.
- * @param integer $interval The old session is moved
- * into the past by this number
- * of seconds. Cookies now over
- * age will be removed.
- * @access public
- */
- function agePrematurely($interval) {
- for ($i = 0; $i < count($this->_cookies); $i++) {
- $this->_cookies[$i]->agePrematurely($interval);
- }
- }
-
- /**
- * Sets an additional cookie. If a cookie has
- * the same name and path it is replaced.
- * @param string $name Cookie key.
- * @param string $value Value of cookie.
- * @param string $host Host upon which the cookie is valid.
- * @param string $path Cookie path if not host wide.
- * @param string $expiry Expiry date.
- * @access public
- */
- function setCookie($name, $value, $host = false, $path = '/', $expiry = false) {
- $cookie = new SimpleCookie($name, $value, $path, $expiry);
- if ($host) {
- $cookie->setHost($host);
- }
- $this->_cookies[$this->_findFirstMatch($cookie)] = $cookie;
- }
-
- /**
- * Finds a matching cookie to write over or the
- * first empty slot if none.
- * @param SimpleCookie $cookie Cookie to write into jar.
- * @return integer Available slot.
- * @access private
- */
- function _findFirstMatch($cookie) {
- for ($i = 0; $i < count($this->_cookies); $i++) {
- $is_match = $this->_isMatch(
- $cookie,
- $this->_cookies[$i]->getHost(),
- $this->_cookies[$i]->getPath(),
- $this->_cookies[$i]->getName());
- if ($is_match) {
- return $i;
- }
- }
- return count($this->_cookies);
- }
-
- /**
- * Reads the most specific cookie value from the
- * browser cookies. Looks for the longest path that
- * matches.
- * @param string $host Host to search.
- * @param string $path Applicable path.
- * @param string $name Name of cookie to read.
- * @return string False if not present, else the
- * value as a string.
- * @access public
- */
- function getCookieValue($host, $path, $name) {
- $longest_path = '';
- foreach ($this->_cookies as $cookie) {
- if ($this->_isMatch($cookie, $host, $path, $name)) {
- if (strlen($cookie->getPath()) > strlen($longest_path)) {
- $value = $cookie->getValue();
- $longest_path = $cookie->getPath();
- }
- }
- }
- return (isset($value) ? $value : false);
- }
-
- /**
- * Tests cookie for matching against search
- * criteria.
- * @param SimpleTest $cookie Cookie to test.
- * @param string $host Host must match.
- * @param string $path Cookie path must be shorter than
- * this path.
- * @param string $name Name must match.
- * @return boolean True if matched.
- * @access private
- */
- function _isMatch($cookie, $host, $path, $name) {
- if ($cookie->getName() != $name) {
- return false;
- }
- if ($host && $cookie->getHost() && ! $cookie->isValidHost($host)) {
- return false;
- }
- if (! $cookie->isValidPath($path)) {
- return false;
- }
- return true;
- }
-
- /**
- * Uses a URL to sift relevant cookies by host and
- * path. Results are list of strings of form "name=value".
- * @param SimpleUrl $url Url to select by.
- * @return array Valid name and value pairs.
- * @access public
- */
- function selectAsPairs($url) {
- $pairs = array();
- foreach ($this->_cookies as $cookie) {
- if ($this->_isMatch($cookie, $url->getHost(), $url->getPath(), $cookie->getName())) {
- $pairs[] = $cookie->getName() . '=' . $cookie->getValue();
- }
- }
- return $pairs;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/detached.php b/tests/test_tools/simpletest/detached.php
deleted file mode 100644
index 06665781..00000000
--- a/tests/test_tools/simpletest/detached.php
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: detached.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/xml.php');
- require_once(dirname(__FILE__) . '/shell_tester.php');
- /**#@-*/
-
- /**
- * Runs an XML formated test in a separate process.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class DetachedTestCase {
- protected $_command;
- protected $_dry_command;
- protected $_size;
-
- /**
- * Sets the location of the remote test.
- * @param string $command Test script.
- * @param string $dry_command Script for dry run.
- * @access public
- */
- function DetachedTestCase($command, $dry_command = false) {
- $this->_command = $command;
- $this->_dry_command = $dry_command ? $dry_command : $command;
- $this->_size = false;
- }
-
- /**
- * Accessor for the test name for subclasses.
- * @return string Name of the test.
- * @access public
- */
- function getLabel() {
- return $this->_command;
- }
-
- /**
- * Runs the top level test for this class. Currently
- * reads the data as a single chunk. I'll fix this
- * once I have added iteration to the browser.
- * @param SimpleReporter $reporter Target of test results.
- * @returns boolean True if no failures.
- * @access public
- */
- function run($reporter) {
- $shell = new SimpleShell();
- $shell->execute($this->_command);
- $parser = $this->_createParser($reporter);
- if (! $parser->parse($shell->getOutput())) {
- trigger_error('Cannot parse incoming XML from [' . $this->_command . ']');
- return false;
- }
- return true;
- }
-
- /**
- * Accessor for the number of subtests.
- * @return integer Number of test cases.
- * @access public
- */
- function getSize() {
- if ($this->_size === false) {
- $shell = new SimpleShell();
- $shell->execute($this->_dry_command);
- $reporter = new SimpleReporter();
- $parser = $this->_createParser($reporter);
- if (! $parser->parse($shell->getOutput())) {
- trigger_error('Cannot parse incoming XML from [' . $this->_dry_command . ']');
- return false;
- }
- $this->_size = $reporter->getTestCaseCount();
- }
- return $this->_size;
- }
-
- /**
- * Creates the XML parser.
- * @param SimpleReporter $reporter Target of test results.
- * @return SimpleTestXmlListener XML reader.
- * @access protected
- */
- function &_createParser($reporter) {
- return new SimpleTestXmlParser($reporter);
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/docs/en/authentication_documentation.html b/tests/test_tools/simpletest/docs/en/authentication_documentation.html
deleted file mode 100755
index c90d61e5..00000000
--- a/tests/test_tools/simpletest/docs/en/authentication_documentation.html
+++ /dev/null
@@ -1,336 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>SimpleTest documentation for testing log-in and authentication</title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<span class="chosen">Authentication</span>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Authentication documentation</h1>
-<div class="content">
-
- <p>
- One of the trickiest, and yet most important, areas
- of testing web sites is the security.
- Testing these schemes is one of the core goals of
- the SimpleTest web tester.
- </p>
-
- <p>
-<a class="target" name="basic">
-<h2>Basic HTTP authentication</h2>
-</a>
-</p>
- <p>
- If you fetch a page protected by basic authentication then
- rather than receiving content, you will instead get a 401
- header.
- We can illustrate this with this test...
-<pre>
-class AuthenticationTest extends WebTestCase {<strong>
- function test401Header() {
- $this-&gt;get('http://www.lastcraft.com/protected/');
- $this-&gt;showHeaders();
- }</strong>
-}
-</pre>
- This allows us to see the challenge header...
- <div class="demo">
- <h1>File test</h1>
-<pre style="background-color: lightgray; color: black">
-HTTP/1.1 401 Authorization Required
-Date: Sat, 18 Sep 2004 19:25:18 GMT
-Server: Apache/1.3.29 (Unix) PHP/4.3.4
-WWW-Authenticate: Basic realm="SimpleTest basic authentication"
-Connection: close
-Content-Type: text/html; charset=iso-8859-1
-</pre>
- <div style="padding: 8px; margin-top: 1em; background-color: green; color: white;">1/1 test cases complete.
- <strong>0</strong> passes, <strong>0</strong> fails and <strong>0</strong> exceptions.</div>
- </div>
- We are trying to get away from visual inspection though, and so SimpleTest
- allows to make automated assertions against the challenge.
- Here is a thorough test of our header...
-<pre>
-class AuthenticationTest extends WebTestCase {
- function test401Header() {
- $this-&gt;get('http://www.lastcraft.com/protected/');<strong>
- $this-&gt;assertAuthentication('Basic');
- $this-&gt;assertResponse(401);
- $this-&gt;assertRealm('SimpleTest basic authentication');</strong>
- }
-}
-</pre>
- Any one of these tests would normally do on it's own depending
- on the amount of detail you want to see.
- </p>
- <p>
- One theme that runs through SimpleTest is the ability to use
- <span class="new_code">SimpleExpectation</span> objects wherever a simple
- match is not enough.
- If you want only an approximate match to the realm for
- example, you can do this...
-<pre>
-class AuthenticationTest extends WebTestCase {
- function test401Header() {
- $this-&gt;get('http://www.lastcraft.com/protected/');
- $this-&gt;assertRealm(<strong>new PatternExpectation('/simpletest/i')</strong>);
- }
-}
-</pre>
- Most of the time we are not interested in testing the
- authentication itself, but want to get past it to test
- the pages underneath.
- As soon as the challenge has been issued we can reply with
- an authentication response...
-<pre>
-class AuthenticationTest extends WebTestCase {
- function testCanAuthenticate() {
- $this-&gt;get('http://www.lastcraft.com/protected/');<strong>
- $this-&gt;authenticate('Me', 'Secret');</strong>
- $this-&gt;assertTitle(...);
- }
-}
-</pre>
- The username and password will now be sent with every
- subsequent request to that directory and subdirectories.
- You will have to authenticate again if you step outside
- the authenticated directory, but SimpleTest is smart enough
- to merge subdirectories into a common realm.
- </p>
- <p>
- You can shortcut this step further by encoding the log in
- details straight into the URL...
-<pre>
-class AuthenticationTest extends WebTestCase {
- function testCanReadAuthenticatedPages() {
- $this-&gt;get('http://<strong>Me:Secret@</strong>www.lastcraft.com/protected/');
- $this-&gt;assertTitle(...);
- }
-}
-</pre>
- If your username or password has special characters, then you
- will have to URL encode them or the request will not be parsed
- correctly.
- Also this header will not be sent on subsequent requests if
- you request a page with a fully qualified URL.
- If you navigate with relative URLs though, the authentication
- information will be preserved.
- </p>
- <p>
- Only basic authentication is currently supported and this is
- only really secure in tandem with HTTPS connections.
- This is usually enough to protect test server from prying eyes,
- however.
- Digest authentication and NTLM authentication may be added
- in the future.
- </p>
-
- <p>
-<a class="target" name="cookies">
-<h2>Cookies</h2>
-</a>
-</p>
- <p>
- Basic authentication doesn't give enough control over the
- user interface for web developers.
- More likely this functionality will be coded directly into
- the web architecture using cookies and complicated timeouts.
- </p>
- <p>
- Starting with a simple log-in form...
-<pre>
-&lt;form&gt;
- Username:
- &lt;input type="text" name="u" value="" /&gt;&lt;br /&gt;
- Password:
- &lt;input type="password" name="p" value="" /&gt;&lt;br /&gt;
- &lt;input type="submit" value="Log in" /&gt;
-&lt;/form&gt;
-</pre>
- Which looks like...
- </p>
- <p>
- <form class="demo">
- Username:
- <input type="text" name="u" value="">
-<br>
- Password:
- <input type="password" name="p" value="">
-<br>
- <input type="submit" value="Log in">
- </form>
- </p>
- <p>
- Let's suppose that in fetching this page a cookie has been
- set with a session ID.
- We are not going to fill the form in yet, just test that
- we are tracking the user.
- Here is the test...
-<pre>
-class LogInTest extends WebTestCase {
- function testSessionCookieSetBeforeForm() {
- $this-&gt;get('http://www.my-site.com/login.php');<strong>
- $this-&gt;assertCookie('SID');</strong>
- }
-}
-</pre>
- All we are doing is confirming that the cookie is set.
- As the value is likely to be rather cryptic it's not
- really worth testing this with...
-<pre>
-class LogInTest extends WebTestCase {
- function testSessionCookieIsCorrectPattern() {
- $this-&gt;get('http://www.my-site.com/login.php');
- $this-&gt;assertCookie('SID', <strong>new PatternExpectation('/[a-f0-9]{32}/i')</strong>);
- }
-}
-</pre>
- The rest of the test would be the same as any other form,
- but we might want to confirm that we still have the same
- cookie after log-in as before we entered.
- We wouldn't want to lose track of this after all.
- Here is a possible test for this...
-<pre>
-class LogInTest extends WebTestCase {
- ...
- function testSessionCookieSameAfterLogIn() {
- $this-&gt;get('http://www.my-site.com/login.php');<strong>
- $session = $this-&gt;getCookie('SID');
- $this-&gt;setField('u', 'Me');
- $this-&gt;setField('p', 'Secret');
- $this-&gt;click('Log in');
- $this-&gt;assertText('Welcome Me');
- $this-&gt;assertCookie('SID', $session);</strong>
- }
-}
-</pre>
- This confirms that the session identifier is maintained
- afer log-in.
- </p>
- <p>
- We could even attempt to spoof our own system by setting
- arbitrary cookies to gain access...
-<pre>
-class LogInTest extends WebTestCase {
- ...
- function testSessionCookieSameAfterLogIn() {
- $this-&gt;get('http://www.my-site.com/login.php');<strong>
- $this-&gt;setCookie('SID', 'Some other session');
- $this-&gt;get('http://www.my-site.com/restricted.php');</strong>
- $this-&gt;assertText('Access denied');
- }
-}
-</pre>
- Is your site protected from this attack?
- </p>
-
- <p>
-<a class="target" name="session">
-<h2>Browser sessions</h2>
-</a>
-</p>
- <p>
- If you are testing an authentication system a critical piece
- of behaviour is what happens when a user logs back in.
- We would like to simulate closing and reopening a browser...
-<pre>
-class LogInTest extends WebTestCase {
- ...
- function testLoseAuthenticationAfterBrowserClose() {
- $this-&gt;get('http://www.my-site.com/login.php');
- $this-&gt;setField('u', 'Me');
- $this-&gt;setField('p', 'Secret');
- $this-&gt;click('Log in');
- $this-&gt;assertText('Welcome Me');<strong>
-
- $this-&gt;restart();
- $this-&gt;get('http://www.my-site.com/restricted.php');
- $this-&gt;assertText('Access denied');</strong>
- }
-}
-</pre>
- The <span class="new_code">WebTestCase::restart()</span> method will
- preserve cookies that have unexpired timeouts, but throw away
- those that are temporary or expired.
- You can optionally specify the time and date that the restart
- happened.
- </p>
- <p>
- Expiring cookies can be a problem.
- After all, if you have a cookie that expires after an hour,
- you don't want to stall the test for an hour while the
- cookie passes it's timeout.
- </p>
- <p>
- To push the cookies over the hour limit you can age them
- before you restart the session...
-<pre>
-class LogInTest extends WebTestCase {
- ...
- function testLoseAuthenticationAfterOneHour() {
- $this-&gt;get('http://www.my-site.com/login.php');
- $this-&gt;setField('u', 'Me');
- $this-&gt;setField('p', 'Secret');
- $this-&gt;click('Log in');
- $this-&gt;assertText('Welcome Me');
- <strong>
- $this-&gt;ageCookies(3600);</strong>
- $this-&gt;restart();
- $this-&gt;get('http://www.my-site.com/restricted.php');
- $this-&gt;assertText('Access denied');
- }
-}
-</pre>
- After the restart it will appear that cookies are an
- hour older and any that pass their expiry will have
- disappeared.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/browser_documentation.html b/tests/test_tools/simpletest/docs/en/browser_documentation.html
deleted file mode 100755
index f6046a9d..00000000
--- a/tests/test_tools/simpletest/docs/en/browser_documentation.html
+++ /dev/null
@@ -1,391 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>SimpleTest documentation for the scriptable web browser component</title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<span class="chosen">Scriptable browser</span>
-</li>
-</ul>
-</div>
-</div>
-<h1>PHP Scriptable Web Browser</h1>
-<div class="content">
-
- <p>
- SimpleTest's web browser component can be used not just
- outside of the <span class="new_code">WebTestCase</span> class, but also
- independently of the SimpleTest framework itself.
- </p>
-
- <p>
-<a class="target" name="scripting">
-<h2>The Scriptable Browser</h2>
-</a>
-</p>
- <p>
- You can use the web browser in PHP scripts to confirm
- services are up and running, or to extract information
- from them at a regular basis.
- For example, here is a small script to extract the current number of
- open PHP 5 bugs from the <a href="http://www.php.net/">PHP web site</a>...
-<pre>
-<strong>&lt;?php
- require_once('simpletest/browser.php');
-
- $browser = &amp;new SimpleBrowser();
- $browser-&gt;get('http://php.net/');
- $browser-&gt;click('reporting bugs');
- $browser-&gt;click('statistics');
- $page = $browser-&gt;click('PHP 5 bugs only');
- preg_match('/status=Open.*?by=Any.*?(\d+)&lt;\/a&gt;/', $page, $matches);
- print $matches[1];
-?&gt;</strong>
-</pre>
- There are simpler methods to do this particular example in PHP
- of course.
- For example you can just use the PHP <span class="new_code">file()</span>
- command against what here is a pretty fixed page.
- However, using the web browser for scripts allows authentication,
- correct handling of cookies, automatic loading of frames, redirects,
- form submission and the ability to examine the page headers.
- Such methods are fragile against a site that is constantly
- evolving and you would want a more direct way of accessing
- data in a permanent set up, but for simple tasks this can provide
- a very rapid solution.
- </p>
- <p>
- All of the navigation methods used in the
- <a href="web_tester_documentation.html">WebTestCase</a>
- are present in the <span class="new_code">SimpleBrowser</span> class, but
- the assertions are replaced with simpler accessors.
- Here is a full list of the page navigation methods...
- <table>
-<tbody>
- <tr>
-<td><span class="new_code">addHeader($header)</span></td><td>Adds a header to every fetch</td>
-</tr>
- <tr>
-<td><span class="new_code">useProxy($proxy, $username, $password)</span></td><td>Use this proxy from now on</td>
-</tr>
- <tr>
-<td><span class="new_code">head($url, $parameters)</span></td><td>Perform a HEAD request</td>
-</tr>
- <tr>
-<td><span class="new_code">get($url, $parameters)</span></td><td>Fetch a page with GET</td>
-</tr>
- <tr>
-<td><span class="new_code">post($url, $parameters)</span></td><td>Fetch a page with POST</td>
-</tr>
- <tr>
-<td><span class="new_code">clickLink($label)</span></td><td>Follows a link by label</td>
-</tr>
- <tr>
-<td><span class="new_code">isLink($label)</span></td><td>See if a link is present by label</td>
-</tr>
- <tr>
-<td><span class="new_code">clickLinkById($id)</span></td><td>Follows a link by attribute</td>
-</tr>
- <tr>
-<td><span class="new_code">isLinkById($id)</span></td><td>See if a link is present by attribut</td>
-</tr>
- <tr>
-<td><span class="new_code">getUrl()</span></td><td>Current URL of page or frame</td>
-</tr>
- <tr>
-<td><span class="new_code">getTitle()</span></td><td>Page title</td>
-</tr>
- <tr>
-<td><span class="new_code">getContent()</span></td><td>Raw page or frame</td>
-</tr>
- <tr>
-<td><span class="new_code">getContentAsText()</span></td><td>HTML removed except for alt text</td>
-</tr>
- <tr>
-<td><span class="new_code">retry()</span></td><td>Repeat the last request</td>
-</tr>
- <tr>
-<td><span class="new_code">back()</span></td><td>Use the browser back button</td>
-</tr>
- <tr>
-<td><span class="new_code">forward()</span></td><td>Use the browser forward button</td>
-</tr>
- <tr>
-<td><span class="new_code">authenticate($username, $password)</span></td><td>Retry page or frame after a 401 response</td>
-</tr>
- <tr>
-<td><span class="new_code">restart($date)</span></td><td>Restarts the browser for a new session</td>
-</tr>
- <tr>
-<td><span class="new_code">ageCookies($interval)</span></td><td>Ages the cookies by the specified time</td>
-</tr>
- <tr>
-<td><span class="new_code">setCookie($name, $value)</span></td><td>Sets an additional cookie</td>
-</tr>
- <tr>
-<td><span class="new_code">getCookieValue($host, $path, $name)</span></td><td>Reads the most specific cookie</td>
-</tr>
- <tr>
-<td><span class="new_code">getCurrentCookieValue($name)</span></td><td>Reads cookie for the current context</td>
-</tr>
- </tbody>
-</table>
- The methods <span class="new_code">SimpleBrowser::useProxy()</span> and
- <span class="new_code">SimpleBrowser::addHeader()</span> are special.
- Once called they continue to apply to all subsequent fetches.
- </p>
- <p>
- Navigating forms is similar to the
- <a href="form_testing_documentation.html">WebTestCase form navigation</a>...
- <table>
-<tbody>
- <tr>
-<td><span class="new_code">setField($name, $value)</span></td><td>Sets all form fields with that name</td>
-</tr>
- <tr>
-<td><span class="new_code">setFieldById($id, $value)</span></td><td>Sets all form fields with that id</td>
-</tr>
- <tr>
-<td><span class="new_code">getField($name)</span></td><td>Accessor for a form element value</td>
-</tr>
- <tr>
-<td><span class="new_code">getFieldById($id)</span></td><td>Accessor for a form element value</td>
-</tr>
- <tr>
-<td><span class="new_code">clickSubmit($label)</span></td><td>Submits form by button label</td>
-</tr>
- <tr>
-<td><span class="new_code">clickSubmitByName($name)</span></td><td>Submits form by button attribute</td>
-</tr>
- <tr>
-<td><span class="new_code">clickSubmitById($id)</span></td><td>Submits form by button attribute</td>
-</tr>
- <tr>
-<td><span class="new_code">clickImage($label, $x, $y)</span></td><td>Clicks the image by alt text</td>
-</tr>
- <tr>
-<td><span class="new_code">clickImageByName($name, $x, $y)</span></td><td>Clicks the image by attribute</td>
-</tr>
- <tr>
-<td><span class="new_code">clickImageById($id, $x, $y)</span></td><td>Clicks the image by attribute</td>
-</tr>
- <tr>
-<td><span class="new_code">submitFormById($id)</span></td><td>Submits by the form tag attribute</td>
-</tr>
- </tbody>
-</table>
- At the moment there aren't any methods to list available forms
- and fields.
- This will probably be added to later versions of SimpleTest.
- </p>
- <p>
- Within a page, individual frames can be selected.
- If no selection is made then all the frames are merged together
- in one large conceptual page.
- The content of the current page will be a concatenation of all of the
- frames in the order that they were specified in the "frameset"
- tags.
- <table>
-<tbody>
- <tr>
-<td><span class="new_code">getFrames()</span></td><td>A dump of the current frame structure</td>
-</tr>
- <tr>
-<td><span class="new_code">getFrameFocus()</span></td><td>Current frame label or index</td>
-</tr>
- <tr>
-<td><span class="new_code">setFrameFocusByIndex($choice)</span></td><td>Select a frame numbered from 1</td>
-</tr>
- <tr>
-<td><span class="new_code">setFrameFocus($name)</span></td><td>Select frame by label</td>
-</tr>
- <tr>
-<td><span class="new_code">clearFrameFocus()</span></td><td>Treat all the frames as a single page</td>
-</tr>
- </tbody>
-</table>
- When focused on a single frame, the content will come from
- that frame only.
- This includes links to click and forms to submit.
- </p>
-
- <p>
-<a class="target" name="debug">
-<h2>What went wrong?</h2>
-</a>
-</p>
- <p>
- All of this functionality is great when we actually manage to fetch pages,
- but that doesn't always happen.
- To help figure out what went wrong, the browser has some methods to
- aid in debugging...
- <table>
-<tbody>
- <tr>
-<td><span class="new_code">setConnectionTimeout($timeout)</span></td><td>Close the socket on overrun</td>
-</tr>
- <tr>
-<td><span class="new_code">getRequest()</span></td><td>Raw request header of page or frame</td>
-</tr>
- <tr>
-<td><span class="new_code">getHeaders()</span></td><td>Raw response header of page or frame</td>
-</tr>
- <tr>
-<td><span class="new_code">getTransportError()</span></td><td>Any socket level errors in the last fetch</td>
-</tr>
- <tr>
-<td><span class="new_code">getResponseCode()</span></td><td>HTTP response of page or frame</td>
-</tr>
- <tr>
-<td><span class="new_code">getMimeType()</span></td><td>Mime type of page or frame</td>
-</tr>
- <tr>
-<td><span class="new_code">getAuthentication()</span></td><td>Authentication type in 401 challenge header</td>
-</tr>
- <tr>
-<td><span class="new_code">getRealm()</span></td><td>Authentication realm in 401 challenge header</td>
-</tr>
- <tr>
-<td><span class="new_code">setMaximumRedirects($max)</span></td><td>Number of redirects before page is loaded anyway</td>
-</tr>
- <tr>
-<td><span class="new_code">setMaximumNestedFrames($max)</span></td><td>Protection against recursive framesets</td>
-</tr>
- <tr>
-<td><span class="new_code">ignoreFrames()</span></td><td>Disables frames support</td>
-</tr>
- <tr>
-<td><span class="new_code">useFrames()</span></td><td>Enables frames support</td>
-</tr>
- <tr>
-<td><span class="new_code">ignoreCookies()</span></td><td>Disables sending and receiving of cookies</td>
-</tr>
- <tr>
-<td><span class="new_code">useCookies()</span></td><td>Enables cookie support</td>
-</tr>
- </tbody>
-</table>
- The methods <span class="new_code">SimpleBrowser::setConnectionTimeout()</span>
- <span class="new_code">SimpleBrowser::setMaximumRedirects()</span>,
- <span class="new_code">SimpleBrowser::setMaximumNestedFrames()</span>,
- <span class="new_code">SimpleBrowser::ignoreFrames()</span>,
- <span class="new_code">SimpleBrowser::useFrames()</span>,
- <span class="new_code">SimpleBrowser::ignoreCookies()</span> and
- <span class="new_code">SimpleBrowser::useCokies()</span> continue to apply
- to every subsequent request.
- The other methods are frames aware.
- This means that if you have an individual frame that is not
- loading, navigate to it using <span class="new_code">SimpleBrowser::setFrameFocus()</span>
- and you can then use <span class="new_code">SimpleBrowser::getRequest()</span>, etc to
- see what happened.
- </p>
-
- <p>
-<a class="target" name="unit">
-<h2>Complex unit tests with multiple browsers</h2>
-</a>
-</p>
- <p>
- Anything that could be done in a
- <a href="web_tester_documentation.html">WebTestCase</a> can
- now be done in a <a href="unit_tester_documentation.html">UnitTestCase</a>.
- This means that we can freely mix domain object testing with the
- web interface...
-<pre>
-<strong>
-class TestOfRegistration extends UnitTestCase {
- function testNewUserAddedToAuthenticator() {</strong>
- $browser = &amp;new SimpleBrowser();
- $browser-&gt;get('http://my-site.com/register.php');
- $browser-&gt;setField('email', 'me@here');
- $browser-&gt;setField('password', 'Secret');
- $browser-&gt;click('Register');
- <strong>
- $authenticator = &amp;new Authenticator();
- $member = &amp;$authenticator-&gt;findByEmail('me@here');
- $this-&gt;assertEqual($member-&gt;getPassword(), 'Secret');
- }
-}</strong>
-</pre>
- While this may be a useful temporary expediency, I am not a fan
- of this type of testing.
- The testing has cut across application layers, make it twice as
- likely it will need refactoring when the code changes.
- </p>
- <p>
- A more useful case of where using the browser directly can be helpful
- is where the <span class="new_code">WebTestCase</span> cannot cope.
- An example is where two browsers are needed at the same time.
- </p>
- <p>
- For example, say we want to disallow multiple simultaneous
- usage of a site with the same username.
- This test case will do the job...
-<pre>
-class TestOfSecurity extends UnitTestCase {
- function testNoMultipleLoginsFromSameUser() {<strong>
- $first = &amp;new SimpleBrowser();
- $first-&gt;get('http://my-site.com/login.php');
- $first-&gt;setField('name', 'Me');
- $first-&gt;setField('password', 'Secret');
- $first-&gt;click('Enter');
- $this-&gt;assertEqual($first-&gt;getTitle(), 'Welcome');
-
- $second = &amp;new SimpleBrowser();
- $second-&gt;get('http://my-site.com/login.php');
- $second-&gt;setField('name', 'Me');
- $second-&gt;setField('password', 'Secret');
- $second-&gt;click('Enter');
- $this-&gt;assertEqual($second-&gt;getTitle(), 'Access Denied');</strong>
- }
-}
-</pre>
- You can also use the <span class="new_code">SimpleBrowser</span> class
- directly when you want to write test cases using a different
- test tool than SimpleTest.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/docs.css b/tests/test_tools/simpletest/docs/en/docs.css
deleted file mode 100755
index 93226cd7..00000000
--- a/tests/test_tools/simpletest/docs/en/docs.css
+++ /dev/null
@@ -1,84 +0,0 @@
-body {
- padding-left: 3%;
- padding-right: 3%;
-}
-pre {
- font-family: courier;
- font-size: 80%;
- border: 1px solid;
- background-color: #cccccc;
- padding: 5px;
- margin-left: 5%;
- margin-right: 8%;
-}
-.code, .new_code, pre.new_code {
- font-weight: bold;
-}
-div.copyright {
- font-size: 80%;
- color: gray;
-}
-div.copyright a {
- color: gray;
-}
-ul.api {
- padding-left: 0em;
- padding-right: 25%;
-}
-ul.api li {
- margin-top: 0.2em;
- margin-bottom: 0.2em;
- list-style: none;
- text-indent: -3em;
- padding-left: 3em;
-}
-div.demo {
- border: 4px ridge;
- border-color: gray;
- padding: 10px;
- margin: 5px;
- margin-left: 20px;
- margin-right: 40px;
- background-color: white;
-}
-div.demo span.fail {
- color: red;
-}
-div.demo span.pass {
- color: green;
-}
-div.demo h1 {
- font-size: 12pt;
- text-align: left;
- font-weight: bold;
-}
-table {
- border: 2px outset;
- border-color: gray;
- background-color: white;
- margin: 5px;
- margin-left: 5%;
- margin-right: 5%;
-}
-td {
- font-size: 80%;
-}
-.shell {
- color: white;
-}
-pre.shell {
- border: 4px ridge;
- border-color: gray;
- padding: 10px;
- margin: 5px;
- margin-left: 20px;
- margin-right: 40px;
- background-color: black;
-}
-form.demo {
- background-color: lightgray;
- border: 4px outset;
- border-color: lightgray;
- padding: 10px;
- margin-right: 40%;
-}
diff --git a/tests/test_tools/simpletest/docs/en/expectation_documentation.html b/tests/test_tools/simpletest/docs/en/expectation_documentation.html
deleted file mode 100755
index bd189b94..00000000
--- a/tests/test_tools/simpletest/docs/en/expectation_documentation.html
+++ /dev/null
@@ -1,346 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>
- Extending the SimpleTest unit tester with additional expectation classes
- </title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<span class="chosen">Expectations</span>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Expectation documentation</h1>
-<div class="content">
- <p>
-<a class="target" name="mock">
-<h2>More control over mock objects</h2>
-</a>
-</p>
- <p>
- The default behaviour of the
- <a href="mock_objects_documentation.html">mock objects</a>
- in
- <a href="http://sourceforge.net/projects/simpletest/">SimpleTest</a>
- is either an identical match on the argument or to allow any argument at all.
- For almost all tests this is sufficient.
- Sometimes, though, you want to weaken a test case.
- </p>
- <p>
- One place where a test can be too tightly coupled is with
- text matching.
- Suppose we have a component that outputs a helpful error
- message when something goes wrong.
- You want to test that the correct error was sent, but the actual
- text may be rather long.
- If you test for the text exactly, then every time the exact wording
- of the message changes, you will have to go back and edit the test suite.
- </p>
- <p>
- For example, suppose we have a news service that has failed
- to connect to its remote source.
-<pre>
-<strong>class NewsService {
- ...
- function publish(&amp;$writer) {
- if (! $this-&gt;isConnected()) {
- $writer-&gt;write('Cannot connect to news service "' .
- $this-&gt;_name . '" at this time. ' .
- 'Please try again later.');
- }
- ...
- }
-}</strong>
-</pre>
- Here it is sending its content to a
- <span class="new_code">Writer</span> class.
- We could test this behaviour with a
- <span class="new_code">MockWriter</span> like so...
-<pre>
-class TestOfNewsService extends UnitTestCase {
- ...
- function testConnectionFailure() {&lt;strong&gt;
- $writer = &amp;new MockWriter();
- $writer-&gt;expectOnce('write', array(
- 'Cannot connect to news service ' .
- '"BBC News" at this time. ' .
- 'Please try again later.'));
-
- $service = &amp;new NewsService('BBC News');
- $service-&gt;publish($writer);
- }
-}
-</pre>
- This is a good example of a brittle test.
- If we decide to add additional instructions, such as
- suggesting an alternative news source, we will break
- our tests even though no underlying functionality
- has been altered.
- </p>
- <p>
- To get around this, we would like to do a regular expression
- test rather than an exact match.
- We can actually do this with...
-<pre>
-class TestOfNewsService extends UnitTestCase {
- ...
- function testConnectionFailure() {
- $writer = &amp;new MockWriter();<strong>
- $writer-&gt;expectOnce(
- 'write',
- array(new PatternExpectation('/cannot connect/i')));</strong>
-
- $service = &amp;new NewsService('BBC News');
- $service-&gt;publish($writer);
- }
-}
-</pre>
- Instead of passing in the expected parameter to the
- <span class="new_code">MockWriter</span> we pass an
- expectation class called
- <span class="new_code">WantedPatternExpectation</span>.
- The mock object is smart enough to recognise this as special
- and to treat it differently.
- Rather than simply comparing the incoming argument to this
- object, it uses the expectation object itself to
- perform the test.
- </p>
- <p>
- The <span class="new_code">WantedPatternExpectation</span> takes
- the regular expression to match in its constructor.
- Whenever a comparison is made by the <span class="new_code">MockWriter</span>
- against this expectation class, it will do a
- <span class="new_code">preg_match()</span> with this pattern.
- With our test case above, as long as "cannot connect"
- appears in the text of the string, the mock will issue a pass
- to the unit tester.
- The rest of the text does not matter.
- </p>
- <p>
- The possible expectation classes are...
- <table>
-<tbody>
- <tr>
-<td><span class="new_code">EqualExpectation</span></td><td>An equality, rather than the stronger identity comparison</td>
-</tr>
- <tr>
-<td><span class="new_code">NotEqualExpectation</span></td><td>An inequality comparison</td>
-</tr>
- <tr>
-<td><span class="new_code">IndenticalExpectation</span></td><td>The default mock object check which must match exactly</td>
-</tr>
- <tr>
-<td><span class="new_code">NotIndenticalExpectation</span></td><td>Inverts the mock object logic</td>
-</tr>
- <tr>
-<td><span class="new_code">PatternExpectation</span></td><td>Uses a Perl Regex to match a string</td>
-</tr>
- <tr>
-<td><span class="new_code">NoPatternExpectation</span></td><td>Passes only if failing a Perl Regex</td>
-</tr>
- <tr>
-<td><span class="new_code">IsAExpectation</span></td><td>Checks the type or class name only</td>
-</tr>
- <tr>
-<td><span class="new_code">NotAExpectation</span></td><td>Opposite of the <span class="new_code">IsAExpectation</span></td>
-</tr>
- <tr>
-<td><span class="new_code">MethodExistsExpectation</span></td><td>Checks a method is available on an object</td>
-</tr>
- </tbody>
-</table>
- Most take the expected value in the constructor.
- The exceptions are the pattern matchers, which take a regular expression,
- and the <span class="new_code">IsAExpectation</span> and <span class="new_code">NotAExpectation</span> which takes a type
- or class name as a string.
- </p>
-
- <p>
-<a class="target" name="behaviour">
-<h2>Using expectations to control stubs</h2>
-</a>
-</p>
- <p>
- The expectation classes can be used not just for sending assertions
- from mock objects, but also for selecting behaviour for the
- <a href="mock_objects_documentation.html">mock objects</a>.
- Anywhere a list of arguments is given, a list of expectation objects
- can be inserted instead.
- </p>
- <p>
- Suppose we want an authorisation server mock to simulate a successful login
- only if it receives a valid session object.
- We can do this as follows...
-<pre>
-Mock::generate('Authorisation');
-<strong>
-$authorisation = new MockAuthorisation();
-$authorisation-&gt;setReturnValue(
- 'isAllowed',
- true,
- array(new IsAExpectation('Session', 'Must be a session')));
-$authorisation-&gt;setReturnValue('isAllowed', false);</strong>
-</pre>
- We have set the default mock behaviour to return false when
- <span class="new_code">isAllowed</span> is called.
- When we call the method with a single parameter that
- is a <span class="new_code">Session</span> object, it will return true.
- We have also added a second parameter as a message.
- This will be displayed as part of the mock object
- failure message if this expectation is the cause of
- a failure.
- </p>
- <p>
- This kind of sophistication is rarely useful, but is included for
- completeness.
- </p>
-
- <p>
-<a class="target" name="extending">
-<h2>Creating your own expectations</h2>
-</a>
-</p>
- <p>
- The expectation classes have a very simple structure.
- So simple that it is easy to create your own versions for
- commonly used test logic.
- </p>
- <p>
- As an example here is the creation of a class to test for
- valid IP addresses.
- In order to work correctly with the stubs and mocks the new
- expectation class should extend
- <span class="new_code">SimpleExpectation</span>...
-<pre>
-<strong>class ValidIp extends SimpleExpectation {
-
- function test($ip) {
- return (ip2long($ip) != -1);
- }
-
- function testMessage($ip) {
- return "Address [$ip] should be a valid IP address";
- }
-}</strong>
-</pre>
- There are only two methods to implement.
- The <span class="new_code">test()</span> method should
- evaluate to true if the expectation is to pass, and
- false otherwise.
- The <span class="new_code">testMessage()</span> method
- should simply return some helpful text explaining the test
- that was carried out.
- </p>
- <p>
- This class can now be used in place of the earlier expectation
- classes.
- </p>
-
- <p>
-<a class="target" name="unit">
-<h2>Under the bonnet of the unit tester</h2>
-</a>
-</p>
- <p>
- The <a href="http://sourceforge.net/projects/simpletest/">SimpleTest unit testing framework</a>
- also uses the expectation classes internally for the
- <a href="unit_test_documentation.html">UnitTestCase class</a>.
- We can also take advantage of these mechanisms to reuse our
- homebrew expectation classes within the test suites directly.
- </p>
- <p>
- The most crude way of doing this is to use the
- <span class="new_code">SimpleTest::assert()</span> method to
- test against it directly...
-<pre>
-<strong>class TestOfNetworking extends UnitTestCase {
- ...
- function testGetValidIp() {
- $server = &amp;new Server();
- $this-&gt;assert(
- new ValidIp(),
- $server-&gt;getIp(),
- 'Server IP address-&gt;%s');
- }
-}</strong>
-</pre>
- This is a little untidy compared with our usual
- <span class="new_code">assert...()</span> syntax.
- </p>
- <p>
- For such a simple case we would normally create a
- separate assertion method on our test case rather
- than bother using the expectation class.
- If we pretend that our expectation is a little more
- complicated for a moment, so that we want to reuse it,
- we get...
-<pre>
-class TestOfNetworking extends UnitTestCase {
- ...<strong>
- function assertValidIp($ip, $message = '%s') {
- $this-&gt;assert(new ValidIp(), $ip, $message);
- }</strong>
-
- function testGetValidIp() {
- $server = &amp;new Server();<strong>
- $this-&gt;assertValidIp(
- $server-&gt;getIp(),
- 'Server IP address-&gt;%s');</strong>
- }
-}
-</pre>
- It is unlikely we would ever need this degree of control
- over the testing machinery.
- It is rare to need the expectations for more than pattern
- matching.
- Also, complex expectation classes could make the tests
- harder to read and debug.
- These mechanisms are really of most use to authors of systems
- that will extend the test framework to create their own tool set.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/form_testing_documentation.html b/tests/test_tools/simpletest/docs/en/form_testing_documentation.html
deleted file mode 100755
index 50b634c0..00000000
--- a/tests/test_tools/simpletest/docs/en/form_testing_documentation.html
+++ /dev/null
@@ -1,276 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>Simple Test documentation for testing HTML forms</title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<span class="chosen">Testing forms</span>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Form testing documentation</h1>
-<div class="content">
- <p>
-<a class="target" name="submit">
-<h2>Submitting a simple form</h2>
-</a>
-</p>
- <p>
- When a page is fetched by the <span class="new_code">WebTestCase</span>
- using <span class="new_code">get()</span> or
- <span class="new_code">post()</span> the page content is
- automatically parsed.
- This results in any form controls that are inside &lt;form&gt; tags
- being available from within the test case.
- For example, if we have this snippet of HTML...
-<pre>
-&lt;form&gt;
- &lt;input type="text" name="a" value="A default" /&gt;
- &lt;input type="submit" value="Go" /&gt;
-&lt;/form&gt;
-</pre>
- Which looks like this...
- </p>
- <p>
- <form class="demo">
- <input type="text" name="a" value="A default">
- <input type="submit" value="Go">
- </form>
- </p>
- <p>
- We can navigate to this code, via the
- <a href="http://www.lastcraft.com/form_testing_documentation.php">LastCraft</a>
- site, with the following test...
-<pre>
-class SimpleFormTests extends WebTestCase {
- <strong>
- function testDefaultValue() {
- $this-&gt;get('http://www.lastcraft.com/form_testing_documentation.php');
- $this-&gt;assertField('a', 'A default');
- }</strong>
-}
-</pre>
- Immediately after loading the page all of the HTML controls are set at
- their default values just as they would appear in the web browser.
- The assertion tests that a HTML widget exists in the page with the
- name "a" and that it is currently set to the value
- "A default".
- As usual, we could use a pattern expectation instead if a fixed
- string.
- </p>
- <p>
- We could submit the form straight away, but first we'll change
- the value of the text field and only then submit it...
-<pre>
-class SimpleFormTests extends WebTestCase {
-
- function testDefaultValue() {
- $this-&gt;get('http://www.my-site.com/');
- $this-&gt;assertField('a', 'A default');<strong>
- $this-&gt;setField('a', 'New value');
- $this-&gt;click('Go');</strong>
- }
-}
-</pre>
- Because we didn't specify a method attribute on the form tag, and
- didn't specify an action either, the test case will follow
- the usual browser behaviour of submitting the form data as a <em>GET</em>
- request back to the same location.
- SimpleTest tries to emulate typical browser behaviour as much as possible,
- rather than attempting to catch missing attributes on tags.
- This is because the target of the testing framework is the PHP application
- logic, not syntax or other errors in the HTML code.
- For HTML errors, other tools such as
- <a href="http://www.w3.org/People/Raggett/tidy/">HTMLTidy</a> should be used.
- </p>
- <p>
- If a field is not present in any form, or if an option is unavailable,
- then <span class="new_code">WebTestCase::setField()</span> will return
- <span class="new_code">false</span>.
- For example, suppose we wish to verify that a "Superuser"
- option is not present in this form...
-<pre>
-&lt;strong&gt;Select type of user to add:&lt;/strong&gt;
-&lt;select name="type"&gt;
- &lt;option&gt;Subscriber&lt;/option&gt;
- &lt;option&gt;Author&lt;/option&gt;
- &lt;option&gt;Administrator&lt;/option&gt;
-&lt;/select&gt;
-</pre>
- Which looks like...
- </p>
- <p>
- <form class="demo">
- <strong>Select type of user to add:</strong>
- <select name="type">
- <option>Subscriber</option>
- <option>Author</option>
- <option>Administrator</option>
- </select>
- </form>
- </p>
- <p>
- The following test will confirm it...
-<pre>
-class SimpleFormTests extends WebTestCase {
- ...
- function testNoSuperuserChoiceAvailable() {<strong>
- $this-&gt;get('http://www.lastcraft.com/form_testing_documentation.php');
- $this-&gt;assertFalse($this-&gt;setField('type', 'Superuser'));</strong>
- }
-}
-</pre>
- The selection will not be changed on a failure to set
- a widget value.
- </p>
- <p>
- Here is the full list of widgets currently supported...
- <ul>
- <li>Text fields, including hidden and password fields.</li>
- <li>Submit buttons including the button tag, although not yet reset buttons</li>
- <li>Text area. This includes text wrapping behaviour.</li>
- <li>Checkboxes, including multiple checkboxes in the same form.</li>
- <li>Drop down selections, including multiple selects.</li>
- <li>Radio buttons.</li>
- <li>Images.</li>
- </ul>
- </p>
- <p>
- Although most standard HTML widgets are catered for by <em>SimpleTest</em>'s
- built in parser, it is unlikely that JavaScript will be implemented
- anytime soon.
- </p>
-
- <p>
-<a class="target" name="multiple">
-<h2>Fields with multiple values</h2>
-</a>
-</p>
- <p>
- SimpleTest can cope with two types of multivalue controls: Multiple
- selection drop downs, and multiple checkboxes with the same name
- within a form.
- The multivalue nature of these means that setting and testing
- are slightly different.
- Using checkboxes as an example...
-<pre>
-&lt;form class="demo"&gt;
- &lt;strong&gt;Create privileges allowed:&lt;/strong&gt;
- &lt;input type="checkbox" name="crud" value="c" checked&gt;&lt;br&gt;
- &lt;strong&gt;Retrieve privileges allowed:&lt;/strong&gt;
- &lt;input type="checkbox" name="crud" value="r" checked&gt;&lt;br&gt;
- &lt;strong&gt;Update privileges allowed:&lt;/strong&gt;
- &lt;input type="checkbox" name="crud" value="u" checked&gt;&lt;br&gt;
- &lt;strong&gt;Destroy privileges allowed:&lt;/strong&gt;
- &lt;input type="checkbox" name="crud" value="d" checked&gt;&lt;br&gt;
- &lt;input type="submit" value="Enable Privileges"&gt;
-&lt;/form&gt;
-</pre>
- Which renders as...
- </p>
- <p>
- <form class="demo">
- <strong>Create privileges allowed:</strong>
- <input type="checkbox" name="crud" value="c" checked>
-<br>
- <strong>Retrieve privileges allowed:</strong>
- <input type="checkbox" name="crud" value="r" checked>
-<br>
- <strong>Update privileges allowed:</strong>
- <input type="checkbox" name="crud" value="u" checked>
-<br>
- <strong>Destroy privileges allowed:</strong>
- <input type="checkbox" name="crud" value="d" checked>
-<br>
- <input type="submit" value="Enable Privileges">
- </form>
- </p>
- <p>
- If we wish to disable all but the retrieval privileges and
- submit this information we can do it like this...
-<pre>
-class SimpleFormTests extends WebTestCase {
- ...<strong>
- function testDisableNastyPrivileges() {
- $this-&gt;get('http://www.lastcraft.com/form_testing_documentation.php');
- $this-&gt;assertField('crud', array('c', 'r', 'u', 'd'));
- $this-&gt;setField('crud', array('r'));
- $this-&gt;click('Enable Privileges');
- }</strong>
-}
-</pre>
- Instead of setting the field to a single value, we give it a list
- of values.
- We do the same when testing expected values.
- We can then write other test code to confirm the effect of this, perhaps
- by logging in as that user and attempting an update.
- </p>
- <p>
- <a class="target" name="raw">
-<h2>Raw posting</h2>
-</a>
- </p>
- <p>
- If you want to test a form handler, but have not yet written
- or do not have access to the form itself, you can create a
- form submission by hand.
-<pre>
-class SimpleFormTests extends WebTestCase {
- ...<strong>
- function testAttemptedHack() {
- $this-&gt;post(
- 'http://www.my-site.com/add_user.php',
- array('type' =&gt; 'superuser'));
- $this-&gt;assertNoText('user created');
- }</strong>
-}
-</pre>
- By adding data to the <span class="new_code">WebTestCase::post()</span>
- method, we are attempting to fetch the page as a form submission.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/group_test_documentation.html b/tests/test_tools/simpletest/docs/en/group_test_documentation.html
deleted file mode 100755
index 1e14d31e..00000000
--- a/tests/test_tools/simpletest/docs/en/group_test_documentation.html
+++ /dev/null
@@ -1,354 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>SimpleTest for PHP group test documentation</title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<span class="chosen">Group tests</span>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Group Test documentation</h1>
-<div class="content">
- <p>
-<a class="target" name="group">
-<h2>Grouping tests</h2>
-</a>
-</p>
- <p>
- To run test cases as part of a group the test cases should really
- be placed in files without the runner code...
-<pre>
-<strong>&lt;?php
- require_once('../classes/io.php');
-
- class FileTester extends UnitTestCase {
- ...
- }
-
- class SocketTester extends UnitTestCase {
- ...
- }
-?&gt;</strong>
-</pre>
- As many cases as needed can appear in a single file.
- They should include any code they need, such as the library
- being tested, but none of the simple test libraries.
- </p>
- <p>
- If you have extended any test cases, you can include them
- as well.
-<pre>
-&lt;?php
- require_once('../classes/io.php');
-<strong>
- class MyFileTestCase extends UnitTestCase {
- ...
- }
- SimpleTest::ignore('MyFileTestCase');</strong>
-
- class FileTester extends MyFileTestCase {
- ...
- }
-
- class SocketTester extends UnitTestCase {
- ...
- }
-?&gt;
-</pre>
- The <span class="new_code">FileTester</span> class does
- not contain any actual tests, but is a base class for other
- test cases.
- For this reason we use the
- <span class="new_code">SimpleTestOptions::ignore()</span> directive
- to tell the upcoming group test to ignore it.
- This directive can appear anywhere in the file and works
- when a whole file of test cases is loaded (see below).
- We will call this sample <em>file_test.php</em>.
- </p>
- <p>
- Next we create a group test file, called say <em>group_test.php</em>.
- You will think of a better name I am sure.
- We will add the test file using a safe method...
-<pre>
-&lt;?php
- require_once('simpletest/unit_tester.php');
- require_once('simpletest/reporter.php');<strong>
- require_once('file_test.php');
-
- $test = &amp;new GroupTest('All file tests');
- $test-&gt;addTestCase(new FileTestCase());
- $test-&gt;run(new HtmlReporter());</strong>
-?&gt;
-</pre>
- This instantiates the test case before the test suite is
- run.
- This could get a little expensive with a large number of test
- cases, so another method is provided that will only
- instantiate the class when it is needed...
-<pre>
-&lt;?php
- require_once('simpletest/unit_tester.php');
- require_once('simpletest/reporter.php');
- require_once('file_test.php');
-
- $test = &amp;new GroupTest('All file tests');<strong>
- $test-&gt;addTestClass('FileTestCase');</strong>
- $test-&gt;run(new HtmlReporter());
-?&gt;
-</pre>
- The problem with this method is that for every test case
- that we add we will have
- to <span class="new_code">require_once()</span> the test code
- file and manually instantiate each and every test case.
- We can save a lot of typing with...
-<pre>
-&lt;?php
- require_once('simpletest/unit_tester.php');
- require_once('simpletest/reporter.php');
-
- $test = &amp;new GroupTest('All file tests');<strong>
- $test-&gt;addTestFile('file_test.php');</strong>
- $test-&gt;run(new HtmlReporter());
-?&amp;gt;
-</pre>
- What happens here is that the <span class="new_code">GroupTest</span>
- class has done the <span class="new_code">require_once()</span>
- for us.
- It then checks to see if any new test case classes
- have been created by the new file and automatically adds
- them to the group test.
- Now all we have to do is add each new file.
- </p>
- <p>
- There are two things that could go wrong and which require care...
- <ol>
- <li>
- The file could already have been parsed by PHP and so no
- new classes will have been added. You should make
- sure that the test cases are only included in this file
- and no others.
- </li>
- <li>
- New test case extension classes that get included will be
- placed in the group test and run also.
- You will need to add a <span class="new_code">SimpleTestOptions::ignore()</span>
- directive for these classes or make sure that they are included
- before the <span class="new_code">GroupTest::addTestFile()</span>
- line.
- </li>
- </ol>
- </p>
-
- <p>
-<a class="target" name="higher">
-<h2>Higher groupings</h2>
-</a>
-</p>
- <p>
- The above method places all of the test cases into one large group.
- For larger projects though this may not be flexible enough; you
- may want to group the tests in all sorts of ways.
- </p>
- <p>
- To get a more flexible group test we can subclass
- <span class="new_code">GroupTest</span> and then instantiate it as needed...
-<pre>
-&lt;?php
- require_once('simpletest/unit_tester.php');
- require_once('simpletest/reporter.php');
- <strong>
- class FileGroupTest extends GroupTest {
- function FileGroupTest() {
- $this-&gt;GroupTest('All file tests');
- $this-&gt;addTestFile('file_test.php');
- }
- }</strong>
-?&gt;
-</pre>
- This effectively names the test in the constructor and then
- adds our test cases and a single group below.
- Of course we can add more than one group at this point.
- We can now invoke the tests from a separate runner file...
-<pre>
-&lt;?php
- require_once('file_group_test.php');
- <strong>
- $test = &amp;new FileGroupTest();
- $test-&gt;run(new HtmlReporter());</strong>
-?&gt;
-</pre>
- ...or we can group them into even larger group tests...
-<pre>
-&lt;?php
- require_once('file_group_test.php');
- <strong>
- $test = &amp;new BigGroupTest('Big group');
- $test-&gt;addTestCase(new FileGroupTest());
- $test-&gt;addTestCase(...);
- $test-&gt;run(new HtmlReporter());</strong>
-?&gt;
-</pre>
- If we still wish to run the original group test and we
- don't want all of these little runner files, we can
- put the test runner code around guard bars when we create
- each group.
-<pre>
-&lt;?php
- class FileGroupTest extends GroupTest {
- function FileGroupTest() {
- $this-&gt;GroupTest('All file tests');
- $test-&gt;addTestFile('file_test.php');
- }
- }
- <strong>
- if (! defined('RUNNER')) {
- define('RUNNER', true);</strong>
- $test = &amp;new FileGroupTest();
- $test-&gt;run(new HtmlReporter());
- }
-?&gt;
-</pre>
- This approach requires the guard to be set when including
- the group test file, but this is still less hassle than
- lots of separate runner files.
- You include the same guard on the top level tests to make sure
- that <span class="new_code">run()</span> will run once only
- from the top level script that has been invoked.
-<pre>
-&lt;?php<strong>
- define('RUNNER', true);</strong>
- require_once('file_group_test.php');
-
- $test = &amp;new BigGroupTest('Big group');
- $test-&gt;addTestCase(new FileGroupTest());
- $test-&gt;addTestCase(...);
- $test-&gt;run(new HtmlReporter());
-?&gt;
-</pre>
- As with the normal test cases, a <span class="new_code">GroupTest</span> can
- be loaded with the <span class="new_code">GroupTest::addTestFile()</span> method.
-<pre>
-&lt;?php
- define('RUNNER', true);
-
- $test = &amp;new BigGroupTest('Big group');<strong>
- $test-&gt;addTestFile('file_group_test.php');
- $test-&gt;addTestFile(...);</strong>
- $test-&gt;run(new HtmlReporter());
-?&gt;
-</pre>
- </p>
-
- <p>
-<a class="target" name="legacy">
-<h2>Integrating legacy test cases</h2>
-</a>
-</p>
- <p>
- If you already have unit tests for your code or are extending external
- classes that have tests, it is unlikely that all of the test cases
- are in SimpleTest format.
- Fortunately it is possible to incorporate test cases from other
- unit testers directly into SimpleTest group tests.
- </p>
- <p>
- Say we have the following
- <a href="http://sourceforge.net/projects/phpunit">PhpUnit</a>
- test case in the file <em>config_test.php</em>...
-<pre>
-<strong>class ConfigFileTest extends TestCase {
- function ConfigFileTest() {
- $this-&gt;TestCase('Config file test');
- }
-
- function testContents() {
- $config = new ConfigFile('test.conf');
- $this-&gt;assertRegexp('/me/', $config-&gt;getValue('username'));
- }
-}</strong>
-</pre>
- The group test can recognise this as long as we include
- the appropriate adapter class before we add the test
- file...
-<pre>
-&lt;?php
- require_once('simpletest/unit_tester.php');
- require_once('simpletest/reporter.php');<strong>
- require_once('simpletest/adapters/phpunit_test_case.php');</strong>
-
- $test = &amp;new GroupTest('All file tests');<strong>
- $test-&gt;addTestFile('config_test.php');</strong>
- $test-&gt;run(new HtmlReporter());
-?&gt;
-</pre>
- There are only two adapters, the other is for the
- <a href="http://pear.php.net/manual/en/package.php.phpunit.php">PEAR</a>
- 1.0 unit tester...
-<pre>
-&lt;?php
- require_once('simpletest/unit_tester.php');
- require_once('simpletest/reporter.php');<strong>
- require_once('simpletest/adapters/pear_test_case.php');</strong>
-
- $test = &amp;new GroupTest('All file tests');<strong>
- $test-&gt;addTestFile('some_pear_test_cases.php');</strong>
- $test-&gt;run(new HtmlReporter());
-?&gt;
-</pre>
- The PEAR test cases can be freely mixed with SimpleTest
- ones even in the same test file,
- but you cannot use SimpleTest assertions in the legacy
- test case versions.
- This is done as a check that you are not accidently making
- your test cases completely dependent on SimpleTest.
- You may want to do a PEAR release of your library for example
- which would mean shipping it with valid PEAR::PhpUnit test
- cases.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/index.html b/tests/test_tools/simpletest/docs/en/index.html
deleted file mode 100755
index c7183c49..00000000
--- a/tests/test_tools/simpletest/docs/en/index.html
+++ /dev/null
@@ -1,461 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>
- Download the Simple Test testing framework -
- Unit tests and mock objects for PHP
- </title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<span class="chosen">SimpleTest</span>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Simple Test for PHP</h1>
-<div class="content">
-
-
- <p>
- The following assumes that you are familiar with the concept
- of unit testing as well as the PHP web development language.
- It is a guide for the impatient new user of
- <a href="https://sourceforge.net/project/showfiles.php?group_id=76550">SimpleTest</a>.
- For fuller documentation, especially if you are new
- to unit testing see the ongoing
- <a href="unit_test_documentation.html">documentation</a>, and for
- example test cases see the
- <a href="http://www.lastcraft.com/first_test_tutorial.php">unit testing tutorial</a>.
- </p>
-
- <p>
-<a class="target" name="unit">
-<h2>Using the tester quickly</h2>
-</a>
-</p>
- <p>
- Amongst software testing tools, a unit tester is the one
- closest to the developer.
- In the context of agile development the test code sits right
- next to the source code as both are written simultaneously.
- In this context SimpleTest aims to be a complete PHP developer
- test solution and is called "Simple" because it
- should be easy to use and extend.
- It wasn't a good choice of name really.
- It includes all of the typical functions you would expect from
- <a href="http://www.junit.org/">JUnit</a> and the
- <a href="http://sourceforge.net/projects/phpunit/">PHPUnit</a>
- ports, but also adds
- <a href="http://www.mockobjects.com">mock objects</a>.
- It has some <a href="http://sourceforge.net/projects/jwebunit/">JWebUnit</a>
- functionality as well.
- This includes web page navigation, cookie testing and form submission.
- </p>
- <p>
- The quickest way to demonstrate is with an example.
- </p>
- <p>
- Let us suppose we are testing a simple file logging class called
- <span class="new_code">Log</span> in <em>classes/log.php</em>.
- We start by creating a test script which we will call
- <em>tests/log_test.php</em> and populate it as follows...
-<pre>
-&lt;?php<strong>
-require_once('simpletest/unit_tester.php');
-require_once('simpletest/reporter.php');
-require_once('../classes/log.php');
-
-class TestOfLogging extends UnitTestCase {
-}</strong>
-?&gt;
-</pre>
- Here the <em>simpletest</em> folder is either local or in the path.
- You would have to edit these locations depending on where you
- placed the toolset.
- The <span class="new_code">TestOfLogging</span> is our frst test case and it's
- currently empty.
- </p>
- <p>
- Now we have five lines of scaffolding code and still no tests.
- However from this part on we get return on our investment very quickly.
- We'll assume that the <span class="new_code">Log</span> class
- takes the file name to write to in the constructor and we have
- a temporary folder in which to place this file...
-<pre>
-&lt;?php
-require_once('simpletest/unit_tester.php');
-require_once('simpletest/reporter.php');
-require_once('../classes/log.php');
-
-class TestOfLogging extends UnitTestCase {
- <strong>
- function testCreatingNewFile() {
- @unlink('/temp/test.log');
- $log = new Log('/temp/test.log');
- $this-&gt;assertFalse(file_exists('/temp/test.log'));
- $log-&gt;message('Should write this to a file');
- $this-&gt;assertTrue(file_exists('/temp/test.log'));
- }</strong>
-}
-?&gt;
-</pre>
- When a test case runs it will search for any method that
- starts with the string <span class="new_code">test</span>
- and execute that method.
- We would normally have more than one test method of course.
- Assertions within the test methods trigger messages to the
- test framework which displays the result immediately.
- This immediate response is important, not just in the event
- of the code causing a crash, but also so that
- <span class="new_code">print</span> statements can display
- their content right next to the test case concerned.
- </p>
- <p>
- To see these results we have to actually run the tests.
- If this is the only test case we wish to run we can achieve
- it with...
-<pre>
-&lt;?php
-require_once('simpletest/unit_tester.php');
-require_once('simpletest/reporter.php');
-require_once('../classes/log.php');
-
-class TestOfLogging extends UnitTestCase {
-
- function testCreatingNewFile() {
- @unlink('/temp/test.log');
- $log = new Log('/temp/test.log');
- $this-&gt;assertFalse(file_exists('/temp/test.log'));
- $log-&gt;message('Should write this to a file');
- $this-&gt;assertTrue(file_exists('/temp/test.log'));
- }
-}
-<strong>
-$test = &amp;new TestOfLogging();
-$test-&gt;run(new HtmlReporter());</strong>
-?&gt;
-</pre>
- </p>
- <p>
- On failure the display looks like this...
- <div class="demo">
- <h1>testoflogging</h1>
- <span class="fail">Fail</span>: testcreatingnewfile-&gt;True assertion failed.<br>
- <div style="padding: 8px; margin-top: 1em; background-color: red; color: white;">1/1 test cases complete.
- <strong>1</strong> passes and <strong>1</strong> fails.</div>
- </div>
- ...and if it passes like this...
- <div class="demo">
- <h1>testoflogging</h1>
- <div style="padding: 8px; margin-top: 1em; background-color: green; color: white;">1/1 test cases complete.
- <strong>2</strong> passes and <strong>0</strong> fails.</div>
- </div>
- And if you get this...
- <div class="demo">
- <b>Fatal error</b>: Failed opening required '../classes/log.php' (include_path='') in <b>/home/marcus/projects/lastcraft/tutorial_tests/Log/tests/log_test.php</b> on line <b>7</b>
- </div>
- it means you're missing the <em>classes/Log.php</em> file that could look like...
-<pre>
-&lt;?php
-class Log {
-
- function Log($file_path) {
- }
-
- function message() {
- }
-}
-?&gt;;
-</pre>
- </p>
-
- <p>
-<a class="target" name="group">
-<h2>Building group tests</h2>
-</a>
-</p>
- <p>
- It is unlikely in a real application that we will only ever run
- one test case.
- This means that we need a way of grouping cases into a test
- script that can, if need be, run every test in the application.
- </p>
- <p>
- Our first step is to strip the includes and to undo our
- previous hack...
-<pre>
-&lt;?php<strong>
-require_once('../classes/log.php');</strong>
-
-class TestOfLogging extends UnitTestCase {
-
- function testCreatingNewFile() {
- @unlink('/temp/test.log');
- $log = new Log('/temp/test.log');
- $this-&gt;assertFalse(file_exists('/temp/test.log'));
- $log-&gt;message('Should write this to a file');
- $this-&gt;assertTrue(file_exists('/temp/test.log'));<strong>
- }
-}
-?&gt;</strong>
-</pre>
- Next we create a new file called <em>tests/all_tests.php</em>
- and insert the following code...
-<pre>
-<strong>&lt;?php
-require_once('simpletest/unit_tester.php');
-require_once('simpletest/reporter.php');
-
-$test = &amp;new GroupTest('All tests');
-$test-&gt;addTestFile('log_test.php');
-$test-&gt;run(new HtmlReporter());
-?&gt;</strong>
-</pre>
- The method <span class="new_code">GroupTest::addTestFile()</span>
- will include the test case file and read any new classes created
- that are descended from <span class="new_code">SimpleTestCase</span>, of which
- <span class="new_code">UnitTestCase</span> is one example.
- Just the class names are stored for now, so that the test runner
- can instantiate the class when it works its way
- through your test suite.
- </p>
- <p>
- For this to work properly the test case file should not blindly include
- any other test case extensions that do not actually run tests.
- This could result in extra test cases being counted during the test
- run.
- Hardly a major problem, but to avoid this inconvenience simply add
- a <span class="new_code">SimpleTestOptions::ignore()</span> directive
- somewhere in the test case file.
- Also the test case file should not have been included
- elsewhere or no cases will be added to this group test.
- This would be a more serious error as if the test case classes are
- already loaded by PHP the <span class="new_code">GroupTest::addTestFile()</span>
- method will not detect them.
- </p>
- <p>
- To display the results it is necessary only to invoke
- <em>tests/all_tests.php</em> from the web server.
- </p>
-
- <p>
-<a class="target" name="mock">
-<h2>Using mock objects</h2>
-</a>
-</p>
- <p>
- Let's move further into the future.
- </p>
- <p>
- Assume that our logging class is tested and completed.
- Assume also that we are testing another class that is
- required to write log messages, say a
- <span class="new_code">SessionPool</span>.
- We want to test a method that will probably end up looking
- like this...
-<pre>
-<strong>
-class SessionPool {
- ...
- function logIn($username) {
- ...
- $this-&gt;_log-&gt;message("User $username logged in.");
- ...
- }
- ...
-}
-</strong>
-</pre>
- In the spirit of reuse we are using our
- <span class="new_code">Log</span> class.
- A conventional test case might look like this...
-<pre>
-<strong>
-&lt;?php
-require_once('../classes/log.php');
-require_once('../classes/session_pool.php');
-
-class TestOfSessionLogging extends UnitTestCase {
-
- function setUp() {
- @unlink('/temp/test.log');
- }
-
- function tearDown() {
- @unlink('/temp/test.log');
- }
-
- function testLogInIsLogged() {
- $log = new Log('/temp/test.log');
- $session_pool = &amp;new SessionPool($log);
- $session_pool-&gt;logIn('fred');
- $messages = file('/temp/test.log');
- $this-&gt;assertEqual($messages[0], "User fred logged in.\n");
- }
-}
-?&gt;</strong>
-</pre>
- This test case design is not all bad, but it could be improved.
- We are spending time fiddling with log files which are
- not part of our test. Worse, we have created close ties
- with the <span class="new_code">Log</span> class and
- this test.
- What if we don't use files any more, but use ths
- <em>syslog</em> library instead?
- Did you notice the extra carriage return in the message?
- Was that added by the logger?
- What if it also added a time stamp or other data?
- </p>
- <p>
- The only part that we really want to test is that a particular
- message was sent to the logger.
- We reduce coupling if we can pass in a fake logging class
- that simply records the message calls for testing, but
- takes no action.
- It would have to look exactly like our original though.
- </p>
- <p>
- If the fake object doesn't write to a file then we save on deleting
- the file before and after each test. We could save even more
- test code if the fake object would kindly run the assertion for us.
- <p>
- </p>
- Too good to be true?
- Luckily we can create such an object easily...
-<pre>
-&lt;?php
-require_once('../classes/log.php');
-require_once('../classes/session_pool.php');<strong>
-Mock::generate('Log');</strong>
-
-class TestOfSessionLogging extends UnitTestCase {
-
- function testLogInIsLogged() {<strong>
- $log = &amp;new MockLog();
- $log-&gt;expectOnce('message', array('User fred logged in.'));</strong>
- $session_pool = &amp;new SessionPool($log);
- $session_pool-&gt;logIn('fred');
- }
-}
-?&gt;
-</pre>
- The test will be triggered when the call to
- <span class="new_code">message()</span> is invoked on the
- <span class="new_code">MockLog</span> object.
- The mock call will trigger a parameter comparison and then send the
- resulting pass or fail event to the test display.
- Wildcards can be included here too so as to prevent tests
- becoming too specific.
- </p>
- <p>
- If the mock reaches the end of the test case without the
- method being called, the <span class="new_code">expectOnce()</span>
- expectation will trigger a test failure.
- In other words the mocks can detect the absence of
- behaviour as well as the presence.
- </p>
- <p>
- The mock objects in the SimpleTest suite can have arbitrary
- return values set, sequences of returns, return values
- selected according to the incoming arguments, sequences of
- parameter expectations and limits on the number of times
- a method is to be invoked.
- </p>
- <p>
- For this test to run the mock objects library must have been
- included in the test suite, say in <em>all_tests.php</em>.
- </p>
-
- <p>
-<a class="target" name="web">
-<h2>Web page testing</h2>
-</a>
-</p>
- <p>
- One of the requirements of web sites is that they produce web
- pages.
- If you are building a project top-down and you want to fully
- integrate testing along the way then you will want a way of
- automatically navigating a site and examining output for
- correctness.
- This is the job of a web tester.
- </p>
- <p>
- The web testing in SimpleTest is fairly primitive, there is
- no JavaScript for example.
- To give an idea here is a trivial example where a home
- page is fetched, from which we navigate to an "about"
- page and then test some client determined content.
-<pre>
-&lt;?php<strong>
-require_once('simpletest/web_tester.php');</strong>
-require_once('simpletest/reporter.php');
-<strong>
-class TestOfAbout extends WebTestCase {
-
- function setUp() {
- $this-&gt;get('http://test-server/index.php');
- $this-&gt;click('About');
- }
-
- function testSearchEngineOptimisations() {
- $this-&gt;assertTitle('A long title about us for search engines');
- $this-&gt;assertPattern('/a popular keyphrase/i');
- }
-}</strong>
-$test = &amp;new TestOfAbout();
-$test-&gt;run(new HtmlReporter());
-?&gt;
-</pre>
- With this code as an acceptance test you can ensure that
- the content always meets the specifications of both the
- developers and the other project stakeholders.
- </p>
- <p>
- <a href="http://sourceforge.net/projects/simpletest/"><img src="http://sourceforge.net/sflogo.php?group_id=76550&amp;type=5" width="210" height="62" border="0" alt="SourceForge.net Logo"></a>
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/mock_objects_documentation.html b/tests/test_tools/simpletest/docs/en/mock_objects_documentation.html
deleted file mode 100755
index eb32c619..00000000
--- a/tests/test_tools/simpletest/docs/en/mock_objects_documentation.html
+++ /dev/null
@@ -1,727 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>SimpleTest for PHP mock objects documentation</title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<span class="chosen">Mock objects</span>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Mock objects documentation</h1>
-<div class="content">
- <p>
-<a class="target" name="what">
-<h2>What are mock objects?</h2>
-</a>
-</p>
- <p>
- Mock objects have two roles during a test case: actor and critic.
- </p>
- <p>
- The actor behaviour is to simulate objects that are difficult to
- set up or time consuming to set up for a test.
- The classic example is a database connection.
- Setting up a test database at the start of each test would slow
- testing to a crawl and would require the installation of the
- database engine and test data on the test machine.
- If we can simulate the connection and return data of our
- choosing we not only win on the pragmatics of testing, but can
- also feed our code spurious data to see how it responds.
- We can simulate databases being down or other extremes
- without having to create a broken database for real.
- In other words, we get greater control of the test environment.
- </p>
- <p>
- If mock objects only behaved as actors they would simply be
- known as server stubs.
- This was originally a pattern named by Robert Binder (Testing
- object-oriented systems: models, patterns, and tools,
- Addison-Wesley) in 1999.
- </p>
- <p>
- A server stub is a simulation of an object or component.
- It should exactly replace a component in a system for test
- or prototyping purposes, but remain lightweight.
- This allows tests to run more quickly, or if the simulated
- class has not been written, to run at all.
- </p>
- <p>
- However, the mock objects not only play a part (by supplying chosen
- return values on demand) they are also sensitive to the
- messages sent to them (via expectations).
- By setting expected parameters for a method call they act
- as a guard that the calls upon them are made correctly.
- If expectations are not met they save us the effort of
- writing a failed test assertion by performing that duty on our
- behalf.
- </p>
- <p>
- In the case of an imaginary database connection they can
- test that the query, say SQL, was correctly formed by
- the object that is using the connection.
- Set them up with fairly tight expectations and you will
- hardly need manual assertions at all.
- </p>
-
- <p>
-<a class="target" name="creation">
-<h2>Creating mock objects</h2>
-</a>
-</p>
- <p>
- In the same way that we create server stubs, all we need is an
- existing class, say a database connection that looks like this...
-<pre>
-<strong>class DatabaseConnection {
- function DatabaseConnection() {
- }
-
- function query() {
- }
-
- function selectQuery() {
- }
-}</strong>
-</pre>
- The class does not need to have been implemented yet.
- To create a mock version of the class we need to include the
- mock object library and run the generator...
-<pre>
-<strong>require_once('simpletest/unit_tester.php');
-require_once('simpletest/mock_objects.php');
-require_once('database_connection.php');
-
-Mock::generate('DatabaseConnection');</strong>
-</pre>
- This generates a clone class called
- <span class="new_code">MockDatabaseConnection</span>.
- We can now create instances of the new class within
- our test case...
-<pre>
-require_once('simpletest/unit_tester.php');
-require_once('simpletest/mock_objects.php');
-require_once('database_connection.php');
-
-Mock::generate('DatabaseConnection');
-<strong>
-class MyTestCase extends UnitTestCase {
-
- function testSomething() {
- $connection = &amp;new MockDatabaseConnection();
- }
-}</strong>
-</pre>
- Unlike the generated stubs the mock constructor needs a reference
- to the test case so that it can dispatch passes and failures while
- checking its expectations.
- This means that mock objects can only be used within test cases.
- Despite this their extra power means that stubs are hardly ever used
- if mocks are available.
- </p>
- <p>
- <a class="target" name="stub">
-<h2>Mocks as actors</h2>
-</a>
- </p>
- <p>
- The mock version of a class has all the methods of the original,
- so that operations like
- <span class="new_code">$connection-&gt;query()</span> are still
- legal.
- The return value will be <span class="new_code">null</span>,
- but we can change that with...
-<pre>
-<strong>$connection-&gt;setReturnValue('query', 37)</strong>
-</pre>
- Now every time we call
- <span class="new_code">$connection-&gt;query()</span> we get
- the result of 37.
- We can set the return value to anything, say a hash of
- imaginary database results or a list of persistent objects.
- Parameters are irrelevant here, we always get the same
- values back each time once they have been set up this way.
- That may not sound like a convincing replica of a
- database connection, but for the half a dozen lines of
- a test method it is usually all you need.
- </p>
- <p>
- We can also add extra methods to the mock when generating it
- and choose our own class name...
-<pre>
-<strong>Mock::generate('DatabaseConnection', 'MyMockDatabaseConnection', array('setOptions'));</strong>
-</pre>
- Here the mock will behave as if the <span class="new_code">setOptions()</span>
- existed in the original class.
- This is handy if a class has used the PHP <span class="new_code">overload()</span>
- mechanism to add dynamic methods.
- You can create a special mock to simulate this situation.
- </p>
- <p>
- Things aren't always that simple though.
- One common problem is iterators, where constantly returning
- the same value could cause an endless loop in the object
- being tested.
- For these we need to set up sequences of values.
- Let's say we have a simple iterator that looks like this...
-<pre>
-class Iterator {
- function Iterator() {
- }
-
- function next() {
- }
-}
-</pre>
- This is about the simplest iterator you could have.
- Assuming that this iterator only returns text until it
- reaches the end, when it returns false, we can simulate it
- with...
-<pre>
-Mock::generate('Iterator');
-
-class IteratorTest extends UnitTestCase() {
-
- function testASequence() {<strong>
- $iterator = &amp;new MockIterator();
- $iterator-&gt;setReturnValue('next', false);
- $iterator-&gt;setReturnValueAt(0, 'next', 'First string');
- $iterator-&gt;setReturnValueAt(1, 'next', 'Second string');</strong>
- ...
- }
-}
-</pre>
- When <span class="new_code">next()</span> is called on the
- mock iterator it will first return "First string",
- on the second call "Second string" will be returned
- and on any other call <span class="new_code">false</span> will
- be returned.
- The sequenced return values take precedence over the constant
- return value.
- The constant one is a kind of default if you like.
- </p>
- <p>
- Another tricky situation is an overloaded
- <span class="new_code">get()</span> operation.
- An example of this is an information holder with name/value pairs.
- Say we have a configuration class like...
-<pre>
-class Configuration {
- function Configuration() {
- }
-
- function getValue($key) {
- }
-}
-</pre>
- This is a classic situation for using mock objects as
- actual configuration will vary from machine to machine,
- hardly helping the reliability of our tests if we use it
- directly.
- The problem though is that all the data comes through the
- <span class="new_code">getValue()</span> method and yet
- we want different results for different keys.
- Luckily the mocks have a filter system...
-<pre>
-<strong>$config = &amp;new MockConfiguration();
-$config-&gt;setReturnValue('getValue', 'primary', array('db_host'));
-$config-&gt;setReturnValue('getValue', 'admin', array('db_user'));
-$config-&gt;setReturnValue('getValue', 'secret', array('db_password'));</strong>
-</pre>
- The extra parameter is a list of arguments to attempt
- to match.
- In this case we are trying to match only one argument which
- is the look up key.
- Now when the mock object has the
- <span class="new_code">getValue()</span> method invoked
- like this...
-<pre>
-$config-&gt;getValue('db_user')
-</pre>
- ...it will return "admin".
- It finds this by attempting to match the calling arguments
- to its list of returns one after another until
- a complete match is found.
- </p>
- <p>
- You can set a default argument argument like so...
-<pre>
-<strong>
-$config-&gt;setReturnValue('getValue', false, array('*'));</strong>
-</pre>
- This is not the same as setting the return value without
- any argument requirements like this...
-<pre>
-<strong>
-$config-&gt;setReturnValue('getValue', false);</strong>
-</pre>
- In the first case it will accept any single argument,
- but exactly one is required.
- In the second case any number of arguments will do and
- it acts as a catchall after all other matches.
- Note that if we add further single parameter options after
- the wildcard in the first case, they will be ignored as the wildcard
- will match first.
- With complex parameter lists the ordering could be important
- or else desired matches could be masked by earlier wildcard
- ones.
- Declare the most specific matches first if you are not sure.
- </p>
- <p>
- There are times when you want a specific object to be
- dished out by the mock rather than a copy.
- The PHP4 copy semantics force us to use a different method
- for this.
- You might be simulating a container for example...
-<pre>
-class Thing {
-}
-
-class Vector {
- function Vector() {
- }
-
- function get($index) {
- }
-}
-</pre>
- In this case you can set a reference into the mock's
- return list...
-<pre>
-$thing = &amp;new Thing();<strong>
-$vector = &amp;new MockVector();
-$vector-&gt;setReturnReference('get', $thing, array(12));</strong>
-</pre>
- With this arrangement you know that every time
- <span class="new_code">$vector-&gt;get(12)</span> is
- called it will return the same
- <span class="new_code">$thing</span> each time.
- This is compatible with PHP5 as well.
- </p>
- <p>
- These three factors, timing, parameters and whether to copy,
- can be combined orthogonally.
- For example...
-<pre>
-$complex = &amp;new MockComplexThing();
-$stuff = &amp;new Stuff();<strong>
-$complex-&gt;setReturnReferenceAt(3, 'get', $stuff, array('*', 1));</strong>
-</pre>
- This will return the <span class="new_code">$stuff</span> only on the third
- call and only if two parameters were set the second of
- which must be the integer 1.
- That should cover most simple prototyping situations.
- </p>
- <p>
- A final tricky case is one object creating another, known
- as a factory pattern.
- Suppose that on a successful query to our imaginary
- database, a result set is returned as an iterator with
- each call to <span class="new_code">next()</span> giving
- one row until false.
- This sounds like a simulation nightmare, but in fact it can all
- be mocked using the mechanics above.
- </p>
- <p>
- Here's how...
-<pre>
-Mock::generate('DatabaseConnection');
-Mock::generate('ResultIterator');
-
-class DatabaseTest extends UnitTestCase {
-
- function testUserFinder() {<strong>
- $result = &amp;new MockResultIterator();
- $result-&gt;setReturnValue('next', false);
- $result-&gt;setReturnValueAt(0, 'next', array(1, 'tom'));
- $result-&gt;setReturnValueAt(1, 'next', array(3, 'dick'));
- $result-&gt;setReturnValueAt(2, 'next', array(6, 'harry'));
-
- $connection = &amp;new MockDatabaseConnection();
- $connection-&gt;setReturnValue('query', false);
- $connection-&gt;setReturnReference(
- 'query',
- $result,
- array('select id, name from users'));</strong>
-
- $finder = &amp;new UserFinder($connection);
- $this-&gt;assertIdentical(
- $finder-&gt;findNames(),
- array('tom', 'dick', 'harry'));
- }
-}
-</pre>
- Now only if our
- <span class="new_code">$connection</span> is called with the correct
- <span class="new_code">query()</span> will the
- <span class="new_code">$result</span> be returned that is
- itself exhausted after the third call to <span class="new_code">next()</span>.
- This should be enough
- information for our <span class="new_code">UserFinder</span> class,
- the class actually
- being tested here, to come up with goods.
- A very precise test and not a real database in sight.
- </p>
-
- <p>
-<a class="target" name="expectations">
-<h2>Mocks as critics</h2>
-</a>
-</p>
- <p>
- Although the server stubs approach insulates your tests from
- real world disruption, it is only half the benefit.
- You can have the class under test receiving the required
- messages, but is your new class sending correct ones?
- Testing this can get messy without a mock objects library.
- </p>
- <p>
- By way of example, suppose we have a
- <span class="new_code">SessionPool</span> class that we
- want to add logging to.
- Rather than grow the original class into something more
- complicated, we want to add this behaviour with a decorator (GOF).
- The <span class="new_code">SessionPool</span> code currently looks
- like this...
-<pre>
-<strong>class SessionPool {
- function SessionPool() {
- ...
- }
-
- function &amp;findSession($cookie) {
- ...
- }
- ...
-}
-
-class Session {
- ...
-}</strong>
-&lt;/php&gt;
- While our logging code looks like this...
-&lt;php&gt;<strong>
-class Log {
- function Log() {
- ...
- }
-
- function message() {
- ...
- }
-}
-
-class LoggingSessionPool {
- function LoggingSessionPool(&amp;$session_pool, &amp;$log) {
- ...
- }
-
- function &amp;findSession(\$cookie) {
- ...
- }
- ...
-}</strong>
-</pre>
- Out of all of this, the only class we want to test here
- is the <span class="new_code">LoggingSessionPool</span>.
- In particular we would like to check that the
- <span class="new_code">findSession()</span> method is
- called with the correct session ID in the cookie and that
- it sent the message "Starting session $cookie"
- to the logger.
- </p>
- <p>
- Despite the fact that we are testing only a few lines of
- production code, here is what we would have to do in a
- conventional test case:
- <ol>
- <li>Create a log object.</li>
- <li>Set a directory to place the log file.</li>
- <li>Set the directory permissions so we can write the log.</li>
- <li>Create a <span class="new_code">SessionPool</span> object.</li>
- <li>Hand start a session, which probably does lot's of things.</li>
- <li>Invoke <span class="new_code">findSession()</span>.</li>
- <li>Read the new Session ID (hope there is an accessor!).</li>
- <li>Raise a test assertion to confirm that the ID matches the cookie.</li>
- <li>Read the last line of the log file.</li>
- <li>Pattern match out the extra logging timestamps, etc.</li>
- <li>Assert that the session message is contained in the text.</li>
- </ol>
- It is hardly surprising that developers hate writing tests
- when they are this much drudgery.
- To make things worse, every time the logging format changes or
- the method of creating new sessions changes, we have to rewrite
- parts of this test even though this test does not officially
- test those parts of the system.
- We are creating headaches for the writers of these other classes.
- </p>
- <p>
- Instead, here is the complete test method using mock object magic...
-<pre>
-Mock::generate('Session');
-Mock::generate('SessionPool');
-Mock::generate('Log');
-
-class LoggingSessionPoolTest extends UnitTestCase {
- ...
- function testFindSessionLogging() {<strong>
- $session = &amp;new MockSession();
- $pool = &amp;new MockSessionPool();
- $pool-&gt;setReturnReference('findSession', $session);
- $pool-&gt;expectOnce('findSession', array('abc'));
-
- $log = &amp;new MockLog();
- $log-&gt;expectOnce('message', array('Starting session abc'));
-
- $logging_pool = &amp;new LoggingSessionPool($pool, $log);
- $this-&gt;assertReference($logging_pool-&gt;findSession('abc'), $session);</strong>
- }
-}
-</pre>
- We start by creating a dummy session.
- We don't have to be too fussy about this as the check
- for which session we want is done elsewhere.
- We only need to check that it was the same one that came
- from the session pool.
- </p>
- <p>
- <span class="new_code">findSession()</span> is a factory
- method the simulation of which is described <a href="#stub">above</a>.
- The point of departure comes with the first
- <span class="new_code">expectOnce()</span> call.
- This line states that whenever
- <span class="new_code">findSession()</span> is invoked on the
- mock, it will test the incoming arguments.
- If it receives the single argument of a string "abc"
- then a test pass is sent to the unit tester, otherwise a fail is
- generated.
- This was the part where we checked that the right session was asked for.
- The argument list follows the same format as the one for setting
- return values.
- You can have wildcards and sequences and the order of
- evaluation is the same.
- </p>
- <p>
- We use the same pattern to set up the mock logger.
- We tell it that it should have
- <span class="new_code">message()</span> invoked
- once only with the argument "Starting session abc".
- By testing the calling arguments, rather than the logger output,
- we insulate the test from any display changes in the logger.
- </p>
- <p>
- We start to run our tests when we create the new
- <span class="new_code">LoggingSessionPool</span> and feed
- it our preset mock objects.
- Everything is now under our control.
- </p>
- <p>
- This is still quite a bit of test code, but the code is very
- strict.
- If it still seems rather daunting there is a lot less of it
- than if we tried this without mocks and this particular test,
- interactions rather than output, is always more work to set
- up.
- More often you will be testing more complex situations without
- needing this level or precision.
- Also some of this can be refactored into a test case
- <span class="new_code">setUp()</span> method.
- </p>
- <p>
- Here is the full list of expectations you can set on a mock object
- in <a href="http://www.lastcraft.com/simple_test.php">SimpleTest</a>...
- <table>
-<thead>
- <tr>
-<th>Expectation</th><th>Needs <span class="new_code">tally()</span></th>
-</tr>
- </thead>
-<tbody>
-<tr>
- <td><span class="new_code">expect($method, $args)</span></td>
- <td style="text-align: center">No</td>
- </tr>
- <tr>
- <td><span class="new_code">expectAt($timing, $method, $args)</span></td>
- <td style="text-align: center">No</td>
- </tr>
- <tr>
- <td><span class="new_code">expectCallCount($method, $count)</span></td>
- <td style="text-align: center">Yes</td>
- </tr>
- <tr>
- <td><span class="new_code">expectMaximumCallCount($method, $count)</span></td>
- <td style="text-align: center">No</td>
- </tr>
- <tr>
- <td><span class="new_code">expectMinimumCallCount($method, $count)</span></td>
- <td style="text-align: center">Yes</td>
- </tr>
- <tr>
- <td><span class="new_code">expectNever($method)</span></td>
- <td style="text-align: center">No</td>
- </tr>
- <tr>
- <td><span class="new_code">expectOnce($method, $args)</span></td>
- <td style="text-align: center">Yes</td>
- </tr>
- <tr>
- <td><span class="new_code">expectAtLeastOnce($method, $args)</span></td>
- <td style="text-align: center">Yes</td>
- </tr>
- </tbody>
-</table>
- Where the parameters are...
- <dl>
- <dt class="new_code">$method</dt>
- <dd>The method name, as a string, to apply the condition to.</dd>
- <dt class="new_code">$args</dt>
- <dd>
- The arguments as a list. Wildcards can be included in the same
- manner as for <span class="new_code">setReturn()</span>.
- This argument is optional for <span class="new_code">expectOnce()</span>
- and <span class="new_code">expectAtLeastOnce()</span>.
- </dd>
- <dt class="new_code">$timing</dt>
- <dd>
- The only point in time to test the condition.
- The first call starts at zero.
- </dd>
- <dt class="new_code">$count</dt>
- <dd>The number of calls expected.</dd>
- </dl>
- The method <span class="new_code">expectMaximumCallCount()</span>
- is slightly different in that it will only ever generate a failure.
- It is silent if the limit is never reached.
- </p>
- <p>
- Like the assertions within test cases, all of the expectations
- can take a message override as an extra parameter.
- Also the original failure message can be embedded in the output
- as "%s".
- </p>
-
- <p>
-<a class="target" name="approaches">
-<h2>Other approaches</h2>
-</a>
-</p>
- <p>
- There are three approaches to creating mocks including the one
- that SimpleTest employs.
- Coding them by hand using a base class, generating them to
- a file and dynamically generating them on the fly.
- </p>
- <p>
- Mock objects generated with <a href="simple_test.html">SimpleTest</a>
- are dynamic.
- They are created at run time in memory, using
- <span class="new_code">eval()</span>, rather than written
- out to a file.
- This makes the mocks easy to create, a one liner,
- especially compared with hand
- crafting them in a parallel class hierarchy.
- The problem is that the behaviour is usually set up in the tests
- themselves.
- If the original objects change the mock versions
- that the tests rely on can get out of sync.
- This can happen with the parallel hierarchy approach as well,
- but is far more quickly detected.
- </p>
- <p>
- The solution, of course, is to add some real integration
- tests.
- You don't need very many and the convenience gained
- from the mocks more than outweighs the small amount of
- extra testing.
- You cannot trust code that was only tested with mocks.
- </p>
- <p>
- If you are still determined to build static libraries of mocks
- because you want to simulate very specific behaviour, you can
- achieve the same effect using the SimpleTest class generator.
- In your library file, say <em>mocks/connection.php</em> for a
- database connection, create a mock and inherit to override
- special methods or add presets...
-<pre>
-&lt;?php
- require_once('simpletest/mock_objects.php');
- require_once('../classes/connection.php');
-<strong>
- Mock::generate('Connection', 'BasicMockConnection');
- class MockConnection extends BasicMockConnection {
- function MockConnection() {
- $this-&gt;BasicMockConnection();
- $this-&gt;setReturn('query', false);
- }
- }</strong>
-?&gt;
-</pre>
- The generate call tells the class generator to create
- a class called <span class="new_code">BasicMockConnection</span>
- rather than the usual <span class="new_code">MockConnection</span>.
- We then inherit from this to get our version of
- <span class="new_code">MockConnection</span>.
- By intercepting in this way we can add behaviour, here setting
- the default value of <span class="new_code">query()</span> to be false.
- By using the default name we make sure that the mock class
- generator will not recreate a different one when invoked elsewhere in the
- tests.
- It never creates a class if it already exists.
- As long as the above file is included first then all tests
- that generated <span class="new_code">MockConnection</span> should
- now be using our one instead.
- If we don't get the order right and the mock library
- creates one first then the class creation will simply fail.
- </p>
- <p>
- Use this trick if you find you have a lot of common mock behaviour
- or you are getting frequent integration problems at later
- stages of testing.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/overview.html b/tests/test_tools/simpletest/docs/en/overview.html
deleted file mode 100755
index 5d4e80e2..00000000
--- a/tests/test_tools/simpletest/docs/en/overview.html
+++ /dev/null
@@ -1,406 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>
- Overview and feature list for the SimpleTest PHP unit tester and web tester
- </title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<span class="chosen">Overview</span>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Overview of SimpleTest</h1>
-<div class="content">
- <p>
-<a class="target" name="summary">
-<h2>What is SimpleTest?</h2>
-</a>
-</p>
- <p>
- The heart of SimpleTest is a testing framework built around
- test case classes.
- These are written as extensions of base test case classes,
- each extended with methods that actually contain test code.
- Top level test scripts then invoke the <span class="new_code">run()</span>
- methods on every one of these test cases in order.
- Each test method is written to invoke various assertions that
- the developer expects to be true such as
- <span class="new_code">assertEqual()</span>.
- If the expectation is correct, then a successful result is dispatched to the
- observing test reporter, but any failure triggers an alert
- and a description of the mismatch.
- </p>
- <p>
- A <a href="unit_test_documentation.html">test case</a> looks like this...
-<pre>
-&lt;?php
-class <strong>MyTestCase</strong> extends UnitTestCase {
- <strong>
- function testLog() {
- $log = &amp;new Log('my.log');
- $log-&gt;message('Hello');
- $this-&gt;assertTrue(file_exists('my.log'));
- }</strong>
-}
-?&gt;
-</pre>
- </p>
- <p>
- These tools are designed for the developer.
- Tests are written in the PHP language itself more or less
- as the application itself is built.
- The advantage of using PHP itself as the testing language is that
- there are no new languages to learn, testing can start straight away,
- and the developer can test any part of the code.
- Basically, all parts that can be accessed by the application code can also be
- accessed by the test code if they are in the same language.
- </p>
- <p>
- The simplest type of test case is the
- <a href="unit_tester_documentation.html">UnitTestCase</a>.
- This class of test case includes standard tests for equality,
- references and pattern matching.
- All these test the typical expectations of what you would
- expect the result of a function or method to be.
- This is by far the most common type of test in the daily
- routine of development, making up about 95% of test cases.
- </p>
- <p>
- The top level task of a web application though is not to
- produce correct output from its methods and objects, but
- to generate web pages.
- The <a href="web_tester_documentation.html">WebTestCase</a> class tests web
- pages.
- It simulates a web browser requesting a page, complete with
- cookies, proxies, secure connections, authentication, forms, frames and most
- navigation elements.
- With this type of test case, the developer can assert that
- information is present in the page and that forms and
- sessions are handled correctly.
- </p>
- <p>
- A <a href="web_tester_documentation.html">WebTestCase</a> looks like this...
-<pre>
-&lt;?php
-class <strong>MySiteTest</strong> extends WebTestCase {
- <strong>
- function testHomePage() {
- $this-&gt;get('http://www.my-site.com/index.php');
- $this-&gt;assertTitle('My Home Page');
- $this-&gt;clickLink('Contact');
- $this-&gt;assertTitle('Contact me');
- $this-&gt;assertWantedPattern('/Email me at/');
- }</strong>
-}
-?&gt;
-</pre>
- </p>
-
- <p>
-<a class="target" name="features">
-<h2>Feature list</h2>
-</a>
-</p>
- <p>
- The following is a very rough outline of past and future features
- and their expected point of release.
- I am afraid it is liable to change without warning as meeting the
- milestones rather depends on time available.
- Green stuff has been coded, but not necessarily released yet.
- If you have a pressing need for a green but unreleased feature
- then you should check-out the code from Sourceforge CVS directly.
- <table>
-<thead>
- <tr>
-<th>Feature</th><th>Description</th><th>Release</th>
-</tr>
- </thead>
-<tbody>
-<tr>
- <td>Unit test case</td>
- <td>Core test case class and assertions</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Html display</td>
- <td>Simplest possible display</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Autoloading of test cases</td>
- <td>
- Reading a file with test cases and loading them into a
- group test automatically
- </td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Mock objects</td>
- <td>
- Objects capable of simulating other objects removing
- test dependencies
- </td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Web test case</td>
- <td>Allows link following and title tag matching</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Partial mocks</td>
- <td>
- Mocking parts of a class for testing less than a class
- or for complex simulations
- </td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Web cookie handling</td>
- <td>Correct handling of cookies when fetching pages</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Following redirects</td>
- <td>Page fetching automatically follows 300 redirects</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Form parsing</td>
- <td>Ability to submit simple forms and read default form values</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Command line interface</td>
- <td>Test display without the need of a web browser</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Exposure of expectation classes</td>
- <td>Can create precise tests with mocks as well as test cases</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>XML output and parsing</td>
- <td>
- Allows multi host testing and the integration of acceptance
- testing extensions
- </td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Browser component</td>
- <td>
- Exposure of lower level web browser interface for more
- detailed test cases
- </td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>HTTP authentication</td>
- <td>
- Fetching protected web pages with basic authentication
- only
- </td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>SSL support</td>
- <td>Can connect to https: pages</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Proxy support</td>
- <td>Can connect via. common proxies</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>Frames support</td>
- <td>Handling of frames in web test cases</td>
- <td style="color: green;">1.0</td>
- </tr>
- <tr>
- <td>File upload testing</td>
- <td>Can simulate the input type file tag</td>
- <td style="color: green;">1.0.1</td>
- </tr>
- <tr>
- <td>Mocking interfaces</td>
- <td>
- Can generate mock objects to interfaces as well as classes
- and class interfaces are carried for type hints
- </td>
- <td style="color: green;">1.0.1</td>
- </tr>
- <tr>
- <td>Reporting machinery enhancements</td>
- <td>Improved message passing for better cooperation with IDEs</td>
- <td style="color: red;">1.1</td>
- </tr>
- <tr>
- <td>Localisation</td>
- <td>Messages abstracted and code generated from XML</td>
- <td style="color: red;">1.1</td>
- </tr>
- <tr>
- <td>Testing exceptions</td>
- <td>Similar to testing PHP errors</td>
- <td style="color: red;">1.1</td>
- </tr>
- <tr>
- <td>IFrame support</td>
- <td>Reads IFrame content that can be refreshed</td>
- <td style="color: red;">1.1</td>
- </tr>
- <tr>
- <td>Improved mock interface</td>
- <td>More compact way of expressing mocks</td>
- <td style="color: red;">2.0</td>
- </tr>
- <tr>
- <td>HTML table assertions</td>
- <td>Can match table elements to numerical assertions</td>
- <td style="color: red;">2.0</td>
- </tr>
- <tr>
- <td>XPath searching of HTML elements</td>
- <td>More flexible content matching</td>
- <td style="color: red;">2.0</td>
- </tr>
- <tr>
- <td>Alternate HTML parsers</td>
- <td>Can detect compiled parsers for performance improvements</td>
- <td style="color: red;">2.0</td>
- </tr>
- <tr>
- <td>Javascript suport</td>
- <td>Use of PECL module to add Javascript</td>
- <td style="color: red;">3.0</td>
- </tr>
- </tbody>
-</table>
- PHP5 migraton will start straight after the version 1.0.1 series,
- whereupon PHP4 will no longer be supported.
- SimpleTest is currently compatible with PHP5, but will not
- make use of all of the new features until version 2.
- </p>
-
- <p>
-<a class="target" name="resources">
-<h2>Web resources for testing</h2>
-</a>
-</p>
- <p>
- Process is at least as important as tools.
- The type of process that makes the heaviest use of a developer's
- testing tool is of course
- <a href="http://www.extremeprogramming.org/">Extreme Programming</a>.
- This is one of the
- <a href="http://www.agilealliance.com/articles/index">Agile Methodologies</a>
- which combine various practices to "flatten the cost curve" of software development.
- More extreme still is <a href="http://www.testdriven.com/modules/news/">Test Driven Development</a>,
- where you very strictly adhere to the rule of no coding until you have a test.
- If you're more of a planner or believe that experience trumps evolution,
- you may prefer the
- <a href="http://www.therationaledge.com/content/dec_01/f_spiritOfTheRUP_pk.html">RUP</a> approach.
- I haven't tried it, but even I can see that you will need test tools (see figure 9).
- </p>
- <p>
- Most unit testers clone <a href="http://www.junit.org/">JUnit</a> to some degree,
- as far as the interface at least. There is a wealth of information on the
- JUnit site including the
- <a href="http://junit.sourceforge.net/doc/faq/faq.htm">FAQ</a>
- which contains plenty of general advice on testing.
- Once you get bitten by the bug you will certainly appreciate the phrase
- <a href="http://junit.sourceforge.net/doc/testinfected/testing.htm">test infected</a>
- coined by Eric Gamma.
- If you are still reviewing which unit tester to use the main choices
- are <a href="http://phpunit.sourceforge.net/">PHPUnit</a>
- and <a href="http://pear.php.net/manual/en/package.php.phpunit.php">Pear PHP::PHPUnit</a>.
- They currently lack a lot of features found in
- <a href="http://www.lastcraft.com/simple_test.php">SimpleTest</a>, but the PEAR
- version at least has been upgraded for PHP5 and is recommended if you are porting
- existing <a href="http://www.junit.org/">JUnit</a> test cases.
- </p>
- <p>
- There is currently a sad lack of material on mock objects, which is a shame
- as unit testing without them is a lot more work.
- The <a href="http://www.sidewize.com/company/mockobjects.pdf">original mock objects paper</a>
- is very Java focused, but still worth a read.
- As a new technology there are plenty of discussions and debate on how to use mocks,
- often on Wikis such as
- <a href="http://xpdeveloper.com/cgi-bin/oldwiki.cgi?MockObjects">Extreme Tuesday</a>
- or <a href="http://www.mockobjects.com/MocksObjectsPaper.html">www.mockobjects.com</a>
- or <a href="http://c2.com/cgi/wiki?MockObject">the original C2 Wiki</a>.
- Injecting mocks into a class is the main area of debate for which this
- <a href="http://www-106.ibm.com/developerworks/java/library/j-mocktest.html">paper on IBM</a>
- makes a good starting point.
- </p>
- <p>
- There are plenty of web testing tools, but the scriptable ones
- are mostly are written in Java and
- tutorials and advice are rather thin on the ground.
- The only hope is to look at the documentation for
- <a href="http://httpunit.sourceforge.net/">HTTPUnit</a>,
- <a href="http://htmlunit.sourceforge.net/">HTMLUnit</a>
- or <a href="http://jwebunit.sourceforge.net/">JWebUnit</a> and hope for clues.
- There are some XML driven test frameworks, but again most
- require Java to run.
- </p>
- <p>
- A new generation of tools that run directly in the web browser
- are now available.
- These include
- <a href="http://www.openqa.org/selenium/">Selenium</a> and
- <a href="http://wtr.rubyforge.org/">Watir</a>.
- As SimpleTest does not support JavaScript you would probably
- have to look at these tools anyway if you have highly dynamic
- pages.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/partial_mocks_documentation.html b/tests/test_tools/simpletest/docs/en/partial_mocks_documentation.html
deleted file mode 100755
index 6d7b6243..00000000
--- a/tests/test_tools/simpletest/docs/en/partial_mocks_documentation.html
+++ /dev/null
@@ -1,423 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>SimpleTest for PHP partial mocks documentation</title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<span class="chosen">Partial mocks</span>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Partial mock objects documentation</h1>
-<div class="content">
-
- <p>
- A partial mock is simply a pattern to alleviate a specific problem
- in testing with mock objects,
- that of getting mock objects into tight corners.
- It's quite a limited tool and possibly not even a good idea.
- It is included with SimpleTest because I have found it useful
- on more than one occasion and has saved a lot of work at that point.
- </p>
-
- <p>
-<a class="target" name="inject">
-<h2>The mock injection problem</h2>
-</a>
-</p>
- <p>
- When one object uses another it is very simple to just pass a mock
- version in already set up with its expectations.
- Things are rather tricker if one object creates another and the
- creator is the one you want to test.
- This means that the created object should be mocked, but we can
- hardly tell our class under test to create a mock instead.
- The tested class doesn't even know it is running inside a test
- after all.
- </p>
- <p>
- For example, suppose we are building a telnet client and it
- needs to create a network socket to pass its messages.
- The connection method might look something like...
-<pre>
-<strong>&lt;?php
- require_once('socket.php');
-
- class Telnet {
- ...
- function &amp;connect($ip, $port, $username, $password) {
- $socket = &amp;new Socket($ip, $port);
- $socket-&gt;read( ... );
- ...
- }
- }
-?&gt;</strong>
-</pre>
- We would really like to have a mock object version of the socket
- here, what can we do?
- </p>
- <p>
- The first solution is to pass the socket in as a parameter,
- forcing the creation up a level.
- Having the client handle this is actually a very good approach
- if you can manage it and should lead to factoring the creation from
- the doing.
- In fact, this is one way in which testing with mock objects actually
- forces you to code more tightly focused solutions.
- They improve your programming.
- </p>
- <p>
- Here this would be...
-<pre>
-&lt;?php
- require_once('socket.php');
-
- class Telnet {
- ...
- <strong>function &amp;connect(&amp;$socket, $username, $password) {
- $socket-&gt;read( ... );
- ...
- }</strong>
- }
-?&gt;
-</pre>
- This means that the test code is typical for a test involving
- mock objects.
-<pre>
-class TelnetTest extends UnitTestCase {
- ...
- function testConnection() {<strong>
- $socket = &amp;new MockSocket($this);
- ...
- $telnet = &amp;new Telnet();
- $telnet-&gt;connect($socket, 'Me', 'Secret');
- ...</strong>
- }
-}
-</pre>
- It is pretty obvious though that one level is all you can go.
- You would hardly want your top level application creating
- every low level file, socket and database connection ever
- needed.
- It wouldn't know the constructor parameters anyway.
- </p>
- <p>
- The next simplest compromise is to have the created object passed
- in as an optional parameter...
-<pre>
-&lt;?php
- require_once('socket.php');
-
- class Telnet {
- ...<strong>
- function &amp;connect($ip, $port, $username, $password, $socket = false) {
- if (!$socket) {
- $socket = &amp;new Socket($ip, $port);
- }
- $socket-&gt;read( ... );</strong>
- ...
- return $socket;
- }
- }
-?&gt;
-</pre>
- For a quick solution this is usually good enough.
- The test now looks almost the same as if the parameter
- was formally passed...
-<pre>
-class TelnetTest extends UnitTestCase {
- ...
- function testConnection() {<strong>
- $socket = &amp;new MockSocket($this);
- ...
- $telnet = &amp;new Telnet();
- $telnet-&gt;connect('127.0.0.1', 21, 'Me', 'Secret', &amp;$socket);
- ...</strong>
- }
-}
-</pre>
- The problem with this approach is its untidiness.
- There is test code in the main class and parameters passed
- in the test case that are never used.
- This is a quick and dirty approach, but nevertheless effective
- in most situations.
- </p>
- <p>
- The next method is to pass in a factory object to do the creation...
-<pre>
-&lt;?php
- require_once('socket.php');
-
- class Telnet {<strong>
- function Telnet(&amp;$network) {
- $this-&gt;_network = &amp;$network;
- }</strong>
- ...
- function &amp;connect($ip, $port, $username, $password) {<strong>
- $socket = &amp;$this-&gt;_network-&gt;createSocket($ip, $port);
- $socket-&gt;read( ... );</strong>
- ...
- return $socket;
- }
- }
-?&gt;
-</pre>
- This is probably the most highly factored answer as creation
- is now moved into a small specialist class.
- The networking factory can now be tested separately, but mocked
- easily when we are testing the telnet class...
-<pre>
-class TelnetTest extends UnitTestCase {
- ...
- function testConnection() {<strong>
- $socket = &amp;new MockSocket($this);
- ...
- $network = &amp;new MockNetwork($this);
- $network-&gt;setReturnReference('createSocket', $socket);
- $telnet = &amp;new Telnet($network);
- $telnet-&gt;connect('127.0.0.1', 21, 'Me', 'Secret');
- ...</strong>
- }
-}
-</pre>
- The downside is that we are adding a lot more classes to the
- library.
- Also we are passing a lot of factories around which will
- make the code a little less intuitive.
- The most flexible solution, but the most complex.
- </p>
- <p>
- Is there a middle ground?
- </p>
-
- <p>
-<a class="target" name="creation">
-<h2>Protected factory method</h2>
-</a>
-</p>
- <p>
- There is a way we can circumvent the problem without creating
- any new application classes, but it involves creating a subclass
- when we do the actual testing.
- Firstly we move the socket creation into its own method...
-<pre>
-&lt;?php
- require_once('socket.php');
-
- class Telnet {
- ...
- function &amp;connect($ip, $port, $username, $password) {<strong>
- $socket = &amp;$this-&gt;_createSocket($ip, $port);</strong>
- $socket-&gt;read( ... );
- ...
- }<strong>
-
- function &amp;_createSocket($ip, $port) {
- return new Socket($ip, $port);
- }</strong>
- }
-?&gt;
-</pre>
- This is the only change we make to the application code.
- </p>
- <p>
- For the test case we have to create a subclass so that
- we can intercept the socket creation...
-<pre>
-<strong>class TelnetTestVersion extends Telnet {
- var $_mock;
-
- function TelnetTestVersion(&amp;$mock) {
- $this-&gt;_mock = &amp;$mock;
- $this-&gt;Telnet();
- }
-
- function &amp;_createSocket() {
- return $this-&gt;_mock;
- }
-}</strong>
-</pre>
- Here I have passed the mock in the constructor, but a
- setter would have done just as well.
- Note that the mock was set into the object variable
- before the constructor was chained.
- This is necessary in case the constructor calls
- <span class="new_code">connect()</span>.
- Otherwise it could get a null value from
- <span class="new_code">_createSocket()</span>.
- </p>
- <p>
- After the completion of all of this extra work the
- actual test case is fairly easy.
- We just test our new class instead...
-<pre>
-class TelnetTest extends UnitTestCase {
- ...
- function testConnection() {<strong>
- $socket = &amp;new MockSocket($this);
- ...
- $telnet = &amp;new TelnetTestVersion($socket);
- $telnet-&gt;connect('127.0.0.1', 21, 'Me', 'Secret');
- ...</strong>
- }
-}
-</pre>
- The new class is very simple of course.
- It just sets up a return value, rather like a mock.
- It would be nice if it also checked the incoming parameters
- as well.
- Just like a mock.
- It seems we are likely to do this often, can
- we automate the subclass creation?
- </p>
-
- <p>
-<a class="target" name="partial">
-<h2>A partial mock</h2>
-</a>
-</p>
- <p>
- Of course the answer is "yes" or I would have stopped writing
- this by now!
- The previous test case was a lot of work, but we can
- generate the subclass using a similar approach to the mock objects.
- </p>
- <p>
- Here is the partial mock version of the test...
-<pre>
-<strong>Mock::generatePartial(
- 'Telnet',
- 'TelnetTestVersion',
- array('_createSocket'));</strong>
-
-class TelnetTest extends UnitTestCase {
- ...
- function testConnection() {<strong>
- $socket = &amp;new MockSocket($this);
- ...
- $telnet = &amp;new TelnetTestVersion($this);
- $telnet-&gt;setReturnReference('_createSocket', $socket);
- $telnet-&gt;Telnet();
- $telnet-&gt;connect('127.0.0.1', 21, 'Me', 'Secret');
- ...</strong>
- }
-}
-</pre>
- The partial mock is a subclass of the original with
- selected methods "knocked out" with test
- versions.
- The <span class="new_code">generatePartial()</span> call
- takes three parameters: the class to be subclassed,
- the new test class name and a list of methods to mock.
- </p>
- <p>
- Instantiating the resulting objects is slightly tricky.
- The only constructor parameter of a partial mock is
- the unit tester reference.
- As with the normal mock objects this is needed for sending
- test results in response to checked expectations.
- </p>
- <p>
- The original constructor is not run yet.
- This is necessary in case the constructor is going to
- make use of the as yet unset mocked methods.
- We set any return values at this point and then run the
- constructor with its normal parameters.
- This three step construction of "new", followed
- by setting up the methods, followed by running the constructor
- proper is what distinguishes the partial mock code.
- </p>
- <p>
- Apart from construction, all of the mocked methods have
- the same features as mock objects and all of the unmocked
- methods behave as before.
- We can set expectations very easily...
-<pre>
-class TelnetTest extends UnitTestCase {
- ...
- function testConnection() {
- $socket = &amp;new MockSocket($this);
- ...
- $telnet = &amp;new TelnetTestVersion($this);
- $telnet-&gt;setReturnReference('_createSocket', $socket);<strong>
- $telnet-&gt;expectOnce('_createSocket', array('127.0.0.1', 21));</strong>
- $telnet-&gt;Telnet();
- $telnet-&gt;connect('127.0.0.1', 21, 'Me', 'Secret');
- ...<strong>
- $telnet-&gt;tally();</strong>
- }
-}
-</pre>
- </p>
-
- <p>
-<a class="target" name="less">
-<h2>Testing less than a class</h2>
-</a>
-</p>
- <p>
- The mocked out methods don't have to be factory methods,
- they could be any sort of method.
- In this way partial mocks allow us to take control of any part of
- a class except the constructor.
- We could even go as far as to mock every method
- except one we actually want to test.
- </p>
- <p>
- This last situation is all rather hypothetical, as I haven't
- tried it.
- I am open to the possibility, but a little worried that
- forcing object granularity may be better for the code quality.
- I personally use partial mocks as a way of overriding creation
- or for occasional testing of the TemplateMethod pattern.
- </p>
- <p>
- It's all going to come down to the coding standards of your
- project to decide which mechanism you use.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/reporter_documentation.html b/tests/test_tools/simpletest/docs/en/reporter_documentation.html
deleted file mode 100755
index ead61175..00000000
--- a/tests/test_tools/simpletest/docs/en/reporter_documentation.html
+++ /dev/null
@@ -1,512 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>SimpleTest for PHP test runner and display documentation</title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<span class="chosen">Reporting</span>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Test reporter documentation</h1>
-<div class="content">
-
- <p>
- SimpleTest pretty much follows the MVC pattern
- (Model-View-Controller).
- The reporter classes are the view and the model is your
- test cases and their hiearchy.
- The controller is mostly hidden from the user of
- SimpleTest unless you want to change how the test cases
- are actually run, in which case it is possible to
- override the runner objects from within the test case.
- As usual with MVC, the controller is mostly undefined
- and there are other places to control the test run.
- </p>
-
- <p>
-<a class="target" name="html">
-<h2>Reporting results in HTML</h2>
-</a>
-</p>
- <p>
- The default test display is minimal in the extreme.
- It reports success and failure with the conventional red and
- green bars and shows a breadcrumb trail of test groups
- for every failed assertion.
- Here's a fail...
- <div class="demo">
- <h1>File test</h1>
- <span class="fail">Fail</span>: createnewfile-&gt;True assertion failed.<br>
- <div style="padding: 8px; margin-top: 1em; background-color: red; color: white;">1/1 test cases complete.
- <strong>0</strong> passes, <strong>1</strong> fails and <strong>0</strong> exceptions.</div>
- </div>
- And here all tests passed...
- <div class="demo">
- <h1>File test</h1>
- <div style="padding: 8px; margin-top: 1em; background-color: green; color: white;">1/1 test cases complete.
- <strong>1</strong> passes, <strong>0</strong> fails and <strong>0</strong> exceptions.</div>
- </div>
- The good news is that there are several points in the display
- hiearchy for subclassing.
- </p>
- <p>
- For web page based displays there is the
- <span class="new_code">HtmlReporter</span> class with the following
- signature...
-<pre>
-class HtmlReporter extends SimpleReporter {
- public HtmlReporter($encoding) { ... }
- public makeDry(boolean $is_dry) { ... }
- public void paintHeader(string $test_name) { ... }
- public void sendNoCacheHeaders() { ... }
- public void paintFooter(string $test_name) { ... }
- public void paintGroupStart(string $test_name, integer $size) { ... }
- public void paintGroupEnd(string $test_name) { ... }
- public void paintCaseStart(string $test_name) { ... }
- public void paintCaseEnd(string $test_name) { ... }
- public void paintMethodStart(string $test_name) { ... }
- public void paintMethodEnd(string $test_name) { ... }
- public void paintFail(string $message) { ... }
- public void paintPass(string $message) { ... }
- public void paintError(string $message) { ... }
- public void paintException(string $message) { ... }
- public void paintMessage(string $message) { ... }
- public void paintFormattedMessage(string $message) { ... }
- protected string _getCss() { ... }
- public array getTestList() { ... }
- public integer getPassCount() { ... }
- public integer getFailCount() { ... }
- public integer getExceptionCount() { ... }
- public integer getTestCaseCount() { ... }
- public integer getTestCaseProgress() { ... }
-}
-</pre>
- Here is what some of these methods mean. First the display methods
- that you will probably want to override...
- <ul class="api">
- <li>
- <span class="new_code">HtmlReporter(string $encoding)</span>
-<br>
- is the constructor.
- Note that the unit test sets up the link to the display
- rather than the other way around.
- The display is a mostly passive receiver of test events.
- This allows easy adaption of the display for other test
- systems beside unit tests, such as monitoring servers.
- The encoding is the character encoding you wish to
- display the test output in.
- In order to correctly render debug output when
- using the web tester, this should match the encoding
- of the site you are trying to test.
- The available character set strings are described in
- the PHP <a href="http://www.php.net/manual/en/function.htmlentities.php">html_entities()</a>
- function.
- </li>
- <li>
- <span class="new_code">void paintHeader(string $test_name)</span>
-<br>
- is called once at the very start of the test when the first
- start event arrives.
- The first start event is usually delivered by the top level group
- test and so this is where <span class="new_code">$test_name</span>
- comes from.
- It paints the page titles, CSS, body tag, etc.
- It returns nothing (<span class="new_code">void</span>).
- </li>
- <li>
- <span class="new_code">void paintFooter(string $test_name)</span>
-<br>
- Called at the very end of the test to close any tags opened
- by the page header.
- By default it also displays the red/green bar and the final
- count of results.
- Actually the end of the test happens when a test end event
- comes in with the same name as the one that started it all
- at the same level.
- The tests nest you see.
- Closing the last test finishes the display.
- </li>
- <li>
- <span class="new_code">void paintMethodStart(string $test_name)</span>
-<br>
- is called at the start of each test method.
- The name normally comes from method name.
- The other test start events behave the same way except
- that the group test one tells the reporter how large
- it is in number of held test cases.
- This is so that the reporter can display a progress bar
- as the runner churns through the test cases.
- </li>
- <li>
- <span class="new_code">void paintMethodEnd(string $test_name)</span>
-<br>
- backs out of the test started with the same name.
- </li>
- <li>
- <span class="new_code">void paintFail(string $message)</span>
-<br>
- paints a failure.
- By default it just displays the word fail, a breadcrumbs trail
- showing the current test nesting and the message issued by
- the assertion.
- </li>
- <li>
- <span class="new_code">void paintPass(string $message)</span>
-<br>
- by default does nothing.
- </li>
- <li>
- <span class="new_code">string _getCss()</span>
-<br>
- Returns the CSS styles as a string for the page header
- method.
- Additional styles have to be appended here if you are
- not overriding the page header.
- You will want to use this method in an overriden page header
- if you want to include the original CSS.
- </li>
- </ul>
- There are also some accessors to get information on the current
- state of the test suite.
- Use these to enrich the display...
- <ul class="api">
- <li>
- <span class="new_code">array getTestList()</span>
-<br>
- is the first convenience method for subclasses.
- Lists the current nesting of the tests as a list
- of test names.
- The first, most deeply nested test, is first in the
- list and the current test method will be last.
- </li>
- <li>
- <span class="new_code">integer getPassCount()</span>
-<br>
- returns the number of passes chalked up so far.
- Needed for the display at the end.
- </li>
- <li>
- <span class="new_code">integer getFailCount()</span>
-<br>
- is likewise the number of fails so far.
- </li>
- <li>
- <span class="new_code">integer getExceptionCount()</span>
-<br>
- is likewise the number of errors so far.
- </li>
- <li>
- <span class="new_code">integer getTestCaseCount()</span>
-<br>
- is the total number of test cases in the test run.
- This includes the grouping tests themselves.
- </li>
- <li>
- <span class="new_code">integer getTestCaseProgress()</span>
-<br>
- is the number of test cases completed so far.
- </li>
- </ul>
- One simple modification is to get the HtmlReporter to display
- the passes as well as the failures and errors...
-<pre>
-<strong>class ShowPasses extends HtmlReporter {
-
- function paintPass($message) {
- parent::paintPass($message);
- print "&amp;&lt;span class=\"pass\"&gt;Pass&lt;/span&gt;: ";
- $breadcrumb = $this-&gt;getTestList();
- array_shift($breadcrumb);
- print implode("-&amp;gt;", $breadcrumb);
- print "-&amp;gt;$message&lt;br /&gt;\n";
- }
-
- function _getCss() {
- return parent::_getCss() . ' .pass { color: green; }';
- }
-}</strong>
-</pre>
- </p>
- <p>
- One method that was glossed over was the <span class="new_code">makeDry()</span>
- method.
- If you run this method, with no parameters, on the reporter
- before the test suite is run no actual test methods
- will be called.
- You will still get the events of entering and leaving the
- test methods and test cases, but no passes or failures etc,
- because the test code will not actually be executed.
- </p>
- <p>
- The reason for this is to allow for more sophistcated
- GUI displays that allow the selection of individual test
- cases.
- In order to build a list of possible tests they need a
- report on the test structure for drawing, say a tree view
- of the test suite.
- With a reporter set to dry run that just sends drawing events
- this is easily accomplished.
- </p>
-
- <p>
-<a class="target" name="other">
-<h2>Extending the reporter</h2>
-</a>
-</p>
- <p>
- Rather than simply modifying the existing display, you might want to
- produce a whole new HTML look, or even generate text or XML.
- Rather than override every method in
- <span class="new_code">HtmlReporter</span> we can take one
- step up the class hiearchy to <span class="new_code">SimpleReporter</span>
- in the <em>simple_test.php</em> source file.
- </p>
- <p>
- A do nothing display, a blank canvas for your own creation, would
- be...
-<pre>
-<strong>require_once('simpletest/simple_test.php');</strong>
-
-class MyDisplay extends SimpleReporter {<strong>
- </strong>
- function paintHeader($test_name) {
- }
-
- function paintFooter($test_name) {
- }
-
- function paintStart($test_name, $size) {<strong>
- parent::paintStart($test_name, $size);</strong>
- }
-
- function paintEnd($test_name, $size) {<strong>
- parent::paintEnd($test_name, $size);</strong>
- }
-
- function paintPass($message) {<strong>
- parent::paintPass($message);</strong>
- }
-
- function paintFail($message) {<strong>
- parent::paintFail($message);</strong>
- }
-}
-</pre>
- No output would come from this class until you add it.
- </p>
-
- <p>
-<a class="target" name="cli">
-<h2>The command line reporter</h2>
-</a>
-</p>
- <p>
- SimpleTest also ships with a minimal command line reporter.
- The interface mimics JUnit to some extent, but paints the
- failure messages as they arrive.
- To use the command line reporter simply substitute it
- for the HTML version...
-<pre>
-&lt;?php
- require_once('simpletest/unit_tester.php');
- require_once('simpletest/reporter.php');
-
- $test = &amp;new GroupTest('File test');
- $test-&gt;addTestFile('tests/file_test.php');
- $test-&gt;run(<strong>new TextReporter()</strong>);
-?&gt;
-</pre>
- Then invoke the test suite from the command line...
-<pre class="shell">
-php file_test.php
-</pre>
- You will need the command line version of PHP installed
- of course.
- A passing test suite looks like this...
-<pre class="shell">
-File test
-OK
-Test cases run: 1/1, Failures: 0, Exceptions: 0
-</pre>
- A failure triggers a display like this...
-<pre class="shell">
-File test
-1) True assertion failed.
- in createnewfile
-FAILURES!!!
-Test cases run: 1/1, Failures: 1, Exceptions: 0
-</pre>
- </p>
- <p>
- One of the main reasons for using a command line driven
- test suite is of using the tester as part of some automated
- process.
- To function properly in shell scripts the test script should
- return a non-zero exit code on failure.
- If a test suite fails the value <span class="new_code">false</span>
- is returned from the <span class="new_code">SimpleTest::run()</span>
- method.
- We can use that result to exit the script with the desired return
- code...
-<pre>
-&lt;?php
- require_once('simpletest/unit_tester.php');
- require_once('simpletest/reporter.php');
-
- $test = &amp;new GroupTest('File test');
- $test-&gt;addTestFile('tests/file_test.php');
- <strong>exit ($test-&gt;run(new TextReporter()) ? 0 : 1);</strong>
-?&gt;
-</pre>
- Of course we don't really want to create two test scripts,
- a command line one and a web browser one, for each test suite.
- The command line reporter includes a method to sniff out the
- run time environment...
-<pre>
-&lt;?php
- require_once('simpletest/unit_tester.php');
- require_once('simpletest/reporter.php');
-
- $test = &amp;new GroupTest('File test');
- $test-&gt;addTestFile('tests/file_test.php');
- <strong>if (TextReporter::inCli()) {</strong>
- exit ($test-&gt;run(new TextReporter()) ? 0 : 1);
- <strong>}</strong>
- $test-&gt;run(new HtmlReporter());
-?&gt;
-</pre>
- This is the form used within SimpleTest itself.
- </p>
-
- <p>
-<a class="target" name="xml">
-<h2>Remote testing</h2>
-</a>
-</p>
- <p>
- SimpleTest ships with an <span class="new_code">XmlReporter</span> class
- used for internal communication.
- When run the output looks like...
-<pre class="shell">
-&lt;?xml version="1.0"?&gt;
-&lt;run&gt;
- &lt;group size="4"&gt;
- &lt;name&gt;Remote tests&lt;/name&gt;
- &lt;group size="4"&gt;
- &lt;name&gt;Visual test with 48 passes, 48 fails and 4 exceptions&lt;/name&gt;
- &lt;case&gt;
- &lt;name&gt;testofunittestcaseoutput&lt;/name&gt;
- &lt;test&gt;
- &lt;name&gt;testofresults&lt;/name&gt;
- &lt;pass&gt;This assertion passed&lt;/pass&gt;
- &lt;fail&gt;This assertion failed&lt;/fail&gt;
- &lt;/test&gt;
- &lt;test&gt;
- ...
- &lt;/test&gt;
- &lt;/case&gt;
- &lt;/group&gt;
- &lt;/group&gt;
-&lt;/run&gt;
-</pre>
- You can make use of this format with the parser
- supplied as part of SimpleTest itself.
- This is called <span class="new_code">SimpleTestXmlParser</span> and
- resides in <em>xml.php</em> within the SimpleTest package...
-<pre>
-&lt;?php
- require_once('simpletest/xml.php');
-
- ...
- $parser = &amp;new SimpleTestXmlParser(new HtmlReporter());
- $parser-&gt;parse($test_output);
-?&gt;
-</pre>
- The <span class="new_code">$test_output</span> should be the XML format
- from the XML reporter, and could come from say a command
- line run of a test case.
- The parser sends events to the reporter just like any
- other test run.
- There are some odd occasions where this is actually useful.
- </p>
- <p>
- A problem with large test suites is thet they can exhaust
- the default 8Mb memory limit on a PHP process.
- By having the test groups output in XML and run in
- separate processes, the output can be reparsed to
- aggregate the results into a much smaller footprint top level
- test.
- </p>
- <p>
- Because the XML output can come from anywhere, this opens
- up the possibility of aggregating test runs from remote
- servers.
- A test case already exists to do this within the SimpleTest
- framework, but it is currently experimental...
-<pre>
-&lt;?php
- <strong>require_once('../remote.php');</strong>
- require_once('../reporter.php');
-
- $test_url = ...;
- $dry_url = ...;
-
- $test = &amp;new GroupTest('Remote tests');
- $test-&gt;addTestCase(<strong>new RemoteTestCase($test_url, $dry_url)</strong>);
- $test-&gt;run(new HtmlReporter());
-?&gt;
-</pre>
- The <span class="new_code">RemoteTestCase</span> takes the actual location
- of the test runner, basically a web page in XML format.
- It also takes the URL of a reporter set to do a dry run.
- This is so that progress can be reported upward correctly.
- The <span class="new_code">RemoteTestCase</span> can be added to test suites
- just like any other group test.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/server_stubs_documentation.html b/tests/test_tools/simpletest/docs/en/server_stubs_documentation.html
deleted file mode 100755
index 4b18bb0b..00000000
--- a/tests/test_tools/simpletest/docs/en/server_stubs_documentation.html
+++ /dev/null
@@ -1,388 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>SimpleTest for PHP server stubs documentation</title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<span class="chosen">Server stubs</span>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Server stubs documentation</h1>
-<div class="content">
- <p>
-<a class="target" name="what">
-<h2>What are server stubs?</h2>
-</a>
-</p>
- <p>
- This was originally a pattern named by Robert Binder (Testing
- object-oriented systems: models, patterns, and tools,
- Addison-Wesley) in 1999.
- A server stub is a simulation of an object or component.
- It should exactly replace a component in a system for test
- or prototyping purposes, but remain lightweight.
- This allows tests to run more quickly, or if the simulated
- class has not been written, to run at all.
- </p>
-
- <p>
-<a class="target" name="creation">
-<h2>Creating server stubs</h2>
-</a>
-</p>
- <p>
- All we need is an existing class, say a database connection
- that looks like this...
-<pre>
-<strong>class DatabaseConnection {
- function DatabaseConnection() {
- }
-
- function query() {
- }
-
- function selectQuery() {
- }
-}</strong>
-</pre>
- The class does not need to have been implemented yet.
- To create a stub version of the class we need to include the
- server stub library and run the generator...
-<pre>
-<strong>require_once('simpletest/mock_objects.php');
-require_once('database_connection.php');
-Stub::generate('DatabaseConnection');</strong>
-</pre>
- This generates a clone class called
- <span class="new_code">StubDatabaseConnection</span>.
- We can now create instances of the new class within
- our prototype script...
-<pre>
-require_once('simpletest/mock_objects.php');
-require_once('database_connection.php');
-Stub::generate('DatabaseConnection');
-<strong>
-$connection = new StubDatabaseConnection();
-</strong>
-</pre>
- The stub version of a class has all the methods of the original
- so that operations like
- <span class="new_code">$connection-&gt;query()</span> are still
- legal.
- The return value will be <span class="new_code">null</span>,
- but we can change that with...
-<pre>
-<strong>$connection-&gt;setReturnValue('query', 37)</strong>
-</pre>
- Now every time we call
- <span class="new_code">$connection-&gt;query()</span> we get
- the result of 37.
- We can set the return value to anything, say a hash of
- imaginary database results or a list of persistent objects.
- Parameters are irrelevant here, we always get the same
- values back each time once they have been set up this way.
- That may not sound like a convincing replica of a
- database connection, but for the half a dozen lines of
- a test method it is usually all you need.
- </p>
-
- <p>
-<a class="target" name="patterns">
-<h2>Simulation patterns</h2>
-</a>
-</p>
- <p>
- Things aren't always that simple though.
- One common problem is iterators, where constantly returning
- the same value could cause an endless loop in the object
- being tested.
- For these we need to set up sequences of values.
- Let's say we have a simple iterator that looks like this...
-<pre>
-class Iterator {
- function Iterator() {
- }
-
- function next() {
- }
-}
-</pre>
- This is about the simplest iterator you could have.
- Assuming that this iterator only returns text until it
- reaches the end, when it returns false, we can simulate it
- with...
-<pre>
-<strong>Stub::generate('Iterator');
-
-$iterator = new StubIterator();
-$iterator-&gt;setReturnValue('next', false);
-$iterator-&gt;setReturnValueAt(0, 'next', 'First string');
-$iterator-&gt;setReturnValueAt(1, 'next', 'Second string');</strong>
-</pre>
- When <span class="new_code">next()</span> is called on the
- stub iterator it will first return "First string",
- on the second call "Second string" will be returned
- and on any other call <span class="new_code">false</span> will
- be returned.
- The sequenced return values take precedence over the constant
- return value.
- The constant one is a kind of default if you like.
- </p>
- <p>
- Another tricky situation is an overloaded
- <span class="new_code">get()</span> operation.
- An example of this is an information holder with name/value pairs.
- Say we have a configuration class like...
-<pre>
-class Configuration {
- function Configuration() {
- }
-
- function getValue($key) {
- }
-}
-</pre>
- This is a classic situation for using stub objects as
- actual configuration will vary from machine to machine,
- hardly helping the reliability of our tests if we use it
- directly.
- The problem though is that all the data comes through the
- <span class="new_code">getValue()</span> method and yet
- we want different results for different keys.
- Luckily the stubs have a filter system...
-<pre>
-<strong>Stub::generate('Configuration');
-
-$config = &amp;new StubConfiguration();
-$config-&gt;setReturnValue('getValue', 'primary', array('db_host'));
-$config-&gt;setReturnValue('getValue', 'admin', array('db_user'));
-$config-&gt;setReturnValue('getValue', 'secret', array('db_password'));</strong>
-</pre>
- The extra parameter is a list of arguments to attempt
- to match.
- In this case we are trying to match only one argument which
- is the look up key.
- Now when the server stub has the
- <span class="new_code">getValue()</span> method invoked
- like this...
-<pre>
-$config-&gt;getValue('db_user');
-</pre>
- ...it will return "admin".
- It finds this by attempting to match the calling arguments
- to its list of returns one after another until
- a complete match is found.
- </p>
- <p>
- You can set a default argument argument like so...
-<pre>
-<strong>
-$config-&gt;setReturnValue('getValue', false, array('*'));</strong>
-</pre>
- This is not the same as setting the return value without
- any argument requirements like this...
-<pre>
-<strong>
-$config-&gt;setReturnValue('getValue', false);</strong>
-</pre>
- In the first case it will accept any single argument,
- but exactly one is required.
- In the second case any number of arguments will do and
- it acts as a catchall after all other matches.
- Note that if we add further single parameter options after
- the wildcard in the first case, they will be ignored as the wildcard
- will match first.
- With complex parameter lists the ordering could be important
- or else desired matches could be masked by earlier wildcard
- ones.
- Declare the most specific matches first if you are not sure.
- </p>
- <p>
- There are times when you want a specific object to be
- dished out by the stub rather than just a copy.
- The PHP copy semantics force us to use a different method
- for this.
- You might be simulating a container for example...
-<pre>
-class Thing {
-}
-
-class Vector {
- function Vector() {
- }
-
- function get($index) {
- }
-}
-</pre>
- In this case you can set a reference into the stub's
- return list...
-<pre>
-Stub::generate('Vector');
-
-$thing = new Thing();<strong>
-$vector = &amp;new StubVector();
-$vector-&gt;setReturnReference('get', $thing, array(12));</strong>
-</pre>
- With this arrangement you know that every time
- <span class="new_code">$vector-&gt;get(12)</span> is
- called it will return the same
- <span class="new_code">$thing</span> each time.
- </p>
- <p>
- These three factors, timing, parameters and whether to copy,
- can be combined orthogonally.
- For example...
-<pre>
-$complex = &amp;new StubComplexThing();
-$stuff = new Stuff();<strong>
-$complex-&gt;setReturnReferenceAt(3, 'get', $stuff, array('*', 1));</strong>
-</pre>
- This will return the <span class="new_code">$stuff</span> only on the third
- call and only if two parameters were set the second of
- which must be the integer 1.
- That should cover most simple prototyping situations.
- </p>
- <p>
- A final tricky case is one object creating another, known
- as a factory pattern.
- Suppose that on a successful query to our imaginary
- database, a result set is returned as an iterator with
- each call to <span class="new_code">next()</span> giving
- one row until false.
- This sounds like a simulation nightmare, but in fact it can all
- be stubbed using the mechanics above.
- </p>
- <p>
- Here's how...
-<pre>
-Stub::generate('DatabaseConnection');
-Stub::generate('ResultIterator');
-
-class DatabaseTest extends UnitTestCase {
-
- function testUserFinder() {<strong>
- $result = &amp;new StubResultIterator();
- $result-&gt;setReturnValue('next', false);
- $result-&gt;setReturnValueAt(0, 'next', array(1, 'tom'));
- $result-&gt;setReturnValueAt(1, 'next', array(3, 'dick'));
- $result-&gt;setReturnValueAt(2, 'next', array(6, 'harry'));
-
- $connection = &amp;new StubDatabaseConnection();
- $connection-&gt;setReturnValue('query', false);
- $connection-&gt;setReturnReference(
- 'query',
- $result,
- array('select id, name from users'));</strong>
-
- $finder = &amp;new UserFinder($connection);
- $this-&gt;assertIdentical(
- $finder-&gt;findNames(),
- array('tom', 'dick', 'harry'));
- }
-}
-</pre>
- Now only if our
- <span class="new_code">$connection</span> is called with the correct
- <span class="new_code">query()</span> will the
- <span class="new_code">$result</span> be returned that is
- itself exhausted after the third call to <span class="new_code">next()</span>.
- This should be enough
- information for our <span class="new_code">UserFinder</span> class,
- the class actually
- being tested here, to come up with goods.
- A very precise test and not a real database in sight.
- </p>
-
- <p>
-<a class="target" name="options">
-<h2>Stub creation options</h2>
-</a>
-</p>
- <p>
- There are some additional options when creating stubs.
- At the generation stage we can change the class name...
-<pre>
-<strong>Stub::generate('Iterator', 'MyStubIterator');
-$iterator = &amp;new MyStubIterator();
-</strong>
-</pre>
- This is not very useful in itself as there would be no difference
- in this class and the default except for the name.
- However we can also add additional methods not found in the
- original interface...
-<pre>
-class Iterator {
-}
-<strong>Stub::generate('Iterator', 'PrototypeIterator', array('next', 'isError'));
-$iterator = &amp;new PrototypeIterator();
-$iterator-&gt;setReturnValue('next', 0);
-</strong>
-</pre>
- The <span class="new_code">next()</span> and
- <span class="new_code">isError()</span> methods can now have
- return values set just as if they existed in the original class.
- </p>
- <p>
- One other esoteric way of customising the stubs is to change
- the default wildcard used for parameter matching.
-<pre>
-<strong>Stub::generate('Connection');
-$iterator = &amp;new StubConnection('wild');
-$iterator-&gt;setReturnValue('query', array('id' =&gt; 33), array('wild'));
-</strong>
-</pre>
- The only reason to do this is if you genuinely wanted to test
- against the literal string "*" and didn't want it
- interpreted as "any".
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/unit_test_documentation.html b/tests/test_tools/simpletest/docs/en/unit_test_documentation.html
deleted file mode 100755
index 47b61eca..00000000
--- a/tests/test_tools/simpletest/docs/en/unit_test_documentation.html
+++ /dev/null
@@ -1,390 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>SimpleTest for PHP regression test documentation</title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<span class="chosen">Unit tester</span>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<a href="web_tester_documentation.html">Web tester</a>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>PHP Unit Test documentation</h1>
-<div class="content">
- <p>
-<a class="target" name="unit">
-<h2>Unit test cases</h2>
-</a>
-</p>
- <p>
- The core system is a regression testing framework built around
- test cases.
- A sample test case looks like this...
-<pre>
-<strong>class FileTestCase extends UnitTestCase {
-}</strong>
-</pre>
- If no test name is supplied when chaining the constructor then
- the class name will be taken instead.
- This will be the name displayed in the test results.
- </p>
- <p>
- Actual tests are added as methods in the test case whose names
- by default start with the string "test" and
- when the test case is invoked all such methods are run in
- the order that PHP introspection finds them.
- As many test methods can be added as needed.
- For example...
-<pre>
-require_once('../classes/writer.php');
-
-class FileTestCase extends UnitTestCase {
- function FileTestCase() {
- $this-&gt;UnitTestCase('File test');
- }<strong>
-
- function setUp() {
- @unlink('../temp/test.txt');
- }
-
- function tearDown() {
- @unlink('../temp/test.txt');
- }
-
- function testCreation() {
- $writer = &amp;new FileWriter('../temp/test.txt');
- $writer-&gt;write('Hello');
- $this-&gt;assertTrue(file_exists('../temp/test.txt'), 'File created');
- }</strong>
-}
-</pre>
- The constructor is optional and usually omitted.
- Without a name, the class name is taken as the name of the test case.
- </p>
- <p>
- Our only test method at the moment is <span class="new_code">testCreation()</span>
- where we check that a file has been created by our
- <span class="new_code">Writer</span> object.
- We could have put the <span class="new_code">unlink()</span>
- code into this method as well, but by placing it in
- <span class="new_code">setUp()</span> and
- <span class="new_code">tearDown()</span> we can use it with
- other test methods that we add.
- </p>
- <p>
- The <span class="new_code">setUp()</span> method is run
- just before each and every test method.
- <span class="new_code">tearDown()</span> is run just after
- each and every test method.
- </p>
- <p>
- You can place some test case set up into the constructor to
- be run once for all the methods in the test case, but
- you risk test inteference that way.
- This way is slightly slower, but it is safer.
- Note that if you come from a JUnit background this will not
- be the behaviour you are used to.
- JUnit surprisingly reinstantiates the test case for each test
- method to prevent such interference.
- SimpleTest requires the end user to use <span class="new_code">setUp()</span>, but
- supplies additional hooks for library writers.
- </p>
- <p>
- The means of reporting test results (see below) are by a
- visiting display class
- that is notified by various <span class="new_code">assert...()</span>
- methods.
- Here is the full list for the <span class="new_code">UnitTestCase</span>
- class, the default for SimpleTest...
- <table>
-<tbody>
- <tr>
-<td><span class="new_code">assertTrue($x)</span></td><td>Fail if $x is false</td>
-</tr>
- <tr>
-<td><span class="new_code">assertFalse($x)</span></td><td>Fail if $x is true</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNull($x)</span></td><td>Fail if $x is set</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNotNull($x)</span></td><td>Fail if $x not set</td>
-</tr>
- <tr>
-<td><span class="new_code">assertIsA($x, $t)</span></td><td>Fail if $x is not the class or type $t</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNotA($x, $t)</span></td><td>Fail if $x is of the class or type $t</td>
-</tr>
- <tr>
-<td><span class="new_code">assertEqual($x, $y)</span></td><td>Fail if $x == $y is false</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNotEqual($x, $y)</span></td><td>Fail if $x == $y is true</td>
-</tr>
- <tr>
-<td><span class="new_code">assertWithinMargin($x, $y, $m)</span></td><td>Fail if abs($x - $y) &lt; $m is false</td>
-</tr>
- <tr>
-<td><span class="new_code">assertOutsideMargin($x, $y, $m)</span></td><td>Fail if abs($x - $y) &lt; $m is true</td>
-</tr>
- <tr>
-<td><span class="new_code">assertIdentical($x, $y)</span></td><td>Fail if $x == $y is false or a type mismatch</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNotIdentical($x, $y)</span></td><td>Fail if $x == $y is true and types match</td>
-</tr>
- <tr>
-<td><span class="new_code">assertReference($x, $y)</span></td><td>Fail unless $x and $y are the same variable</td>
-</tr>
- <tr>
-<td><span class="new_code">assertCopy($x, $y)</span></td><td>Fail if $x and $y are the same variable</td>
-</tr>
- <tr>
-<td><span class="new_code">assertPattern($p, $x)</span></td><td>Fail unless the regex $p matches $x</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNoPattern($p, $x)</span></td><td>Fail if the regex $p matches $x</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNoErrors()</span></td><td>Fail if any PHP error occoured</td>
-</tr>
- <tr>
-<td><span class="new_code">assertError($x)</span></td><td>Fail if no PHP error or incorrect message/expectation</td>
-</tr>
- <tr>
-<td><span class="new_code">assertExpectation($e)</span></td><td>Fail on failed expectation object</td>
-</tr>
- </tbody>
-</table>
- All assertion methods can take an optional description to
- label the displayed result with.
- If omitted a default message is sent instead which is usually
- sufficient.
- This default message can still be embedded in your own message
- if you include "%s" within the string.
- All the assertions return true on a pass or false on failure.
- </p>
- <p>
- Some examples...
-<pre>
-<strong>$variable = null;
-$this-&gt;assertNull($variable, 'Should be cleared');</strong>
-</pre>
- ...will pass and normally show no message.
- If you have
- <a href="http://www.lastcraft.com/display_subclass_tutorial.php">set up the tester to display passes</a>
- as well then the message will be displayed as is.
-<pre>
-<strong>$this-&gt;assertIdentical(0, false, 'Zero is not false [%s]');</strong>
-</pre>
- This will fail as it performs a type
- check as well as a comparison between the two values.
- The "%s" part is replaced by the default
- error message that would have been shown if we had not
- supplied our own.
- This also allows us to nest test messages.
-<pre>
-<strong>$a = 1;
-$b = $a;
-$this-&gt;assertReference($a, $b);</strong>
-</pre>
- Will fail as the variable <span class="new_code">$a</span> is a copy of <span class="new_code">$b</span>.
-<pre>
-<strong>$this-&gt;assertPattern('/hello/i', 'Hello world');</strong>
-</pre>
- This will pass as using a case insensitive match the string
- <span class="new_code">hello</span> is contained in <span class="new_code">Hello world</span>.
-<pre>
-<strong>trigger_error('Disaster');
-trigger_error('Catastrophe');
-$this-&gt;assertError();
-$this-&gt;assertError('Catastrophe');
-$this-&gt;assertNoErrors();</strong>
-</pre>
- This one takes some explanation as in fact they all pass!
- </p>
- <p>
- PHP errors in SimpleTest are trapped and placed in a queue.
- Here the first error check catches the "Disaster"
- message without checking the text and passes.
- This removes the error from the queue.
- The next error check tests not only the existence of the error,
- but also the text which here matches so another pass.
- With the queue now empty the last test will pass as well.
- If any unchecked errors are left at the end of a test method then
- an exception will be reported in the test.
- Note that SimpleTest cannot catch compile time PHP errors.
- </p>
- <p>
- The test cases also have some convenience methods for debugging
- code or extending the suite...
- <table>
-<tbody>
- <tr>
-<td><span class="new_code">setUp()</span></td><td>Runs this before each test method</td>
-</tr>
- <tr>
-<td><span class="new_code">tearDown()</span></td><td>Runs this after each test method</td>
-</tr>
- <tr>
-<td><span class="new_code">pass()</span></td><td>Sends a test pass</td>
-</tr>
- <tr>
-<td><span class="new_code">fail()</span></td><td>Sends a test failure</td>
-</tr>
- <tr>
-<td><span class="new_code">error()</span></td><td>Sends an exception event</td>
-</tr>
- <tr>
-<td><span class="new_code">sendMessage()</span></td><td>Sends a status message to those displays that support it</td>
-</tr>
- <tr>
-<td><span class="new_code">signal($type, $payload)</span></td><td>Sends a user defined message to the test reporter</td>
-</tr>
- <tr>
-<td><span class="new_code">dump($var)</span></td><td>Does a formatted <span class="new_code">print_r()</span> for quick and dirty debugging</td>
-</tr>
- <tr>
-<td><span class="new_code">swallowErrors()</span></td><td>Clears the error queue</td>
-</tr>
- </tbody>
-</table>
- </p>
-
- <p>
-<a class="target" name="extending_unit">
-<h2>Extending test cases</h2>
-</a>
-</p>
- <p>
- Of course additional test methods can be added to create
- specific types of test case too so as to extend framework...
-<pre>
-require_once('simpletest/unit_tester.php');
-<strong>
-class FileTester extends UnitTestCase {
- function FileTester($name = false) {
- $this-&gt;UnitTestCase($name);
- }
-
- function assertFileExists($filename, $message = '%s') {
- $this-&gt;assertTrue(
- file_exists($filename),
- sprintf($message, 'File [$filename] existence check'));
- }</strong>
-}
-</pre>
- Here the SimpleTest library is held in a folder called
- <em>simpletest</em> that is local.
- Substitute your own path for this.
- </p>
- <p>
- This new case can be now be inherited just like
- a normal test case...
-<pre>
-class FileTestCase extends <strong>FileTester</strong> {
-
- function setUp() {
- @unlink('../temp/test.txt');
- }
-
- function tearDown() {
- @unlink('../temp/test.txt');
- }
-
- function testCreation() {
- $writer = &amp;new FileWriter('../temp/test.txt');
- $writer-&gt;write('Hello');<strong>
- $this-&gt;assertFileExists('../temp/test.txt');</strong>
- }
-}
-</pre>
- </p>
- <p>
- If you want a test case that does not have all of the
- <span class="new_code">UnitTestCase</span> assertions,
- only your own and <span class="new_code">assertTrue()</span>,
- you need to extend the <span class="new_code">SimpleTestCase</span>
- class instead.
- It is found in <em>simple_test.php</em> rather than
- <em>unit_tester.php</em>.
- See <a href="group_test_documentation.html">later</a> if you
- want to incorporate other unit tester's
- test cases in your test suites.
- </p>
-
- <p>
-<a class="target" name="running_unit">
-<h2>Running a single test case</h2>
-</a>
-</p>
- <p>
- You won't often run single test cases except when bashing
- away at a module that is having difficulty and you don't
- want to upset the main test suite.
- Here is the scaffolding needed to run the a lone test case...
-<pre>
-&lt;?php
- require_once('simpletest/unit_tester.php');<strong>
- require_once('simpletest/reporter.php');</strong>
- require_once('../classes/writer.php');
-
- class FileTestCase extends UnitTestCase {
- function FileTestCase() {
- $this-&gt;UnitTestCase('File test');
- }
- }<strong>
-
- $test = &amp;new FileTestCase();
- $test-&gt;run(new HtmlReporter());</strong>
-?&gt;
-</pre>
- This script will run as is, but will output zero passes
- and zero failures until test methods are added.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/docs/en/web_tester_documentation.html b/tests/test_tools/simpletest/docs/en/web_tester_documentation.html
deleted file mode 100755
index 99dacacc..00000000
--- a/tests/test_tools/simpletest/docs/en/web_tester_documentation.html
+++ /dev/null
@@ -1,511 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>Simple Test for PHP web script testing documentation</title>
-<link rel="stylesheet" type="text/css" href="docs.css" title="Styles">
-</head>
-<body>
-<div class="menu_back">
-<div class="menu">
-<h2>
-<a href="index.html">SimpleTest</a>
-</h2>
-<ul>
-<li>
-<a href="overview.html">Overview</a>
-</li>
-<li>
-<a href="unit_test_documentation.html">Unit tester</a>
-</li>
-<li>
-<a href="group_test_documentation.html">Group tests</a>
-</li>
-<li>
-<a href="mock_objects_documentation.html">Mock objects</a>
-</li>
-<li>
-<a href="partial_mocks_documentation.html">Partial mocks</a>
-</li>
-<li>
-<a href="reporter_documentation.html">Reporting</a>
-</li>
-<li>
-<a href="expectation_documentation.html">Expectations</a>
-</li>
-<li>
-<span class="chosen">Web tester</span>
-</li>
-<li>
-<a href="form_testing_documentation.html">Testing forms</a>
-</li>
-<li>
-<a href="authentication_documentation.html">Authentication</a>
-</li>
-<li>
-<a href="browser_documentation.html">Scriptable browser</a>
-</li>
-</ul>
-</div>
-</div>
-<h1>Web tester documentation</h1>
-<div class="content">
- <p>
-<a class="target" name="fetch">
-<h2>Fetching a page</h2>
-</a>
-</p>
- <p>
- Testing classes is all very well, but PHP is predominately
- a language for creating functionality within web pages.
- How do we test the front end presentation role of our PHP
- applications?
- Well the web pages are just text, so we should be able to
- examine them just like any other test data.
- </p>
- <p>
- This leads to a tricky issue.
- If we test at too low a level, testing for matching tags
- in the page with pattern matching for example, our tests will
- be brittle.
- The slightest change in layout could break a large number of
- tests.
- If we test at too high a level, say using mock versions of a
- template engine, then we lose the ability to automate some classes
- of test.
- For example, the interaction of forms and navigation will
- have to be tested manually.
- These types of test are extremely repetitive and error prone.
- </p>
- <p>
- SimpleTest includes a special form of test case for the testing
- of web page actions.
- The <span class="new_code">WebTestCase</span> includes facilities
- for navigation, content and cookie checks and form handling.
- Usage of these test cases is similar to the
- <a href="unit_tester_documentation.html">UnitTestCase</a>...
-<pre>
-<strong>class TestOfLastcraft extends WebTestCase {
-}</strong>
-</pre>
- Here we are about to test the
- <a href="http://www/lastcraft.com/">Last Craft</a> site itself.
- If this test case is in a file called <em>lastcraft_test.php</em>
- then it can be loaded in a runner script just like unit tests...
-<pre>
-&lt;?php<strong>
- require_once('simpletest/web_tester.php');</strong>
- require_once('simpletest/reporter.php');
-
- $test = &amp;new GroupTest('Web site tests');<strong>
- $test-&gt;addTestFile('lastcraft_test.php');</strong>
- exit ($test-&gt;run(new TextReporter()) ? 0 : 1);
-?&gt;
-</pre>
- I am using the text reporter here to more clearly
- distinguish the web content from the test output.
- </p>
- <p>
- Nothing is being tested yet.
- We can fetch the home page by using the
- <span class="new_code">get()</span> method...
-<pre>
-class TestOfLastcraft extends WebTestCase {
- <strong>
- function testHomepage() {
- $this-&gt;assertTrue($this-&gt;get('http://www.lastcraft.com/'));
- }</strong>
-}
-</pre>
- The <span class="new_code">get()</span> method will
- return true only if page content was successfully
- loaded.
- It is a simple, but crude way to check that a web page
- was actually delivered by the web server.
- However that content may be a 404 response and yet
- our <span class="new_code">get()</span> method will still return true.
- </p>
- <p>
- Assuming that the web server for the Last Craft site is up
- (sadly not always the case), we should see...
-<pre class="shell">
-Web site tests
-OK
-Test cases run: 1/1, Failures: 0, Exceptions: 0
-</pre>
- All we have really checked is that any kind of page was
- returned.
- We don't yet know if it was the right one.
- </p>
-
- <p>
-<a class="target" name="content">
-<h2>Testing page content</h2>
-</a>
-</p>
- <p>
- To confirm that the page we think we are on is actually the
- page we are on, we need to verify the page content.
-<pre>
-class TestOfLastcraft extends WebTestCase {
-
- function testHomepage() {<strong>
- $this-&gt;get('http://www.lastcraft.com/');
- $this-&gt;assertTest('Why the last craft');</strong>
- }
-}
-</pre>
- The page from the last fetch is held in a buffer in
- the test case, so there is no need to refer to it directly.
- The pattern match is always made against the buffer.
- </p>
- <p>
- Here is the list of possible content assertions...
- <table>
-<tbody>
- <tr>
-<td><span class="new_code">assertTitle($title)</span></td><td>Pass if title is an exact match</td>
-</tr>
- <tr>
-<td><span class="new_code">assertPattern($pattern)</span></td><td>A Perl pattern match against the page content</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNoPattern($pattern)</span></td><td>A Perl pattern match to not find content</td>
-</tr>
- <tr>
-<td><span class="new_code">assertText($text)</span></td><td>Pass if matches visible and "alt" text</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNoText($text)</span></td><td>Pass if doesn't match visible and "alt" text</td>
-</tr>
- <tr>
-<td><span class="new_code">assertLink($label)</span></td><td>Pass if a link with this text is present</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNoLink($label)</span></td><td>Pass if no link with this text is present</td>
-</tr>
- <tr>
-<td><span class="new_code">assertLinkById($id)</span></td><td>Pass if a link with this id attribute is present</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNoLinkById($id)</span></td><td>Pass if no link with this id attribute is present</td>
-</tr>
- <tr>
-<td><span class="new_code">assertField($name, $value)</span></td><td>Pass if an input tag with this name has this value</td>
-</tr>
- <tr>
-<td><span class="new_code">assertFieldById($id, $value)</span></td><td>Pass if an input tag with this id has this value</td>
-</tr>
- <tr>
-<td><span class="new_code">assertResponse($codes)</span></td><td>Pass if HTTP response matches this list</td>
-</tr>
- <tr>
-<td><span class="new_code">assertMime($types)</span></td><td>Pass if MIME type is in this list</td>
-</tr>
- <tr>
-<td><span class="new_code">assertAuthentication($protocol)</span></td><td>Pass if the current challenge is this protocol</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNoAuthentication()</span></td><td>Pass if there is no current challenge</td>
-</tr>
- <tr>
-<td><span class="new_code">assertRealm($name)</span></td><td>Pass if the current challenge realm matches</td>
-</tr>
- <tr>
-<td><span class="new_code">assertHeader($header, $content)</span></td><td>Pass if a header was fetched matching this value</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNoHeader($header)</span></td><td>Pass if a header was not fetched</td>
-</tr>
- <tr>
-<td><span class="new_code">assertCookie($name, $value)</span></td><td>Pass if there is currently a matching cookie</td>
-</tr>
- <tr>
-<td><span class="new_code">assertNoCookie($name)</span></td><td>Pass if there is currently no cookie of this name</td>
-</tr>
- </tbody>
-</table>
- As usual with the SimpleTest assertions, they all return
- false on failure and true on pass.
- They also allow an optional test message and you can embed
- the original test message inside using "%s" inside
- your custom message.
- </p>
- <p>
- So now we could instead test against the title tag with...
-<pre>
-<strong>$this-&gt;assertTitle('The Last Craft? Web developer tutorials on PHP, Extreme programming and Object Oriented development');</strong>
-</pre>
- ...or, if that is too long and fragile...
-<pre>
-<strong>$this-&gt;assertTitle(new PatternExpectation('/The Last Craft/'));</strong>
-</pre>
- As well as the simple HTML content checks we can check
- that the MIME type is in a list of allowed types with...
-<pre>
-<strong>$this-&gt;assertMime(array('text/plain', 'text/html'));</strong>
-</pre>
- More interesting is checking the HTTP response code.
- Like the MIME type, we can assert that the response code
- is in a list of allowed values...
-<pre>
-class TestOfLastcraft extends WebTestCase {
-
- function testRedirects() {
- $this-&gt;get('http://www.lastcraft.com/test/redirect.php');
- $this-&gt;assertResponse(200);&lt;/strong&gt;
- }
-}
-</pre>
- Here we are checking that the fetch is successful by
- allowing only a 200 HTTP response.
- This test will pass, but it is not actually correct to do so.
- There is no page, instead the server issues a redirect.
- The <span class="new_code">WebTestCase</span> will
- automatically follow up to three such redirects.
- The tests are more robust this way and we are usually
- interested in the interaction with the pages rather
- than their delivery.
- If the redirects are of interest then this ability must
- be disabled...
-<pre>
-class TestOfLastcraft extends WebTestCase {
-
- function testHomepage() {<strong>
- $this-&gt;setMaximumRedirects(0);</strong>
- $this-&gt;get('http://www.lastcraft.com/test/redirect.php');
- $this-&gt;assertResponse(200);
- }
-}
-</pre>
- The assertion now fails as expected...
-<pre class="shell">
-Web site tests
-1) Expecting response in [200] got [302]
- in testhomepage
- in testoflastcraft
- in lastcraft_test.php
-FAILURES!!!
-Test cases run: 1/1, Failures: 1, Exceptions: 0
-</pre>
- We can modify the test to correctly assert redirects with...
-<pre>
-class TestOfLastcraft extends WebTestCase {
-
- function testHomepage() {
- $this-&gt;setMaximumRedirects(0);
- $this-&gt;get('http://www.lastcraft.com/test/redirect.php');
- $this-&gt;assertResponse(<strong>array(301, 302, 303, 307)</strong>);
- }
-}
-</pre>
- This now passes.
- </p>
-
- <p>
-<a class="target" name="navigation">
-<h2>Navigating a web site</h2>
-</a>
-</p>
- <p>
- Users don't often navigate sites by typing in URLs, but by
- clicking links and buttons.
- Here we confirm that the contact details can be reached
- from the home page...
-<pre>
-class TestOfLastcraft extends WebTestCase {
- ...
- function testContact() {
- $this-&gt;get('http://www.lastcraft.com/');<strong>
- $this-&gt;clickLink('About');
- $this-&gt;assertTitle(new PatternExpectation('/About Last Craft/'));</strong>
- }
-}
-</pre>
- The parameter is the text of the link.
- </p>
- <p>
- If the target is a button rather than an anchor tag, then
- <span class="new_code">clickSubmit()</span> can be used
- with the button title...
-<pre>
-<strong>$this-&gt;clickSubmit('Go!');</strong>
-</pre>
- If you are not sure or don't care, the usual case, then just
- use the <span class="new_code">click()</span> method...
-<pre>
-<strong>$this-&gt;click('Go!');</strong>
-</pre>
- </p>
- <p>
- The list of navigation methods is...
- <table>
-<tbody>
- <tr>
-<td><span class="new_code">getUrl()</span></td><td>The current location</td>
-</tr>
- <tr>
-<td><span class="new_code">get($url, $parameters)</span></td><td>Send a GET request with these parameters</td>
-</tr>
- <tr>
-<td><span class="new_code">post($url, $parameters)</span></td><td>Send a POST request with these parameters</td>
-</tr>
- <tr>
-<td><span class="new_code">head($url, $parameters)</span></td><td>Send a HEAD request without replacing the page content</td>
-</tr>
- <tr>
-<td><span class="new_code">retry()</span></td><td>Reload the last request</td>
-</tr>
- <tr>
-<td><span class="new_code">back()</span></td><td>Like the browser back button</td>
-</tr>
- <tr>
-<td><span class="new_code">forward()</span></td><td>Like the browser forward button</td>
-</tr>
- <tr>
-<td><span class="new_code">authenticate($name, $password)</span></td><td>Retry after a challenge</td>
-</tr>
- <tr>
-<td><span class="new_code">restart()</span></td><td>Restarts the browser as if a new session</td>
-</tr>
- <tr>
-<td><span class="new_code">getCookie($name)</span></td><td>Gets the cookie value for the current context</td>
-</tr>
- <tr>
-<td><span class="new_code">ageCookies($interval)</span></td><td>Ages current cookies prior to a restart</td>
-</tr>
- <tr>
-<td><span class="new_code">clearFrameFocus()</span></td><td>Go back to treating all frames as one page</td>
-</tr>
- <tr>
-<td><span class="new_code">clickSubmit($label)</span></td><td>Click the first button with this label</td>
-</tr>
- <tr>
-<td><span class="new_code">clickSubmitByName($name)</span></td><td>Click the button with this name attribute</td>
-</tr>
- <tr>
-<td><span class="new_code">clickSubmitById($id)</span></td><td>Click the button with this ID attribute</td>
-</tr>
- <tr>
-<td><span class="new_code">clickImage($label, $x, $y)</span></td><td>Click an input tag of type image by title or alt text</td>
-</tr>
- <tr>
-<td><span class="new_code">clickImageByName($name, $x, $y)</span></td><td>Click an input tag of type image by name</td>
-</tr>
- <tr>
-<td><span class="new_code">clickImageById($id, $x, $y)</span></td><td>Click an input tag of type image by ID attribute</td>
-</tr>
- <tr>
-<td><span class="new_code">submitFormById($id)</span></td><td>Submit a form without the submit value</td>
-</tr>
- <tr>
-<td><span class="new_code">clickLink($label, $index)</span></td><td>Click an anchor by the visible label text</td>
-</tr>
- <tr>
-<td><span class="new_code">clickLinkById($id)</span></td><td>Click an anchor by the ID attribute</td>
-</tr>
- <tr>
-<td><span class="new_code">getFrameFocus()</span></td><td>The name of the currently selected frame</td>
-</tr>
- <tr>
-<td><span class="new_code">setFrameFocusByIndex($choice)</span></td><td>Focus on a frame counting from 1</td>
-</tr>
- <tr>
-<td><span class="new_code">setFrameFocus($name)</span></td><td>Focus on a frame by name</td>
-</tr>
- </tbody>
-</table>
- </p>
- <p>
- The parameters in the <span class="new_code">get()</span>, <span class="new_code">post()</span> or
- <span class="new_code">head()</span> methods are optional.
- The HTTP HEAD fetch does not change the browser context, only loads
- cookies.
- This can be useful for when an image or stylesheet sets a cookie
- for crafty robot blocking.
- </p>
- <p>
- The <span class="new_code">retry()</span>, <span class="new_code">back()</span> and
- <span class="new_code">forward()</span> commands work as they would on
- your web browser.
- They use the history to retry pages.
- This can be handy for checking the effect of hitting the
- back button on your forms.
- </p>
- <p>
- The frame methods need a little explanation.
- By default a framed page is treated just like any other.
- Content will be searced for throughout the entire frameset,
- so clicking a link will work no matter which frame
- the anchor tag is in.
- You can override this behaviour by focusing on a single
- frame.
- If you do that, all searches and actions will apply to that
- frame alone, such as authentication and retries.
- If a link or button is not in a focused frame then it cannot
- be clicked.
- </p>
- <p>
- Testing navigation on fixed pages only tells you when you
- have broken an entire script.
- For highly dynamic pages, such as for bulletin boards, this can
- be crucial for verifying the correctness of the application.
- For most applications though, the really tricky logic is usually in
- the handling of forms and sessions.
- Fortunately SimpleTest includes
- <a href="form_testing_documentation.html">tools for testing web forms</a>
- as well.
- </p>
-
- <p>
-<a class="target" name="request">
-<h2>Modifying the request</h2>
-</a>
-</p>
- <p>
- Although SimpleTest does not have the goal of testing networking
- problems, it does include some methods to modify and debug
- the requests it makes.
- Here is another method list...
- <table>
-<tbody>
- <tr>
-<td><span class="new_code">getTransportError()</span></td><td>The last socket error</td>
-</tr>
- <tr>
-<td><span class="new_code">showRequest()</span></td><td>Dump the outgoing request</td>
-</tr>
- <tr>
-<td><span class="new_code">showHeaders()</span></td><td>Dump the incoming headers</td>
-</tr>
- <tr>
-<td><span class="new_code">showSource()</span></td><td>Dump the raw HTML page content</td>
-</tr>
- <tr>
-<td><span class="new_code">ignoreFrames()</span></td><td>Do not load framesets</td>
-</tr>
- <tr>
-<td><span class="new_code">setCookie($name, $value)</span></td><td>Set a cookie from now on</td>
-</tr>
- <tr>
-<td><span class="new_code">addHeader($header)</span></td><td>Always add this header to the request</td>
-</tr>
- <tr>
-<td><span class="new_code">setMaximumRedirects($max)</span></td><td>Stop after this many redirects</td>
-</tr>
- <tr>
-<td><span class="new_code">setConnectionTimeout($timeout)</span></td><td>Kill the connection after this time between bytes</td>
-</tr>
- <tr>
-<td><span class="new_code">useProxy($proxy, $name, $password)</span></td><td>Make requests via this proxy URL</td>
-</tr>
- </tbody>
-</table>
- These methods are principally for debugging.
- </p>
-
- </div>
-<div class="copyright">
- Copyright<br>Marcus Baker, Jason Sweat, Perrick Penet 2004
- </div>
-</body>
-</html>
diff --git a/tests/test_tools/simpletest/dumper.php b/tests/test_tools/simpletest/dumper.php
deleted file mode 100644
index 9c3f745a..00000000
--- a/tests/test_tools/simpletest/dumper.php
+++ /dev/null
@@ -1,401 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: dumper.php 1532 2006-12-01 12:28:55Z xue $
- */
- /**
- * does type matter
- */
- if (! defined('TYPE_MATTERS')) {
- define('TYPE_MATTERS', true);
- }
-
- /**
- * Displays variables as text and does diffs.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleDumper {
-
- /**
- * Renders a variable in a shorter form than print_r().
- * @param mixed $value Variable to render as a string.
- * @return string Human readable string form.
- * @access public
- */
- function describeValue($value) {
- $type = $this->getType($value);
- switch($type) {
- case "Null":
- return "NULL";
- case "Boolean":
- return "Boolean: " . ($value ? "true" : "false");
- case "Array":
- return "Array: " . count($value) . " items";
- case "Object":
- return "Object: of " . get_class($value);
- case "String":
- return "String: " . $this->clipString($value, 200);
- default:
- return "$type: $value";
- }
- return "Unknown";
- }
-
- /**
- * Gets the string representation of a type.
- * @param mixed $value Variable to check against.
- * @return string Type.
- * @access public
- */
- function getType($value) {
- if (! isset($value)) {
- return "Null";
- } elseif (is_bool($value)) {
- return "Boolean";
- } elseif (is_string($value)) {
- return "String";
- } elseif (is_integer($value)) {
- return "Integer";
- } elseif (is_float($value)) {
- return "Float";
- } elseif (is_array($value)) {
- return "Array";
- } elseif (is_resource($value)) {
- return "Resource";
- } elseif (is_object($value)) {
- return "Object";
- }
- return "Unknown";
- }
-
- /**
- * Creates a human readable description of the
- * difference between two variables. Uses a
- * dynamic call.
- * @param mixed $first First variable.
- * @param mixed $second Value to compare with.
- * @param boolean $identical If true then type anomolies count.
- * @return string Description of difference.
- * @access public
- */
- function describeDifference($first, $second, $identical = false) {
- if ($identical) {
- if (! $this->_isTypeMatch($first, $second)) {
- return "with type mismatch as [" . $this->describeValue($first) .
- "] does not match [" . $this->describeValue($second) . "]";
- }
- }
- $type = $this->getType($first);
- if ($type == "Unknown") {
- return "with unknown type";
- }
- $method = '_describe' . $type . 'Difference';
- return $this->$method($first, $second, $identical);
- }
-
- /**
- * Tests to see if types match.
- * @param mixed $first First variable.
- * @param mixed $second Value to compare with.
- * @return boolean True if matches.
- * @access private
- */
- function _isTypeMatch($first, $second) {
- return ($this->getType($first) == $this->getType($second));
- }
-
- /**
- * Clips a string to a maximum length.
- * @param string $value String to truncate.
- * @param integer $size Minimum string size to show.
- * @param integer $position Centre of string section.
- * @return string Shortened version.
- * @access public
- */
- function clipString($value, $size, $position = 0) {
- $length = strlen($value);
- if ($length <= $size) {
- return $value;
- }
- $position = min($position, $length);
- $start = ($size/2 > $position ? 0 : $position - $size/2);
- if ($start + $size > $length) {
- $start = $length - $size;
- }
- $value = substr($value, $start, $size);
- return ($start > 0 ? "..." : "") . $value . ($start + $size < $length ? "..." : "");
- }
-
- /**
- * Creates a human readable description of the
- * difference between two variables. The minimal
- * version.
- * @param null $first First value.
- * @param mixed $second Value to compare with.
- * @return string Human readable description.
- * @access private
- */
- function _describeGenericDifference($first, $second) {
- return "as [" . $this->describeValue($first) .
- "] does not match [" .
- $this->describeValue($second) . "]";
- }
-
- /**
- * Creates a human readable description of the
- * difference between a null and another variable.
- * @param null $first First null.
- * @param mixed $second Null to compare with.
- * @param boolean $identical If true then type anomolies count.
- * @return string Human readable description.
- * @access private
- */
- function _describeNullDifference($first, $second, $identical) {
- return $this->_describeGenericDifference($first, $second);
- }
-
- /**
- * Creates a human readable description of the
- * difference between a boolean and another variable.
- * @param boolean $first First boolean.
- * @param mixed $second Boolean to compare with.
- * @param boolean $identical If true then type anomolies count.
- * @return string Human readable description.
- * @access private
- */
- function _describeBooleanDifference($first, $second, $identical) {
- return $this->_describeGenericDifference($first, $second);
- }
-
- /**
- * Creates a human readable description of the
- * difference between a string and another variable.
- * @param string $first First string.
- * @param mixed $second String to compare with.
- * @param boolean $identical If true then type anomolies count.
- * @return string Human readable description.
- * @access private
- */
- function _describeStringDifference($first, $second, $identical) {
- if (is_object($second) || is_array($second)) {
- return $this->_describeGenericDifference($first, $second);
- }
- $position = $this->_stringDiffersAt($first, $second);
- $message = "at character $position";
- $message .= " with [" .
- $this->clipString($first, 200, $position) . "] and [" .
- $this->clipString($second, 200, $position) . "]";
- return $message;
- }
-
- /**
- * Creates a human readable description of the
- * difference between an integer and another variable.
- * @param integer $first First number.
- * @param mixed $second Number to compare with.
- * @param boolean $identical If true then type anomolies count.
- * @return string Human readable description.
- * @access private
- */
- function _describeIntegerDifference($first, $second, $identical) {
- if (is_object($second) || is_array($second)) {
- return $this->_describeGenericDifference($first, $second);
- }
- return "because [" . $this->describeValue($first) .
- "] differs from [" .
- $this->describeValue($second) . "] by " .
- abs($first - $second);
- }
-
- /**
- * Creates a human readable description of the
- * difference between two floating point numbers.
- * @param float $first First float.
- * @param mixed $second Float to compare with.
- * @param boolean $identical If true then type anomolies count.
- * @return string Human readable description.
- * @access private
- */
- function _describeFloatDifference($first, $second, $identical) {
- if (is_object($second) || is_array($second)) {
- return $this->_describeGenericDifference($first, $second);
- }
- return "because [" . $this->describeValue($first) .
- "] differs from [" .
- $this->describeValue($second) . "] by " .
- abs($first - $second);
- }
-
- /**
- * Creates a human readable description of the
- * difference between two arrays.
- * @param array $first First array.
- * @param mixed $second Array to compare with.
- * @param boolean $identical If true then type anomolies count.
- * @return string Human readable description.
- * @access private
- */
- function _describeArrayDifference($first, $second, $identical) {
- if (! is_array($second)) {
- return $this->_describeGenericDifference($first, $second);
- }
- if (! $this->_isMatchingKeys($first, $second, $identical)) {
- return "as key list [" .
- implode(", ", array_keys($first)) . "] does not match key list [" .
- implode(", ", array_keys($second)) . "]";
- }
- foreach (array_keys($first) as $key) {
- if ($identical && ($first[$key] === $second[$key])) {
- continue;
- }
- if (! $identical && ($first[$key] == $second[$key])) {
- continue;
- }
- return "with member [$key] " . $this->describeDifference(
- $first[$key],
- $second[$key],
- $identical);
- }
- return "";
- }
-
- /**
- * Compares two arrays to see if their key lists match.
- * For an identical match, the ordering and types of the keys
- * is significant.
- * @param array $first First array.
- * @param array $second Array to compare with.
- * @param boolean $identical If true then type anomolies count.
- * @return boolean True if matching.
- * @access private
- */
- function _isMatchingKeys($first, $second, $identical) {
- $first_keys = array_keys($first);
- $second_keys = array_keys($second);
- if ($identical) {
- return ($first_keys === $second_keys);
- }
- sort($first_keys);
- sort($second_keys);
- return ($first_keys == $second_keys);
- }
-
- /**
- * Creates a human readable description of the
- * difference between a resource and another variable.
- * @param resource $first First resource.
- * @param mixed $second Resource to compare with.
- * @param boolean $identical If true then type anomolies count.
- * @return string Human readable description.
- * @access private
- */
- function _describeResourceDifference($first, $second, $identical) {
- return $this->_describeGenericDifference($first, $second);
- }
-
- /**
- * Creates a human readable description of the
- * difference between two objects.
- * @param object $first First object.
- * @param mixed $second Object to compare with.
- * @param boolean $identical If true then type anomolies count.
- * @return string Human readable description.
- * @access private
- */
- function _describeObjectDifference($first, $second, $identical) {
- if (! is_object($second)) {
- return $this->_describeGenericDifference($first, $second);
- }
- return $this->_describeArrayDifference(
- get_object_vars($first),
- get_object_vars($second),
- $identical);
- }
-
- /**
- * Find the first character position that differs
- * in two strings by binary chop.
- * @param string $first First string.
- * @param string $second String to compare with.
- * @return integer Position of first differing
- * character.
- * @access private
- */
- function _stringDiffersAt($first, $second) {
- if (! $first || ! $second) {
- return 0;
- }
- if (strlen($first) < strlen($second)) {
- list($first, $second) = array($second, $first);
- }
- $position = 0;
- $step = strlen($first);
- while ($step > 1) {
- $step = (integer)(($step + 1) / 2);
- if (strncmp($first, $second, $position + $step) == 0) {
- $position += $step;
- }
- }
- return $position;
- }
-
- /**
- * Sends a formatted dump of a variable to a string.
- * @param mixed $variable Variable to display.
- * @return string Output from print_r().
- * @access public
- * @static
- */
- static function dump($variable) {
- ob_start();
- print_r($variable);
- $formatted = ob_get_contents();
- ob_end_clean();
- return $formatted;
- }
-
- /**
- * Extracts the last assertion that was not within
- * Simpletest itself. The name must start with "assert".
- * @param array $stack List of stack frames.
- * @access public
- * @static
- */
- static function getFormattedAssertionLine($stack) {
- foreach ($stack as $frame) {
- if (isset($frame['file'])) {
- if (strpos($frame['file'], SIMPLE_TEST) !== false) {
- if (dirname($frame['file']) . '/' == SIMPLE_TEST) {
- continue;
- }
- }
- }
- if (SimpleDumper::_stackFrameIsAnAssertion($frame)) {
- return ' at [' . $frame['file'] . ' line ' . $frame['line'] . ']';
- }
- }
- return '';
- }
-
- /**
- * Tries to determine if the method call is an assertion.
- * @param array $frame PHP stack frame.
- * @access private
- * @static
- */
- static function _stackFrameIsAnAssertion($frame) {
- if (($frame['function'] == 'fail') || ($frame['function'] == 'pass')) {
- return true;
- }
- if (strncmp($frame['function'], 'assert', 6) == 0) {
- return true;
- }
- if (strncmp($frame['function'], 'expect', 6) == 0) {
- return true;
- }
- return false;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/encoding.php b/tests/test_tools/simpletest/encoding.php
deleted file mode 100644
index ca2083a3..00000000
--- a/tests/test_tools/simpletest/encoding.php
+++ /dev/null
@@ -1,520 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: encoding.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/socket.php');
- /**#@-*/
-
- /**
- * Single post parameter.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleEncodedPair {
- protected $_key;
- protected $_value;
-
- /**
- * Stashes the data for rendering later.
- * @param string $key Form element name.
- * @param string $value Data to send.
- */
- function SimpleEncodedPair($key, $value) {
- $this->_key = $key;
- $this->_value = $value;
- }
-
- /**
- * The pair as a single string.
- * @return string Encoded pair.
- * @access public
- */
- function asRequest() {
- return $this->_key . '=' . urlencode($this->_value);
- }
-
- /**
- * The MIME part as a string.
- * @return string MIME part encoding.
- * @access public
- */
- function asMime() {
- $part = 'Content-Disposition: form-data; ';
- $part .= "name=\"" . $this->_key . "\"\r\n";
- $part .= "\r\n" . $this->_value;
- return $part;
- }
-
- /**
- * Is this the value we are looking for?
- * @param string $key Identifier.
- * @return boolean True if matched.
- * @access public
- */
- function isKey($key) {
- return $key == $this->_key;
- }
-
- /**
- * Is this the value we are looking for?
- * @return string Identifier.
- * @access public
- */
- function getKey() {
- return $this->_key;
- }
-
- /**
- * Is this the value we are looking for?
- * @return string Content.
- * @access public
- */
- function getValue() {
- return $this->_value;
- }
- }
-
- /**
- * Single post parameter.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleAttachment {
- protected $_key;
- protected $_content;
- protected $_filename;
-
- /**
- * Stashes the data for rendering later.
- * @param string $key Key to add value to.
- * @param string $content Raw data.
- * @param hash $filename Original filename.
- */
- function SimpleAttachment($key, $content, $filename) {
- $this->_key = $key;
- $this->_content = $content;
- $this->_filename = $filename;
- }
-
- /**
- * The pair as a single string.
- * @return string Encoded pair.
- * @access public
- */
- function asRequest() {
- return '';
- }
-
- /**
- * The MIME part as a string.
- * @return string MIME part encoding.
- * @access public
- */
- function asMime() {
- $part = 'Content-Disposition: form-data; ';
- $part .= 'name="' . $this->_key . '"; ';
- $part .= 'filename="' . $this->_filename . '"';
- $part .= "\r\nContent-Type: " . $this->_deduceMimeType();
- $part .= "\r\n\r\n" . $this->_content;
- return $part;
- }
-
- /**
- * Attempts to figure out the MIME type from the
- * file extension and the content.
- * @return string MIME type.
- * @access private
- */
- function _deduceMimeType() {
- if ($this->_isOnlyAscii($this->_content)) {
- return 'text/plain';
- }
- return 'application/octet-stream';
- }
-
- /**
- * Tests each character is in the range 0-127.
- * @param string $ascii String to test.
- * @access private
- */
- function _isOnlyAscii($ascii) {
- for ($i = 0, $length = strlen($ascii); $i < $length; $i++) {
- if (ord($ascii[$i]) > 127) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Is this the value we are looking for?
- * @param string $key Identifier.
- * @return boolean True if matched.
- * @access public
- */
- function isKey($key) {
- return $key == $this->_key;
- }
-
- /**
- * Is this the value we are looking for?
- * @return string Identifier.
- * @access public
- */
- function getKey() {
- return $this->_key;
- }
-
- /**
- * Is this the value we are looking for?
- * @return string Content.
- * @access public
- */
- function getValue() {
- return $this->_filename;
- }
- }
-
- /**
- * Bundle of GET/POST parameters. Can include
- * repeated parameters.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleEncoding {
- protected $_request;
-
- /**
- * Starts empty.
- * @param array $query Hash of parameters.
- * Multiple values are
- * as lists on a single key.
- * @access public
- */
- function SimpleEncoding($query = false) {
- if (! $query) {
- $query = array();
- }
- $this->clear();
- $this->merge($query);
- }
-
- /**
- * Empties the request of parameters.
- * @access public
- */
- function clear() {
- $this->_request = array();
- }
-
- /**
- * Adds a parameter to the query.
- * @param string $key Key to add value to.
- * @param string/array $value New data.
- * @access public
- */
- function add($key, $value) {
- if ($value === false) {
- return;
- }
- if (is_array($value)) {
- foreach ($value as $item) {
- $this->_addPair($key, $item);
- }
- } else {
- $this->_addPair($key, $value);
- }
- }
-
- /**
- * Adds a new value into the request.
- * @param string $key Key to add value to.
- * @param string/array $value New data.
- * @access private
- */
- function _addPair($key, $value) {
- $this->_request[] = new SimpleEncodedPair($key, $value);
- }
-
- /**
- * Adds a MIME part to the query. Does nothing for a
- * form encoded packet.
- * @param string $key Key to add value to.
- * @param string $content Raw data.
- * @param hash $filename Original filename.
- * @access public
- */
- function attach($key, $content, $filename) {
- $this->_request[] = new SimpleAttachment($key, $content, $filename);
- }
-
- /**
- * Adds a set of parameters to this query.
- * @param array/SimpleQueryString $query Multiple values are
- * as lists on a single key.
- * @access public
- */
- function merge($query) {
- if (is_object($query)) {
- $this->_request = array_merge($this->_request, $query->getAll());
- } elseif (is_array($query)) {
- foreach ($query as $key => $value) {
- $this->add($key, $value);
- }
- }
- }
-
- /**
- * Accessor for single value.
- * @return string/array False if missing, string
- * if present and array if
- * multiple entries.
- * @access public
- */
- function getValue($key) {
- $values = array();
- foreach ($this->_request as $pair) {
- if ($pair->isKey($key)) {
- $values[] = $pair->getValue();
- }
- }
- if (count($values) == 0) {
- return false;
- } elseif (count($values) == 1) {
- return $values[0];
- } else {
- return $values;
- }
- }
-
- /**
- * Accessor for listing of pairs.
- * @return array All pair objects.
- * @access public
- */
- function getAll() {
- return $this->_request;
- }
-
- /**
- * Renders the query string as a URL encoded
- * request part.
- * @return string Part of URL.
- * @access protected
- */
- function _encode() {
- $statements = array();
- foreach ($this->_request as $pair) {
- if ($statement = $pair->asRequest()) {
- $statements[] = $statement;
- }
- }
- return implode('&', $statements);
- }
- }
-
- /**
- * Bundle of GET parameters. Can include
- * repeated parameters.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleGetEncoding extends SimpleEncoding {
-
- /**
- * Starts empty.
- * @param array $query Hash of parameters.
- * Multiple values are
- * as lists on a single key.
- * @access public
- */
- function SimpleGetEncoding($query = false) {
- $this->SimpleEncoding($query);
- }
-
- /**
- * HTTP request method.
- * @return string Always GET.
- * @access public
- */
- function getMethod() {
- return 'GET';
- }
-
- /**
- * Writes no extra headers.
- * @param SimpleSocket $socket Socket to write to.
- * @access public
- */
- function writeHeadersTo($socket) {
- }
-
- /**
- * No data is sent to the socket as the data is encoded into
- * the URL.
- * @param SimpleSocket $socket Socket to write to.
- * @access public
- */
- function writeTo($socket) {
- }
-
- /**
- * Renders the query string as a URL encoded
- * request part for attaching to a URL.
- * @return string Part of URL.
- * @access public
- */
- function asUrlRequest() {
- return $this->_encode();
- }
- }
-
- /**
- * Bundle of URL parameters for a HEAD request.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleHeadEncoding extends SimpleGetEncoding {
-
- /**
- * Starts empty.
- * @param array $query Hash of parameters.
- * Multiple values are
- * as lists on a single key.
- * @access public
- */
- function SimpleHeadEncoding($query = false) {
- $this->SimpleGetEncoding($query);
- }
-
- /**
- * HTTP request method.
- * @return string Always HEAD.
- * @access public
- */
- function getMethod() {
- return 'HEAD';
- }
- }
-
- /**
- * Bundle of POST parameters. Can include
- * repeated parameters.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimplePostEncoding extends SimpleEncoding {
-
- /**
- * Starts empty.
- * @param array $query Hash of parameters.
- * Multiple values are
- * as lists on a single key.
- * @access public
- */
- function SimplePostEncoding($query = false) {
- $this->SimpleEncoding($query);
- }
-
- /**
- * HTTP request method.
- * @return string Always POST.
- * @access public
- */
- function getMethod() {
- return 'POST';
- }
-
- /**
- * Dispatches the form headers down the socket.
- * @param SimpleSocket $socket Socket to write to.
- * @access public
- */
- function writeHeadersTo($socket) {
- $socket->write("Content-Length: " . (integer)strlen($this->_encode()) . "\r\n");
- $socket->write("Content-Type: application/x-www-form-urlencoded\r\n");
- }
-
- /**
- * Dispatches the form data down the socket.
- * @param SimpleSocket $socket Socket to write to.
- * @access public
- */
- function writeTo($socket) {
- $socket->write($this->_encode());
- }
-
- /**
- * Renders the query string as a URL encoded
- * request part for attaching to a URL.
- * @return string Part of URL.
- * @access public
- */
- function asUrlRequest() {
- return '';
- }
- }
-
- /**
- * Bundle of POST parameters in the multipart
- * format. Can include file uploads.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleMultipartEncoding extends SimplePostEncoding {
- protected $_boundary;
-
- /**
- * Starts empty.
- * @param array $query Hash of parameters.
- * Multiple values are
- * as lists on a single key.
- * @access public
- */
- function SimpleMultipartEncoding($query = false, $boundary = false) {
- $this->SimplePostEncoding($query);
- $this->_boundary = ($boundary === false ? uniqid('st') : $boundary);
- }
-
- /**
- * Dispatches the form headers down the socket.
- * @param SimpleSocket $socket Socket to write to.
- * @access public
- */
- function writeHeadersTo($socket) {
- $socket->write("Content-Length: " . (integer)strlen($this->_encode()) . "\r\n");
- $socket->write("Content-Type: multipart/form-data, boundary=" . $this->_boundary . "\r\n");
- }
-
- /**
- * Dispatches the form data down the socket.
- * @param SimpleSocket $socket Socket to write to.
- * @access public
- */
- function writeTo($socket) {
- $socket->write($this->_encode());
- }
-
- /**
- * Renders the query string as a URL encoded
- * request part.
- * @return string Part of URL.
- * @access public
- */
- function _encode() {
- $stream = '';
- foreach ($this->_request as $pair) {
- $stream .= "--" . $this->_boundary . "\r\n";
- $stream .= $pair->asMime() . "\r\n";
- }
- $stream .= "--" . $this->_boundary . "--\r\n";
- return $stream;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/errors.php b/tests/test_tools/simpletest/errors.php
deleted file mode 100644
index c10d68a5..00000000
--- a/tests/test_tools/simpletest/errors.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: errors.php 1606 2007-01-09 10:42:06Z wei $
- */
-
- /** @ignore - PHP5 compatibility fix. */
- if (! defined('E_STRICT')) {
- define('E_STRICT', 2048);
- }
-
- /**#@+
- * Includes SimpleTest files.
- */
- require_once(dirname(__FILE__) . '/invoker.php');
-
- /**
- * Extension that traps errors into an error queue.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleErrorTrappingInvoker extends SimpleInvokerDecorator {
-
- /**
- * Stores the invoker to wrap.
- * @param SimpleInvoker $invoker Test method runner.
- */
- function SimpleErrorTrappingInvoker($invoker) {
- $this->SimpleInvokerDecorator($invoker);
- }
-
- /**
- * Invokes a test method and dispatches any
- * untrapped errors. Called back from
- * the visiting runner.
- * @param string $method Test method to call.
- * @access public
- */
- function invoke($method) {
- set_error_handler('simpleTestErrorHandler');
- parent::invoke($method);
- $queue = SimpleErrorQueue::instance();
- while (list($severity, $message, $file, $line, $globals) = $queue->extract()) {
- $severity = SimpleErrorQueue::getSeverityAsString($severity);
- $test_case = $this->getTestCase();
- $test_case->error($severity, $message, $file, $line);
- }
- restore_error_handler();
- }
- }
-
- /**
- * Singleton error queue used to record trapped
- * errors.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleErrorQueue {
- protected $_queue;
-
- /**
- * Starts with an empty queue.
- * @access public
- */
- function SimpleErrorQueue() {
- $this->clear();
- }
-
- /**
- * Adds an error to the front of the queue.
- * @param $severity PHP error code.
- * @param $message Text of error.
- * @param $filename File error occoured in.
- * @param $line Line number of error.
- * @param $super_globals Hash of PHP super global arrays.
- * @access public
- */
- function add($severity, $message, $filename, $line, $super_globals) {
- array_push(
- $this->_queue,
- array($severity, $message, $filename, $line, $super_globals));
- }
-
- /**
- * Pulls the earliest error from the queue.
- * @return False if none, or a list of error
- * information. Elements are: severity
- * as the PHP error code, the error message,
- * the file with the error, the line number
- * and a list of PHP super global arrays.
- * @access public
- */
- function extract() {
- if (count($this->_queue)) {
- return array_shift($this->_queue);
- }
- return false;
- }
-
- /**
- * Discards the contents of the error queue.
- * @access public
- */
- function clear() {
- $this->_queue = array();
- }
-
- /**
- * Tests to see if the queue is empty.
- * @return True if empty.
- */
- function isEmpty() {
- return (count($this->_queue) == 0);
- }
-
- /**
- * Global access to a single error queue.
- * @return Global error queue object.
- * @access public
- * @static
- */
- static function instance() {
- static $queue = false;
- if (! $queue) {
- $queue = new SimpleErrorQueue();
- }
- return $queue;
- }
-
- /**
- * Converst an error code into it's string
- * representation.
- * @param $severity PHP integer error code.
- * @return String version of error code.
- * @access public
- * @static
- */
- static function getSeverityAsString($severity) {
- static $map = array(
- E_STRICT => 'E_STRICT',
- E_ERROR => 'E_ERROR',
- E_WARNING => 'E_WARNING',
- E_PARSE => 'E_PARSE',
- E_NOTICE => 'E_NOTICE',
- E_CORE_ERROR => 'E_CORE_ERROR',
- E_CORE_WARNING => 'E_CORE_WARNING',
- E_COMPILE_ERROR => 'E_COMPILE_ERROR',
- E_COMPILE_WARNING => 'E_COMPILE_WARNING',
- E_USER_ERROR => 'E_USER_ERROR',
- E_USER_WARNING => 'E_USER_WARNING',
- E_USER_NOTICE => 'E_USER_NOTICE', 4096 => 'E??');
- return $map[$severity];
- }
- }
-
- /**
- * Error handler that simply stashes any errors into the global
- * error queue. Simulates the existing behaviour with respect to
- * logging errors, but this feature may be removed in future.
- * @param $severity PHP error code.
- * @param $message Text of error.
- * @param $filename File error occoured in.
- * @param $line Line number of error.
- * @param $super_globals Hash of PHP super global arrays.
- * @static
- * @access public
- */
- function simpleTestErrorHandler($severity, $message, $filename, $line, $super_globals) {
- if ($severity = $severity & error_reporting()) {
- restore_error_handler();
- if (ini_get('log_errors')) {
- $label = SimpleErrorQueue::getSeverityAsString($severity);
- error_log("$label: $message in $filename on line $line");
- }
- $queue = SimpleErrorQueue::instance();
- $queue->add($severity, $message, $filename, $line, $super_globals);
- set_error_handler('simpleTestErrorHandler');
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/exceptions.php b/tests/test_tools/simpletest/exceptions.php
deleted file mode 100644
index 30d35386..00000000
--- a/tests/test_tools/simpletest/exceptions.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: exceptions.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * Includes SimpleTest files and defined the root constant
- * for dependent libraries.
- */
- require_once(dirname(__FILE__) . '/invoker.php');
-
- /**
- * Extension that traps exceptions and turns them into
- * an error message.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleExceptionTrappingInvoker extends SimpleInvokerDecorator {
-
- /**
- * Stores the invoker to be wrapped.
- * @param SimpleInvoker $invoker Test method runner.
- */
- function SimpleExceptionTrappingInvoker($invoker) {
- $this->SimpleInvokerDecorator($invoker);
- }
-
- /**
- * Invokes a test method and dispatches any
- * untrapped errors.
- * @param string $method Test method to call.
- * @access public
- */
- function invoke($method) {
- try {
- parent::invoke($method);
- } catch (Exception $exception) {
- $test_case = $this->getTestCase();
- $test_case->exception($exception);
- }
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/expectation.php b/tests/test_tools/simpletest/expectation.php
deleted file mode 100644
index a660fa9c..00000000
--- a/tests/test_tools/simpletest/expectation.php
+++ /dev/null
@@ -1,719 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: expectation.php 1532 2006-12-01 12:28:55Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/dumper.php');
- require_once(dirname(__FILE__) . '/compatibility.php');
- /**#@-*/
-
- /**
- * Assertion that can display failure information.
- * Also includes various helper methods.
- * @package SimpleTest
- * @subpackage UnitTester
- * @abstract
- */
- class SimpleExpectation {
- protected $_dumper;
- protected $_message;
-
- /**
- * Creates a dumper for displaying values and sets
- * the test message.
- * @param string $message Customised message on failure.
- */
- function SimpleExpectation($message = '%s') {
- $this->_dumper = new SimpleDumper();
- $this->_message = $message;
- }
-
- /**
- * Tests the expectation. True if correct.
- * @param mixed $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- * @abstract
- */
- function test($compare) {
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- * @abstract
- */
- function testMessage($compare) {
- }
-
- /**
- * Overlays the generated message onto the stored user
- * message. An additional message can be interjected.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function overlayMessage($compare) {
- return sprintf($this->_message, $this->testMessage($compare));
- }
-
- /**
- * Accessor for the dumper.
- * @return SimpleDumper Current value dumper.
- * @access protected
- */
- function &_getDumper() {
- return $this->_dumper;
- }
-
- /**
- * Test to see if a value is an expectation object.
- * A useful utility method.
- * @param mixed $expectation Hopefully an Epectation
- * class.
- * @return boolean True if descended from
- * this class.
- * @access public
- * @static
- */
- static function isExpectation($expectation) {
- return is_object($expectation) &&
- SimpleTestCompatibility::isA($expectation, 'SimpleExpectation');
- }
- }
-
- /**
- * Test for equality.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class EqualExpectation extends SimpleExpectation {
- protected $_value;
-
- /**
- * Sets the value to compare against.
- * @param mixed $value Test value to match.
- * @param string $message Customised message on failure.
- * @access public
- */
- function EqualExpectation($value, $message = '%s') {
- $this->SimpleExpectation($message);
- $this->_value = $value;
- }
-
- /**
- * Tests the expectation. True if it matches the
- * held value.
- * @param mixed $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return (($this->_value == $compare) && ($compare == $this->_value));
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- if ($this->test($compare)) {
- return "Equal expectation [" . $this->_dumper->describeValue($this->_value) . "]";
- } else {
- return "Equal expectation fails " .
- $this->_dumper->describeDifference($this->_value, $compare);
- }
- }
-
- /**
- * Accessor for comparison value.
- * @return mixed Held value to compare with.
- * @access protected
- */
- function _getValue() {
- return $this->_value;
- }
- }
-
- /**
- * Test for inequality.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class NotEqualExpectation extends EqualExpectation {
-
- /**
- * Sets the value to compare against.
- * @param mixed $value Test value to match.
- * @param string $message Customised message on failure.
- * @access public
- */
- function NotEqualExpectation($value, $message = '%s') {
- $this->EqualExpectation($value, $message);
- }
-
- /**
- * Tests the expectation. True if it differs from the
- * held value.
- * @param mixed $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return ! parent::test($compare);
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- $dumper = $this->_getDumper();
- if ($this->test($compare)) {
- return "Not equal expectation passes " .
- $dumper->describeDifference($this->_getValue(), $compare);
- } else {
- return "Not equal expectation fails [" .
- $dumper->describeValue($this->_getValue()) .
- "] matches";
- }
- }
- }
-
- /**
- * Test for being within a range.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class WithinMarginExpectation extends SimpleExpectation {
- protected $_upper;
- protected $_lower;
-
- /**
- * Sets the value to compare against and the fuzziness of
- * the match. Used for comparing floating point values.
- * @param mixed $value Test value to match.
- * @param mixed $margin Fuzziness of match.
- * @param string $message Customised message on failure.
- * @access public
- */
- function WithinMarginExpectation($value, $margin, $message = '%s') {
- $this->SimpleExpectation($message);
- $this->_upper = $value + $margin;
- $this->_lower = $value - $margin;
- }
-
- /**
- * Tests the expectation. True if it matches the
- * held value.
- * @param mixed $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return (($compare <= $this->_upper) && ($compare >= $this->_lower));
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- if ($this->test($compare)) {
- return $this->_withinMessage($compare);
- } else {
- return $this->_outsideMessage($compare);
- }
- }
-
- /**
- * Creates a the message for being within the range.
- * @param mixed $compare Value being tested.
- * @access private
- */
- function _withinMessage($compare) {
- return "Within expectation [" . $this->_dumper->describeValue($this->_lower) . "] and [" .
- $this->_dumper->describeValue($this->_upper) . "]";
- }
-
- /**
- * Creates a the message for being within the range.
- * @param mixed $compare Value being tested.
- * @access private
- */
- function _outsideMessage($compare) {
- if ($compare > $this->_upper) {
- return "Outside expectation " .
- $this->_dumper->describeDifference($compare, $this->_upper);
- } else {
- return "Outside expectation " .
- $this->_dumper->describeDifference($compare, $this->_lower);
- }
- }
- }
-
- /**
- * Test for being outside of a range.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class OutsideMarginExpectation extends WithinMarginExpectation {
-
- /**
- * Sets the value to compare against and the fuzziness of
- * the match. Used for comparing floating point values.
- * @param mixed $value Test value to not match.
- * @param mixed $margin Fuzziness of match.
- * @param string $message Customised message on failure.
- * @access public
- */
- function OutsideMarginExpectation($value, $margin, $message = '%s') {
- $this->WithinMarginExpectation($value, $margin, $message);
- }
-
- /**
- * Tests the expectation. True if it matches the
- * held value.
- * @param mixed $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return ! parent::test($compare);
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- if (! $this->test($compare)) {
- return $this->_withinMessage($compare);
- } else {
- return $this->_outsideMessage($compare);
- }
- }
- }
-
- /**
- * Test for identity.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class IdenticalExpectation extends EqualExpectation {
-
- /**
- * Sets the value to compare against.
- * @param mixed $value Test value to match.
- * @param string $message Customised message on failure.
- * @access public
- */
- function IdenticalExpectation($value, $message = '%s') {
- $this->EqualExpectation($value, $message);
- }
-
- /**
- * Tests the expectation. True if it exactly
- * matches the held value.
- * @param mixed $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return SimpleTestCompatibility::isIdentical($this->_getValue(), $compare);
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- $dumper = $this->_getDumper();
- if ($this->test($compare)) {
- return "Identical expectation [" . $dumper->describeValue($this->_getValue()) . "]";
- } else {
- return "Identical expectation [" . $dumper->describeValue($this->_getValue()) .
- "] fails with [" .
- $dumper->describeValue($compare) . "] " .
- $dumper->describeDifference($this->_getValue(), $compare, TYPE_MATTERS);
- }
- }
- }
-
- /**
- * Test for non-identity.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class NotIdenticalExpectation extends IdenticalExpectation {
-
- /**
- * Sets the value to compare against.
- * @param mixed $value Test value to match.
- * @param string $message Customised message on failure.
- * @access public
- */
- function NotIdenticalExpectation($value, $message = '%s') {
- $this->IdenticalExpectation($value, $message);
- }
-
- /**
- * Tests the expectation. True if it differs from the
- * held value.
- * @param mixed $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return ! parent::test($compare);
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- $dumper = $this->_getDumper();
- if ($this->test($compare)) {
- return "Not identical expectation passes " .
- $dumper->describeDifference($this->_getValue(), $compare, TYPE_MATTERS);
- } else {
- return "Not identical expectation [" . $dumper->describeValue($this->_getValue()) . "] matches";
- }
- }
- }
-
- /**
- * Test for a pattern using Perl regex rules.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class PatternExpectation extends SimpleExpectation {
- protected $_pattern;
-
- /**
- * Sets the value to compare against.
- * @param string $pattern Pattern to search for.
- * @param string $message Customised message on failure.
- * @access public
- */
- function PatternExpectation($pattern, $message = '%s') {
- $this->SimpleExpectation($message);
- $this->_pattern = $pattern;
- }
-
- /**
- * Accessor for the pattern.
- * @return string Perl regex as string.
- * @access protected
- */
- function _getPattern() {
- return $this->_pattern;
- }
-
- /**
- * Tests the expectation. True if the Perl regex
- * matches the comparison value.
- * @param string $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return (boolean)preg_match($this->_getPattern(), $compare);
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- if ($this->test($compare)) {
- return $this->_describePatternMatch($this->_getPattern(), $compare);
- } else {
- $dumper = $this->_getDumper();
- return "Pattern [" . $this->_getPattern() .
- "] not detected in [" .
- $dumper->describeValue($compare) . "]";
- }
- }
-
- /**
- * Describes a pattern match including the string
- * found and it's position.
- * @package SimpleTest
- * @subpackage UnitTester
- * @param string $pattern Regex to match against.
- * @param string $subject Subject to search.
- * @access protected
- */
- function _describePatternMatch($pattern, $subject) {
- preg_match($pattern, $subject, $matches);
- $position = strpos($subject, $matches[0]);
- $dumper = $this->_getDumper();
- return "Pattern [$pattern] detected at character [$position] in [" .
- $dumper->describeValue($subject) . "] as [" .
- $matches[0] . "] in region [" .
- $dumper->clipString($subject, 100, $position) . "]";
- }
- }
-
- /**
- * @deprecated
- */
- class WantedPatternExpectation extends PatternExpectation {
- }
-
- /**
- * Fail if a pattern is detected within the
- * comparison.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class NoPatternExpectation extends PatternExpectation {
-
- /**
- * Sets the reject pattern
- * @param string $pattern Pattern to search for.
- * @param string $message Customised message on failure.
- * @access public
- */
- function NoPatternExpectation($pattern, $message = '%s') {
- $this->PatternExpectation($pattern, $message);
- }
-
- /**
- * Tests the expectation. False if the Perl regex
- * matches the comparison value.
- * @param string $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return ! parent::test($compare);
- }
-
- /**
- * Returns a human readable test message.
- * @param string $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- if ($this->test($compare)) {
- $dumper = $this->_getDumper();
- return "Pattern [" . $this->_getPattern() .
- "] not detected in [" .
- $dumper->describeValue($compare) . "]";
- } else {
- return $this->_describePatternMatch($this->_getPattern(), $compare);
- }
- }
- }
-
- /**
- * @package SimpleTest
- * @subpackage UnitTester
- * @deprecated
- */
- class UnwantedPatternExpectation extends NoPatternExpectation {
- }
-
- /**
- * Tests either type or class name if it's an object.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class IsAExpectation extends SimpleExpectation {
- protected $_type;
-
- /**
- * Sets the type to compare with.
- * @param string $type Type or class name.
- * @param string $message Customised message on failure.
- * @access public
- */
- function IsAExpectation($type, $message = '%s') {
- $this->SimpleExpectation($message);
- $this->_type = $type;
- }
-
- /**
- * Accessor for type to check against.
- * @return string Type or class name.
- * @access protected
- */
- function _getType() {
- return $this->_type;
- }
-
- /**
- * Tests the expectation. True if the type or
- * class matches the string value.
- * @param string $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- if (is_object($compare)) {
- return SimpleTestCompatibility::isA($compare, $this->_type);
- } else {
- return (strtolower(gettype($compare)) == $this->_canonicalType($this->_type));
- }
- }
-
- /**
- * Coerces type name into a gettype() match.
- * @param string $type User type.
- * @return string Simpler type.
- * @access private
- */
- function _canonicalType($type) {
- $type = strtolower($type);
- $map = array(
- 'bool' => 'boolean',
- 'float' => 'double',
- 'real' => 'double',
- 'int' => 'integer');
- if (isset($map[$type])) {
- $type = $map[$type];
- }
- return $type;
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- $dumper = $this->_getDumper();
- return "Value [" . $dumper->describeValue($compare) .
- "] should be type [" . $this->_type . "]";
- }
- }
-
- /**
- * Tests either type or class name if it's an object.
- * Will succeed if the type does not match.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class NotAExpectation extends IsAExpectation {
- protected $_type;
-
- /**
- * Sets the type to compare with.
- * @param string $type Type or class name.
- * @param string $message Customised message on failure.
- * @access public
- */
- function NotAExpectation($type, $message = '%s') {
- $this->IsAExpectation($type, $message);
- }
-
- /**
- * Tests the expectation. False if the type or
- * class matches the string value.
- * @param string $compare Comparison value.
- * @return boolean True if different.
- * @access public
- */
- function test($compare) {
- return ! parent::test($compare);
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- $dumper = $this->_getDumper();
- return "Value [" . $dumper->describeValue($compare) .
- "] should not be type [" . $this->_getType() . "]";
- }
- }
-
- /**
- * Tests for existance of a method in an object
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class MethodExistsExpectation extends SimpleExpectation {
- protected $_method;
-
- /**
- * Sets the value to compare against.
- * @param string $method Method to check.
- * @param string $message Customised message on failure.
- * @access public
- * @return void
- */
- function MethodExistsExpectation($method, $message = '%s') {
- $this->SimpleExpectation($message);
- $this->_method = $method;
- }
-
- /**
- * Tests the expectation. True if the method exists in the test object.
- * @param string $compare Comparison method name.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return (boolean)(is_object($compare) && method_exists($compare, $this->_method));
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- $dumper = $this->_getDumper();
- if (! is_object($compare)) {
- return 'No method on non-object [' . $dumper->describeValue($compare) . ']';
- }
- $method = $this->_method;
- return "Object [" . $dumper->describeValue($compare) .
- "] should contain method [$method]";
- }
- }
diff --git a/tests/test_tools/simpletest/form.php b/tests/test_tools/simpletest/form.php
deleted file mode 100644
index fba26bf6..00000000
--- a/tests/test_tools/simpletest/form.php
+++ /dev/null
@@ -1,351 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest.
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: form.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include SimpleTest files
- */
- require_once(dirname(__FILE__) . '/tag.php');
- require_once(dirname(__FILE__) . '/encoding.php');
- require_once(dirname(__FILE__) . '/selector.php');
- /**#@-*/
-
- /**
- * Form tag class to hold widget values.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleForm {
- protected $_method;
- protected $_action;
- protected $_encoding;
- protected $_default_target;
- protected $_id;
- protected $_buttons;
- protected $_images;
- protected $_widgets;
- protected $_radios;
- protected $_checkboxes;
-
- /**
- * Starts with no held controls/widgets.
- * @param SimpleTag $tag Form tag to read.
- * @param SimpleUrl $url Location of holding page.
- */
- function SimpleForm($tag, $url) {
- $this->_method = $tag->getAttribute('method');
- $this->_action = $this->_createAction($tag->getAttribute('action'), $url);
- $this->_encoding = $this->_setEncodingClass($tag);
- $this->_default_target = false;
- $this->_id = $tag->getAttribute('id');
- $this->_buttons = array();
- $this->_images = array();
- $this->_widgets = array();
- $this->_radios = array();
- $this->_checkboxes = array();
- }
-
- /**
- * Creates the request packet to be sent by the form.
- * @param SimpleTag $tag Form tag to read.
- * @return string Packet class.
- * @access private
- */
- function _setEncodingClass($tag) {
- if (strtolower($tag->getAttribute('method')) == 'post') {
- if (strtolower($tag->getAttribute('enctype')) == 'multipart/form-data') {
- return 'SimpleMultipartEncoding';
- }
- return 'SimplePostEncoding';
- }
- return 'SimpleGetEncoding';
- }
-
- /**
- * Sets the frame target within a frameset.
- * @param string $frame Name of frame.
- * @access public
- */
- function setDefaultTarget($frame) {
- $this->_default_target = $frame;
- }
-
- /**
- * Accessor for method of form submission.
- * @return string Either get or post.
- * @access public
- */
- function getMethod() {
- return ($this->_method ? strtolower($this->_method) : 'get');
- }
-
- /**
- * Combined action attribute with current location
- * to get an absolute form target.
- * @param string $action Action attribute from form tag.
- * @param SimpleUrl $base Page location.
- * @return SimpleUrl Absolute form target.
- */
- function _createAction($action, $base) {
- if (($action === '') || ($action === false)) {
- return $base;
- }
- $url = new SimpleUrl($action);
- return $url->makeAbsolute($base);
- }
-
- /**
- * Absolute URL of the target.
- * @return SimpleUrl URL target.
- * @access public
- */
- function getAction() {
- $url = $this->_action;
- if ($this->_default_target && ! $url->getTarget()) {
- $url->setTarget($this->_default_target);
- }
- return $url;
- }
-
- /**
- * Creates the encoding for the current values in the
- * form.
- * @return SimpleFormEncoding Request to submit.
- * @access private
- */
- function _encode() {
- $class = $this->_encoding;
- $encoding = new $class();
- for ($i = 0, $count = count($this->_widgets); $i < $count; $i++) {
- $this->_widgets[$i]->write($encoding);
- }
- return $encoding;
- }
-
- /**
- * ID field of form for unique identification.
- * @return string Unique tag ID.
- * @access public
- */
- function getId() {
- return $this->_id;
- }
-
- /**
- * Adds a tag contents to the form.
- * @param SimpleWidget $tag Input tag to add.
- * @access public
- */
- function addWidget($tag) {
- if (strtolower($tag->getAttribute('type')) == 'submit') {
- $this->_buttons[] = $tag;
- } elseif (strtolower($tag->getAttribute('type')) == 'image') {
- $this->_images[] = $tag;
- } elseif ($tag->getName()) {
- $this->_setWidget($tag);
- }
- }
-
- /**
- * Sets the widget into the form, grouping radio
- * buttons if any.
- * @param SimpleWidget $tag Incoming form control.
- * @access private
- */
- function _setWidget($tag) {
- if (strtolower($tag->getAttribute('type')) == 'radio') {
- $this->_addRadioButton($tag);
- } elseif (strtolower($tag->getAttribute('type')) == 'checkbox') {
- $this->_addCheckbox($tag);
- } else {
- $this->_widgets[] = $tag;
- }
- }
-
- /**
- * Adds a radio button, building a group if necessary.
- * @param SimpleRadioButtonTag $tag Incoming form control.
- * @access private
- */
- function _addRadioButton($tag) {
- if (! isset($this->_radios[$tag->getName()])) {
- $this->_widgets[] = new SimpleRadioGroup();
- $this->_radios[$tag->getName()] = count($this->_widgets) - 1;
- }
- $this->_widgets[$this->_radios[$tag->getName()]]->addWidget($tag);
- }
-
- /**
- * Adds a checkbox, making it a group on a repeated name.
- * @param SimpleCheckboxTag $tag Incoming form control.
- * @access private
- */
- function _addCheckbox($tag) {
- if (! isset($this->_checkboxes[$tag->getName()])) {
- $this->_widgets[] = $tag;
- $this->_checkboxes[$tag->getName()] = count($this->_widgets) - 1;
- } else {
- $index = $this->_checkboxes[$tag->getName()];
- if (! SimpleTestCompatibility::isA($this->_widgets[$index], 'SimpleCheckboxGroup')) {
- $previous = $this->_widgets[$index];
- $this->_widgets[$index] = new SimpleCheckboxGroup();
- $this->_widgets[$index]->addWidget($previous);
- }
- $this->_widgets[$index]->addWidget($tag);
- }
- }
-
- /**
- * Extracts current value from form.
- * @param SimpleSelector $selector Criteria to apply.
- * @return string/array Value(s) as string or null
- * if not set.
- * @access public
- */
- function getValue($selector) {
- for ($i = 0, $count = count($this->_widgets); $i < $count; $i++) {
- if ($selector->isMatch($this->_widgets[$i])) {
- return $this->_widgets[$i]->getValue();
- }
- }
- foreach ($this->_buttons as $button) {
- if ($selector->isMatch($button)) {
- return $button->getValue();
- }
- }
- return null;
- }
-
- /**
- * Sets a widget value within the form.
- * @param SimpleSelector $selector Criteria to apply.
- * @param string $value Value to input into the widget.
- * @return boolean True if value is legal, false
- * otherwise. If the field is not
- * present, nothing will be set.
- * @access public
- */
- function setField($selector, $value) {
- $success = false;
- for ($i = 0, $count = count($this->_widgets); $i < $count; $i++) {
- if ($selector->isMatch($this->_widgets[$i])) {
- if ($this->_widgets[$i]->setValue($value)) {
- $success = true;
- }
- }
- }
- return $success;
- }
-
- /**
- * Used by the page object to set widgets labels to
- * external label tags.
- * @param SimpleSelector $selector Criteria to apply.
- * @access public
- */
- function attachLabelBySelector($selector, $label) {
- for ($i = 0, $count = count($this->_widgets); $i < $count; $i++) {
- if ($selector->isMatch($this->_widgets[$i])) {
- if (method_exists($this->_widgets[$i], 'setLabel')) {
- $this->_widgets[$i]->setLabel($label);
- return;
- }
- }
- }
- }
-
- /**
- * Test to see if a form has a submit button.
- * @param SimpleSelector $selector Criteria to apply.
- * @return boolean True if present.
- * @access public
- */
- function hasSubmit($selector) {
- foreach ($this->_buttons as $button) {
- if ($selector->isMatch($button)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Test to see if a form has an image control.
- * @param SimpleSelector $selector Criteria to apply.
- * @return boolean True if present.
- * @access public
- */
- function hasImage($selector) {
- foreach ($this->_images as $image) {
- if ($selector->isMatch($image)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Gets the submit values for a selected button.
- * @param SimpleSelector $selector Criteria to apply.
- * @param hash $additional Additional data for the form.
- * @return SimpleEncoding Submitted values or false
- * if there is no such button
- * in the form.
- * @access public
- */
- function submitButton($selector, $additional = false) {
- $additional = $additional ? $additional : array();
- foreach ($this->_buttons as $button) {
- if ($selector->isMatch($button)) {
- $encoding = $this->_encode();
- $button->write($encoding);
- if ($additional) {
- $encoding->merge($additional);
- }
- return $encoding;
- }
- }
- return false;
- }
-
- /**
- * Gets the submit values for an image.
- * @param SimpleSelector $selector Criteria to apply.
- * @param integer $x X-coordinate of click.
- * @param integer $y Y-coordinate of click.
- * @param hash $additional Additional data for the form.
- * @return SimpleEncoding Submitted values or false
- * if there is no such button in the
- * form.
- * @access public
- */
- function submitImage($selector, $x, $y, $additional = false) {
- $additional = $additional ? $additional : array();
- foreach ($this->_images as $image) {
- if ($selector->isMatch($image)) {
- $encoding = $this->_encode();
- $image->write($encoding, $x, $y);
- if ($additional) {
- $encoding->merge($additional);
- }
- return $encoding;
- }
- }
- return false;
- }
-
- /**
- * Simply submits the form without the submit button
- * value. Used when there is only one button or it
- * is unimportant.
- * @return hash Submitted values.
- * @access public
- */
- function submit() {
- return $this->_encode();
- }
- }
diff --git a/tests/test_tools/simpletest/frames.php b/tests/test_tools/simpletest/frames.php
deleted file mode 100644
index 86e03157..00000000
--- a/tests/test_tools/simpletest/frames.php
+++ /dev/null
@@ -1,587 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: frames.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/page.php');
- require_once(dirname(__FILE__) . '/user_agent.php');
- /**#@-*/
-
- /**
- * A composite page. Wraps a frameset page and
- * adds subframes. The original page will be
- * mostly ignored. Implements the SimplePage
- * interface so as to be interchangeable.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleFrameset {
- protected $_frameset;
- protected $_frames;
- protected $_focus;
- protected $_names;
-
- /**
- * Stashes the frameset page. Will make use of the
- * browser to fetch the sub frames recursively.
- * @param SimplePage $page Frameset page.
- */
- function SimpleFrameset($page) {
- $this->_frameset = $page;
- $this->_frames = array();
- $this->_focus = false;
- $this->_names = array();
- }
-
- /**
- * Adds a parsed page to the frameset.
- * @param SimplePage $page Frame page.
- * @param string $name Name of frame in frameset.
- * @access public
- */
- function addFrame($page, $name = false) {
- $this->_frames[] = $page;
- if ($name) {
- $this->_names[$name] = count($this->_frames) - 1;
- }
- }
-
- /**
- * Replaces existing frame with another. If the
- * frame is nested, then the call is passed down
- * one level.
- * @param array $path Path of frame in frameset.
- * @param SimplePage $page Frame source.
- * @access public
- */
- function setFrame($path, $page) {
- $name = array_shift($path);
- if (isset($this->_names[$name])) {
- $index = $this->_names[$name];
- } else {
- $index = $name - 1;
- }
- if (count($path) == 0) {
- $this->_frames[$index] = $page;
- return;
- }
- $this->_frames[$index]->setFrame($path, $page);
- }
-
- /**
- * Accessor for current frame focus. Will be
- * false if no frame has focus. Will have the nested
- * frame focus if any.
- * @return array Labels or indexes of nested frames.
- * @access public
- */
- function getFrameFocus() {
- if ($this->_focus === false) {
- return array();
- }
- return array_merge(
- array($this->_getPublicNameFromIndex($this->_focus)),
- $this->_frames[$this->_focus]->getFrameFocus());
- }
-
- /**
- * Turns an internal array index into the frames list
- * into a public name, or if none, then a one offset
- * index.
- * @param integer $subject Internal index.
- * @return integer/string Public name.
- * @access private
- */
- function _getPublicNameFromIndex($subject) {
- foreach ($this->_names as $name => $index) {
- if ($subject == $index) {
- return $name;
- }
- }
- return $subject + 1;
- }
-
- /**
- * Sets the focus by index. The integer index starts from 1.
- * If already focused and the target frame also has frames,
- * then the nested frame will be focused.
- * @param integer $choice Chosen frame.
- * @return boolean True if frame exists.
- * @access public
- */
- function setFrameFocusByIndex($choice) {
- if (is_integer($this->_focus)) {
- if ($this->_frames[$this->_focus]->hasFrames()) {
- return $this->_frames[$this->_focus]->setFrameFocusByIndex($choice);
- }
- }
- if (($choice < 1) || ($choice > count($this->_frames))) {
- return false;
- }
- $this->_focus = $choice - 1;
- return true;
- }
-
- /**
- * Sets the focus by name. If already focused and the
- * target frame also has frames, then the nested frame
- * will be focused.
- * @param string $name Chosen frame.
- * @return boolean True if frame exists.
- * @access public
- */
- function setFrameFocus($name) {
- if (is_integer($this->_focus)) {
- if ($this->_frames[$this->_focus]->hasFrames()) {
- return $this->_frames[$this->_focus]->setFrameFocus($name);
- }
- }
- if (in_array($name, array_keys($this->_names))) {
- $this->_focus = $this->_names[$name];
- return true;
- }
- return false;
- }
-
- /**
- * Clears the frame focus.
- * @access public
- */
- function clearFrameFocus() {
- $this->_focus = false;
- $this->_clearNestedFramesFocus();
- }
-
- /**
- * Clears the frame focus for any nested frames.
- * @access private
- */
- function _clearNestedFramesFocus() {
- for ($i = 0; $i < count($this->_frames); $i++) {
- $this->_frames[$i]->clearFrameFocus();
- }
- }
-
- /**
- * Test for the presence of a frameset.
- * @return boolean Always true.
- * @access public
- */
- function hasFrames() {
- return true;
- }
-
- /**
- * Accessor for frames information.
- * @return array/string Recursive hash of frame URL strings.
- * The key is either a numerical
- * index or the name attribute.
- * @access public
- */
- function getFrames() {
- $report = array();
- for ($i = 0; $i < count($this->_frames); $i++) {
- $report[$this->_getPublicNameFromIndex($i)] =
- $this->_frames[$i]->getFrames();
- }
- return $report;
- }
-
- /**
- * Accessor for raw text of either all the pages or
- * the frame in focus.
- * @return string Raw unparsed content.
- * @access public
- */
- function getRaw() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getRaw();
- }
- $raw = '';
- for ($i = 0; $i < count($this->_frames); $i++) {
- $raw .= $this->_frames[$i]->getRaw();
- }
- return $raw;
- }
-
- /**
- * Accessor for plain text of either all the pages or
- * the frame in focus.
- * @return string Plain text content.
- * @access public
- */
- function getText() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getText();
- }
- $raw = '';
- for ($i = 0; $i < count($this->_frames); $i++) {
- $raw .= ' ' . $this->_frames[$i]->getText();
- }
- return trim($raw);
- }
-
- /**
- * Accessor for last error.
- * @return string Error from last response.
- * @access public
- */
- function getTransportError() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getTransportError();
- }
- return $this->_frameset->getTransportError();
- }
-
- /**
- * Request method used to fetch this frame.
- * @return string GET, POST or HEAD.
- * @access public
- */
- function getMethod() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getMethod();
- }
- return $this->_frameset->getMethod();
- }
-
- /**
- * Original resource name.
- * @return SimpleUrl Current url.
- * @access public
- */
- function getUrl() {
- if (is_integer($this->_focus)) {
- $url = $this->_frames[$this->_focus]->getUrl();
- $url->setTarget($this->_getPublicNameFromIndex($this->_focus));
- } else {
- $url = $this->_frameset->getUrl();
- }
- return $url;
- }
-
- /**
- * Original request data.
- * @return mixed Sent content.
- * @access public
- */
- function getRequestData() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getRequestData();
- }
- return $this->_frameset->getRequestData();
- }
-
- /**
- * Accessor for current MIME type.
- * @return string MIME type as string; e.g. 'text/html'
- * @access public
- */
- function getMimeType() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getMimeType();
- }
- return $this->_frameset->getMimeType();
- }
-
- /**
- * Accessor for last response code.
- * @return integer Last HTTP response code received.
- * @access public
- */
- function getResponseCode() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getResponseCode();
- }
- return $this->_frameset->getResponseCode();
- }
-
- /**
- * Accessor for last Authentication type. Only valid
- * straight after a challenge (401).
- * @return string Description of challenge type.
- * @access public
- */
- function getAuthentication() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getAuthentication();
- }
- return $this->_frameset->getAuthentication();
- }
-
- /**
- * Accessor for last Authentication realm. Only valid
- * straight after a challenge (401).
- * @return string Name of security realm.
- * @access public
- */
- function getRealm() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getRealm();
- }
- return $this->_frameset->getRealm();
- }
-
- /**
- * Accessor for outgoing header information.
- * @return string Header block.
- * @access public
- */
- function getRequest() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getRequest();
- }
- return $this->_frameset->getRequest();
- }
-
- /**
- * Accessor for raw header information.
- * @return string Header block.
- * @access public
- */
- function getHeaders() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getHeaders();
- }
- return $this->_frameset->getHeaders();
- }
-
- /**
- * Accessor for parsed title.
- * @return string Title or false if no title is present.
- * @access public
- */
- function getTitle() {
- return $this->_frameset->getTitle();
- }
-
- /**
- * Accessor for a list of all fixed links.
- * @return array List of urls with scheme of
- * http or https and hostname.
- * @access public
- */
- function getAbsoluteUrls() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getAbsoluteUrls();
- }
- $urls = array();
- foreach ($this->_frames as $frame) {
- $urls = array_merge($urls, $frame->getAbsoluteUrls());
- }
- return array_values(array_unique($urls));
- }
-
- /**
- * Accessor for a list of all relative links.
- * @return array List of urls without hostname.
- * @access public
- */
- function getRelativeUrls() {
- if (is_integer($this->_focus)) {
- return $this->_frames[$this->_focus]->getRelativeUrls();
- }
- $urls = array();
- foreach ($this->_frames as $frame) {
- $urls = array_merge($urls, $frame->getRelativeUrls());
- }
- return array_values(array_unique($urls));
- }
-
- /**
- * Accessor for URLs by the link label. Label will match
- * regardess of whitespace issues and case.
- * @param string $label Text of link.
- * @return array List of links with that label.
- * @access public
- */
- function getUrlsByLabel($label) {
- if (is_integer($this->_focus)) {
- return $this->_tagUrlsWithFrame(
- $this->_frames[$this->_focus]->getUrlsByLabel($label),
- $this->_focus);
- }
- $urls = array();
- foreach ($this->_frames as $index => $frame) {
- $urls = array_merge(
- $urls,
- $this->_tagUrlsWithFrame(
- $frame->getUrlsByLabel($label),
- $index));
- }
- return $urls;
- }
-
- /**
- * Accessor for a URL by the id attribute. If in a frameset
- * then the first link found with that ID attribute is
- * returned only. Focus on a frame if you want one from
- * a specific part of the frameset.
- * @param string $id Id attribute of link.
- * @return string URL with that id.
- * @access public
- */
- function getUrlById($id) {
- foreach ($this->_frames as $index => $frame) {
- if ($url = $frame->getUrlById($id)) {
- if (! $url->gettarget()) {
- $url->setTarget($this->_getPublicNameFromIndex($index));
- }
- return $url;
- }
- }
- return false;
- }
-
- /**
- * Attaches the intended frame index to a list of URLs.
- * @param array $urls List of SimpleUrls.
- * @param string $frame Name of frame or index.
- * @return array List of tagged URLs.
- * @access private
- */
- function _tagUrlsWithFrame($urls, $frame) {
- $tagged = array();
- foreach ($urls as $url) {
- if (! $url->getTarget()) {
- $url->setTarget($this->_getPublicNameFromIndex($frame));
- }
- $tagged[] = $url;
- }
- return $tagged;
- }
-
- /**
- * Finds a held form by button label. Will only
- * search correctly built forms.
- * @param SimpleSelector $selector Button finder.
- * @return SimpleForm Form object containing
- * the button.
- * @access public
- */
- function &getFormBySubmit($selector) {
- $form = $this->_findForm('getFormBySubmit', $selector);
- return $form;
- }
-
- /**
- * Finds a held form by image using a selector.
- * Will only search correctly built forms. The first
- * form found either within the focused frame, or
- * across frames, will be the one returned.
- * @param SimpleSelector $selector Image finder.
- * @return SimpleForm Form object containing
- * the image.
- * @access public
- */
- function &getFormByImage($selector) {
- $form = $this->_findForm('getFormByImage', $selector);
- return $form;
- }
-
- /**
- * Finds a held form by the form ID. A way of
- * identifying a specific form when we have control
- * of the HTML code. The first form found
- * either within the focused frame, or across frames,
- * will be the one returned.
- * @param string $id Form label.
- * @return SimpleForm Form object containing the matching ID.
- * @access public
- */
- function &getFormById($id) {
- $form = $this->_findForm('getFormById', $id);
- return $form;
- }
-
- /**
- * General form finder. Will search all the frames or
- * just the one in focus.
- * @param string $method Method to use to find in a page.
- * @param string $attribute Label, name or ID.
- * @return SimpleForm Form object containing the matching ID.
- * @access private
- */
- function &_findForm($method, $attribute) {
- if (is_integer($this->_focus)) {
- $form = $this->_findFormInFrame(
- $this->_frames[$this->_focus],
- $this->_focus,
- $method,
- $attribute);
- return $form;
- }
- for ($i = 0; $i < count($this->_frames); $i++) {
- $form = $this->_findFormInFrame(
- $this->_frames[$i],
- $i,
- $method,
- $attribute);
- if ($form) {
- return $form;
- }
- }
- $null = null;
- return $null;
- }
-
- /**
- * Finds a form in a page using a form finding method. Will
- * also tag the form with the frame name it belongs in.
- * @param SimplePage $page Page content of frame.
- * @param integer $index Internal frame representation.
- * @param string $method Method to use to find in a page.
- * @param string $attribute Label, name or ID.
- * @return SimpleForm Form object containing the matching ID.
- * @access private
- */
- function &_findFormInFrame($page, $index, $method, $attribute) {
- $form = $this->_frames[$index]->$method($attribute);
- if (isset($form)) {
- $form->setDefaultTarget($this->_getPublicNameFromIndex($index));
- }
- return $form;
- }
-
- /**
- * Sets a field on each form in which the field is
- * available.
- * @param SimpleSelector $selector Field finder.
- * @param string $value Value to set field to.
- * @return boolean True if value is valid.
- * @access public
- */
- function setField($selector, $value) {
- if (is_integer($this->_focus)) {
- $this->_frames[$this->_focus]->setField($selector, $value);
- } else {
- for ($i = 0; $i < count($this->_frames); $i++) {
- $this->_frames[$i]->setField($selector, $value);
- }
- }
- }
-
- /**
- * Accessor for a form element value within a page.
- * @param SimpleSelector $selector Field finder.
- * @return string/boolean A string if the field is
- * present, false if unchecked
- * and null if missing.
- * @access public
- */
- function getField($selector) {
- for ($i = 0; $i < count($this->_frames); $i++) {
- $value = $this->_frames[$i]->getField($selector);
- if (isset($value)) {
- return $value;
- }
- }
- return null;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/http.php b/tests/test_tools/simpletest/http.php
deleted file mode 100644
index 78c91b7e..00000000
--- a/tests/test_tools/simpletest/http.php
+++ /dev/null
@@ -1,623 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: http.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/socket.php');
- require_once(dirname(__FILE__) . '/cookies.php');
- require_once(dirname(__FILE__) . '/url.php');
- /**#@-*/
-
- /**
- * Creates HTTP headers for the end point of
- * a HTTP request.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleRoute {
- protected $_url;
-
- /**
- * Sets the target URL.
- * @param SimpleUrl $url URL as object.
- * @access public
- */
- function SimpleRoute($url) {
- $this->_url = $url;
- }
-
- /**
- * Resource name.
- * @return SimpleUrl Current url.
- * @access protected
- */
- function getUrl() {
- return $this->_url;
- }
-
- /**
- * Creates the first line which is the actual request.
- * @param string $method HTTP request method, usually GET.
- * @return string Request line content.
- * @access protected
- */
- function _getRequestLine($method) {
- return $method . ' ' . $this->_url->getPath() .
- $this->_url->getEncodedRequest() . ' HTTP/1.0';
- }
-
- /**
- * Creates the host part of the request.
- * @return string Host line content.
- * @access protected
- */
- function _getHostLine() {
- $line = 'Host: ' . $this->_url->getHost();
- if ($this->_url->getPort()) {
- $line .= ':' . $this->_url->getPort();
- }
- return $line;
- }
-
- /**
- * Opens a socket to the route.
- * @param string $method HTTP request method, usually GET.
- * @param integer $timeout Connection timeout.
- * @return SimpleSocket New socket.
- * @access public
- */
- function &createConnection($method, $timeout) {
- $default_port = ('https' == $this->_url->getScheme()) ? 443 : 80;
- $socket = $this->_createSocket(
- $this->_url->getScheme() ? $this->_url->getScheme() : 'http',
- $this->_url->getHost(),
- $this->_url->getPort() ? $this->_url->getPort() : $default_port,
- $timeout);
- if (! $socket->isError()) {
- $socket->write($this->_getRequestLine($method) . "\r\n");
- $socket->write($this->_getHostLine() . "\r\n");
- $socket->write("Connection: close\r\n");
- }
- return $socket;
- }
-
- /**
- * Factory for socket.
- * @param string $scheme Protocol to use.
- * @param string $host Hostname to connect to.
- * @param integer $port Remote port.
- * @param integer $timeout Connection timeout.
- * @return SimpleSocket/SimpleSecureSocket New socket.
- * @access protected
- */
- function &_createSocket($scheme, $host, $port, $timeout) {
- if (in_array($scheme, array('https'))) {
- $socket = new SimpleSecureSocket($host, $port, $timeout);
- } else {
- $socket = new SimpleSocket($host, $port, $timeout);
- }
- return $socket;
- }
- }
-
- /**
- * Creates HTTP headers for the end point of
- * a HTTP request via a proxy server.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleProxyRoute extends SimpleRoute {
- protected $_proxy;
- protected $_username;
- protected $_password;
-
- /**
- * Stashes the proxy address.
- * @param SimpleUrl $url URL as object.
- * @param string $proxy Proxy URL.
- * @param string $username Username for autentication.
- * @param string $password Password for autentication.
- * @access public
- */
- function SimpleProxyRoute($url, $proxy, $username = false, $password = false) {
- $this->SimpleRoute($url);
- $this->_proxy = $proxy;
- $this->_username = $username;
- $this->_password = $password;
- }
-
- /**
- * Creates the first line which is the actual request.
- * @param string $method HTTP request method, usually GET.
- * @param SimpleUrl $url URL as object.
- * @return string Request line content.
- * @access protected
- */
- function _getRequestLine($method) {
- $url = $this->getUrl();
- $scheme = $url->getScheme() ? $url->getScheme() : 'http';
- $port = $url->getPort() ? ':' . $url->getPort() : '';
- return $method . ' ' . $scheme . '://' . $url->getHost() . $port .
- $url->getPath() . $url->getEncodedRequest() . ' HTTP/1.0';
- }
-
- /**
- * Creates the host part of the request.
- * @param SimpleUrl $url URL as object.
- * @return string Host line content.
- * @access protected
- */
- function _getHostLine() {
- $host = 'Host: ' . $this->_proxy->getHost();
- $port = $this->_proxy->getPort() ? $this->_proxy->getPort() : 8080;
- return "$host:$port";
- }
-
- /**
- * Opens a socket to the route.
- * @param string $method HTTP request method, usually GET.
- * @param integer $timeout Connection timeout.
- * @return SimpleSocket New socket.
- * @access public
- */
- function &createConnection($method, $timeout) {
- $socket = $this->_createSocket(
- $this->_proxy->getScheme() ? $this->_proxy->getScheme() : 'http',
- $this->_proxy->getHost(),
- $this->_proxy->getPort() ? $this->_proxy->getPort() : 8080,
- $timeout);
- if ($socket->isError()) {
- return $socket;
- }
- $socket->write($this->_getRequestLine($method) . "\r\n");
- $socket->write($this->_getHostLine() . "\r\n");
- if ($this->_username && $this->_password) {
- $socket->write('Proxy-Authorization: Basic ' .
- base64_encode($this->_username . ':' . $this->_password) .
- "\r\n");
- }
- $socket->write("Connection: close\r\n");
- return $socket;
- }
- }
-
- /**
- * HTTP request for a web page. Factory for
- * HttpResponse object.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleHttpRequest {
- protected $_route;
- protected $_encoding;
- protected $_headers;
- protected $_cookies;
-
- /**
- * Builds the socket request from the different pieces.
- * These include proxy information, URL, cookies, headers,
- * request method and choice of encoding.
- * @param SimpleRoute $route Request route.
- * @param SimpleFormEncoding $encoding Content to send with
- * request.
- * @access public
- */
- function SimpleHttpRequest($route, $encoding) {
- $this->_route = $route;
- $this->_encoding = $encoding;
- $this->_headers = array();
- $this->_cookies = array();
- }
-
- /**
- * Dispatches the content to the route's socket.
- * @param integer $timeout Connection timeout.
- * @return SimpleHttpResponse A response which may only have
- * an error, but hopefully has a
- * complete web page.
- * @access public
- */
- function &fetch($timeout) {
- $socket = $this->_route->createConnection($this->_encoding->getMethod(), $timeout);
- if (! $socket->isError()) {
- $this->_dispatchRequest($socket, $this->_encoding);
- }
- $response = $this->_createResponse($socket);
- return $response;
- }
-
- /**
- * Sends the headers.
- * @param SimpleSocket $socket Open socket.
- * @param string $method HTTP request method,
- * usually GET.
- * @param SimpleFormEncoding $encoding Content to send with request.
- * @access private
- */
- function _dispatchRequest($socket, $encoding) {
- foreach ($this->_headers as $header_line) {
- $socket->write($header_line . "\r\n");
- }
- if (count($this->_cookies) > 0) {
- $socket->write("Cookie: " . implode(";", $this->_cookies) . "\r\n");
- }
- $encoding->writeHeadersTo($socket);
- $socket->write("\r\n");
- $encoding->writeTo($socket);
- }
-
- /**
- * Adds a header line to the request.
- * @param string $header_line Text of full header line.
- * @access public
- */
- function addHeaderLine($header_line) {
- $this->_headers[] = $header_line;
- }
-
- /**
- * Reads all the relevant cookies from the
- * cookie jar.
- * @param SimpleCookieJar $jar Jar to read
- * @param SimpleUrl $url Url to use for scope.
- * @access public
- */
- function readCookiesFromJar($jar, $url) {
- $this->_cookies = $jar->selectAsPairs($url);
- }
-
- /**
- * Wraps the socket in a response parser.
- * @param SimpleSocket $socket Responding socket.
- * @return SimpleHttpResponse Parsed response object.
- * @access protected
- */
- function &_createResponse($socket) {
- $response = new SimpleHttpResponse(
- $socket,
- $this->_route->getUrl(),
- $this->_encoding);
- return $response;
- }
- }
-
- /**
- * Collection of header lines in the response.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleHttpHeaders {
- protected $_raw_headers;
- protected $_response_code;
- protected $_http_version;
- protected $_mime_type;
- protected $_location;
- protected $_cookies;
- protected $_authentication;
- protected $_realm;
-
- /**
- * Parses the incoming header block.
- * @param string $headers Header block.
- * @access public
- */
- function SimpleHttpHeaders($headers) {
- $this->_raw_headers = $headers;
- $this->_response_code = false;
- $this->_http_version = false;
- $this->_mime_type = '';
- $this->_location = false;
- $this->_cookies = array();
- $this->_authentication = false;
- $this->_realm = false;
- foreach (split("\r\n", $headers) as $header_line) {
- $this->_parseHeaderLine($header_line);
- }
- }
-
- /**
- * Accessor for parsed HTTP protocol version.
- * @return integer HTTP error code.
- * @access public
- */
- function getHttpVersion() {
- return $this->_http_version;
- }
-
- /**
- * Accessor for raw header block.
- * @return string All headers as raw string.
- * @access public
- */
- function getRaw() {
- return $this->_raw_headers;
- }
-
- /**
- * Accessor for parsed HTTP error code.
- * @return integer HTTP error code.
- * @access public
- */
- function getResponseCode() {
- return (integer)$this->_response_code;
- }
-
- /**
- * Returns the redirected URL or false if
- * no redirection.
- * @return string URL or false for none.
- * @access public
- */
- function getLocation() {
- return $this->_location;
- }
-
- /**
- * Test to see if the response is a valid redirect.
- * @return boolean True if valid redirect.
- * @access public
- */
- function isRedirect() {
- return in_array($this->_response_code, array(301, 302, 303, 307)) &&
- (boolean)$this->getLocation();
- }
-
- /**
- * Test to see if the response is an authentication
- * challenge.
- * @return boolean True if challenge.
- * @access public
- */
- function isChallenge() {
- return ($this->_response_code == 401) &&
- (boolean)$this->_authentication &&
- (boolean)$this->_realm;
- }
-
- /**
- * Accessor for MIME type header information.
- * @return string MIME type.
- * @access public
- */
- function getMimeType() {
- return $this->_mime_type;
- }
-
- /**
- * Accessor for authentication type.
- * @return string Type.
- * @access public
- */
- function getAuthentication() {
- return $this->_authentication;
- }
-
- /**
- * Accessor for security realm.
- * @return string Realm.
- * @access public
- */
- function getRealm() {
- return $this->_realm;
- }
-
- /**
- * Writes new cookies to the cookie jar.
- * @param SimpleCookieJar $jar Jar to write to.
- * @param SimpleUrl $url Host and path to write under.
- * @access public
- */
- function writeCookiesToJar($jar, $url) {
- foreach ($this->_cookies as $cookie) {
- $jar->setCookie(
- $cookie->getName(),
- $cookie->getValue(),
- $url->getHost(),
- $cookie->getPath(),
- $cookie->getExpiry());
- }
- }
-
- /**
- * Called on each header line to accumulate the held
- * data within the class.
- * @param string $header_line One line of header.
- * @access protected
- */
- function _parseHeaderLine($header_line) {
- if (preg_match('/HTTP\/(\d+\.\d+)\s+(\d+)/i', $header_line, $matches)) {
- $this->_http_version = $matches[1];
- $this->_response_code = $matches[2];
- }
- if (preg_match('/Content-type:\s*(.*)/i', $header_line, $matches)) {
- $this->_mime_type = trim($matches[1]);
- }
- if (preg_match('/Location:\s*(.*)/i', $header_line, $matches)) {
- $this->_location = trim($matches[1]);
- }
- if (preg_match('/Set-cookie:(.*)/i', $header_line, $matches)) {
- $this->_cookies[] = $this->_parseCookie($matches[1]);
- }
- if (preg_match('/WWW-Authenticate:\s+(\S+)\s+realm=\"(.*?)\"/i', $header_line, $matches)) {
- $this->_authentication = $matches[1];
- $this->_realm = trim($matches[2]);
- }
- }
-
- /**
- * Parse the Set-cookie content.
- * @param string $cookie_line Text after "Set-cookie:"
- * @return SimpleCookie New cookie object.
- * @access private
- */
- function _parseCookie($cookie_line) {
- $parts = split(";", $cookie_line);
- $cookie = array();
- preg_match('/\s*(.*?)\s*=(.*)/', array_shift($parts), $cookie);
- foreach ($parts as $part) {
- if (preg_match('/\s*(.*?)\s*=(.*)/', $part, $matches)) {
- $cookie[$matches[1]] = trim($matches[2]);
- }
- }
- return new SimpleCookie(
- $cookie[1],
- trim($cookie[2]),
- isset($cookie["path"]) ? $cookie["path"] : "",
- isset($cookie["expires"]) ? $cookie["expires"] : false);
- }
- }
-
- /**
- * Basic HTTP response.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleHttpResponse extends SimpleStickyError {
- protected $_url;
- protected $_encoding;
- protected $_sent;
- protected $_content;
- protected $_headers;
-
- /**
- * Constructor. Reads and parses the incoming
- * content and headers.
- * @param SimpleSocket $socket Network connection to fetch
- * response text from.
- * @param SimpleUrl $url Resource name.
- * @param mixed $encoding Record of content sent.
- * @access public
- */
- function SimpleHttpResponse($socket, $url, $encoding) {
- $this->SimpleStickyError();
- $this->_url = $url;
- $this->_encoding = $encoding;
- $this->_sent = $socket->getSent();
- $this->_content = false;
- $raw = $this->_readAll($socket);
- if ($socket->isError()) {
- $this->_setError('Error reading socket [' . $socket->getError() . ']');
- return;
- }
- $this->_parse($raw);
- }
-
- /**
- * Splits up the headers and the rest of the content.
- * @param string $raw Content to parse.
- * @access private
- */
- function _parse($raw) {
- if (! $raw) {
- $this->_setError('Nothing fetched');
- $this->_headers = new SimpleHttpHeaders('');
- } elseif (! strstr($raw, "\r\n\r\n")) {
- $this->_setError('Could not split headers from content');
- $this->_headers = new SimpleHttpHeaders($raw);
- } else {
- list($headers, $this->_content) = split("\r\n\r\n", $raw, 2);
- $this->_headers = new SimpleHttpHeaders($headers);
- }
- }
-
- /**
- * Original request method.
- * @return string GET, POST or HEAD.
- * @access public
- */
- function getMethod() {
- return $this->_encoding->getMethod();
- }
-
- /**
- * Resource name.
- * @return SimpleUrl Current url.
- * @access public
- */
- function getUrl() {
- return $this->_url;
- }
-
- /**
- * Original request data.
- * @return mixed Sent content.
- * @access public
- */
- function getRequestData() {
- return $this->_encoding;
- }
-
- /**
- * Raw request that was sent down the wire.
- * @return string Bytes actually sent.
- * @access public
- */
- function getSent() {
- return $this->_sent;
- }
-
- /**
- * Accessor for the content after the last
- * header line.
- * @return string All content.
- * @access public
- */
- function getContent() {
- return $this->_content;
- }
-
- /**
- * Accessor for header block. The response is the
- * combination of this and the content.
- * @return SimpleHeaders Wrapped header block.
- * @access public
- */
- function getHeaders() {
- return $this->_headers;
- }
-
- /**
- * Accessor for any new cookies.
- * @return array List of new cookies.
- * @access public
- */
- function getNewCookies() {
- return $this->_headers->getNewCookies();
- }
-
- /**
- * Reads the whole of the socket output into a
- * single string.
- * @param SimpleSocket $socket Unread socket.
- * @return string Raw output if successful
- * else false.
- * @access private
- */
- function _readAll($socket) {
- $all = '';
- while (! $this->_isLastPacket($next = $socket->read())) {
- $all .= $next;
- }
- return $all;
- }
-
- /**
- * Test to see if the packet from the socket is the
- * last one.
- * @param string $packet Chunk to interpret.
- * @return boolean True if empty or EOF.
- * @access private
- */
- function _isLastPacket($packet) {
- if (is_string($packet)) {
- return $packet === '';
- }
- return ! $packet;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/invoker.php b/tests/test_tools/simpletest/invoker.php
deleted file mode 100644
index dfe9263c..00000000
--- a/tests/test_tools/simpletest/invoker.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: invoker.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * Includes SimpleTest files and defined the root constant
- * for dependent libraries.
- */
- require_once(dirname(__FILE__) . '/errors.php');
- require_once(dirname(__FILE__) . '/compatibility.php');
- require_once(dirname(__FILE__) . '/scorer.php');
- require_once(dirname(__FILE__) . '/expectation.php');
- require_once(dirname(__FILE__) . '/dumper.php');
- if (! defined('SIMPLE_TEST')) {
- define('SIMPLE_TEST', dirname(__FILE__) . '/');
- }
- /**#@-*/
-
- /**
- * This is called by the class runner to run a
- * single test method. Will also run the setUp()
- * and tearDown() methods.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleInvoker {
- protected $_test_case;
-
- /**
- * Stashes the test case for later.
- * @param SimpleTestCase $test_case Test case to run.
- */
- function SimpleInvoker($test_case) {
- $this->_test_case = $test_case;
- }
-
- /**
- * Accessor for test case being run.
- * @return SimpleTestCase Test case.
- * @access public
- */
- function &getTestCase() {
- return $this->_test_case;
- }
-
- /**
- * Runs test level set up. Used for changing
- * the mechanics of base test cases.
- * @param string $method Test method to call.
- * @access public
- */
- function before($method) {
- $this->_test_case->before($method);
- }
-
- /**
- * Invokes a test method and buffered with setUp()
- * and tearDown() calls.
- * @param string $method Test method to call.
- * @access public
- */
- function invoke($method) {
- $this->_test_case->setUp();
- $this->_test_case->$method();
- $this->_test_case->tearDown();
- }
-
- /**
- * Runs test level clean up. Used for changing
- * the mechanics of base test cases.
- * @param string $method Test method to call.
- * @access public
- */
- function after($method) {
- $this->_test_case->after($method);
- }
- }
-
- /**
- * Do nothing decorator. Just passes the invocation
- * straight through.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleInvokerDecorator {
- protected $_invoker;
-
- /**
- * Stores the invoker to wrap.
- * @param SimpleInvoker $invoker Test method runner.
- */
- function SimpleInvokerDecorator($invoker) {
- $this->_invoker = $invoker;
- }
-
- /**
- * Accessor for test case being run.
- * @return SimpleTestCase Test case.
- * @access public
- */
- function &getTestCase() {
- return $this->_invoker->getTestCase();
- }
-
- /**
- * Runs test level set up. Used for changing
- * the mechanics of base test cases.
- * @param string $method Test method to call.
- * @access public
- */
- function before($method) {
- $this->_invoker->before($method);
- }
-
- /**
- * Invokes a test method and buffered with setUp()
- * and tearDown() calls.
- * @param string $method Test method to call.
- * @access public
- */
- function invoke($method) {
- $this->_invoker->invoke($method);
- }
-
- /**
- * Runs test level clean up. Used for changing
- * the mechanics of base test cases.
- * @param string $method Test method to call.
- * @access public
- */
- function after($method) {
- $this->_invoker->after($method);
- }
- }
diff --git a/tests/test_tools/simpletest/mock_objects.php b/tests/test_tools/simpletest/mock_objects.php
deleted file mode 100644
index b63d1760..00000000
--- a/tests/test_tools/simpletest/mock_objects.php
+++ /dev/null
@@ -1,1272 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage MockObjects
- * @version $Id: mock_objects.php 1532 2006-12-01 12:28:55Z xue $
- */
-
- /**#@+
- * include SimpleTest files
- */
- require_once(dirname(__FILE__) . '/expectation.php');
- require_once(dirname(__FILE__) . '/simpletest.php');
- require_once(dirname(__FILE__) . '/dumper.php');
- if (version_compare(phpversion(), '5') >= 0) {
- require_once(dirname(__FILE__) . '/reflection_php5.php');
- } else {
- require_once(dirname(__FILE__) . '/reflection_php4.php');
- }
- /**#@-*/
-
- /**
- * Default character simpletest will substitute for any value
- */
- if (! defined('MOCK_ANYTHING')) {
- define('MOCK_ANYTHING', '*');
- }
-
- /**
- * A wildcard expectation always matches.
- * @package SimpleTest
- * @subpackage MockObjects
- */
- class AnythingExpectation extends SimpleExpectation {
-
- /**
- * Tests the expectation. Always true.
- * @param mixed $compare Ignored.
- * @return boolean True.
- * @access public
- */
- function test($compare) {
- return true;
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- $dumper = $this->_getDumper();
- return 'Anything always matches [' . $dumper->describeValue($compare) . ']';
- }
- }
-
- /**
- * Parameter comparison assertion.
- * @package SimpleTest
- * @subpackage MockObjects
- */
- class ParametersExpectation extends SimpleExpectation {
- protected $_expected;
-
- /**
- * Sets the expected parameter list.
- * @param array $parameters Array of parameters including
- * those that are wildcarded.
- * If the value is not an array
- * then it is considered to match any.
- * @param mixed $wildcard Any parameter matching this
- * will always match.
- * @param string $message Customised message on failure.
- * @access public
- */
- function ParametersExpectation($expected = false, $message = '%s') {
- $this->SimpleExpectation($message);
- $this->_expected = $expected;
- }
-
- /**
- * Tests the assertion. True if correct.
- * @param array $parameters Comparison values.
- * @return boolean True if correct.
- * @access public
- */
- function test($parameters) {
- if (! is_array($this->_expected)) {
- return true;
- }
- if (count($this->_expected) != count($parameters)) {
- return false;
- }
- for ($i = 0; $i < count($this->_expected); $i++) {
- if (! $this->_testParameter($parameters[$i], $this->_expected[$i])) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Tests an individual parameter.
- * @param mixed $parameter Value to test.
- * @param mixed $expected Comparison value.
- * @return boolean True if expectation
- * fulfilled.
- * @access private
- */
- function _testParameter($parameter, $expected) {
- $comparison = $this->_coerceToExpectation($expected);
- return $comparison->test($parameter);
- }
-
- /**
- * Returns a human readable test message.
- * @param array $comparison Incoming parameter list.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($parameters) {
- if ($this->test($parameters)) {
- return "Expectation of " . count($this->_expected) .
- " arguments of [" . $this->_renderArguments($this->_expected) .
- "] is correct";
- } else {
- return $this->_describeDifference($this->_expected, $parameters);
- }
- }
-
- /**
- * Message to display if expectation differs from
- * the parameters actually received.
- * @param array $expected Expected parameters as list.
- * @param array $parameters Actual parameters received.
- * @return string Description of difference.
- * @access private
- */
- function _describeDifference($expected, $parameters) {
- if (count($expected) != count($parameters)) {
- return "Expected " . count($expected) .
- " arguments of [" . $this->_renderArguments($expected) .
- "] but got " . count($parameters) .
- " arguments of [" . $this->_renderArguments($parameters) . "]";
- }
- $messages = array();
- for ($i = 0; $i < count($expected); $i++) {
- $comparison = $this->_coerceToExpectation($expected[$i]);
- if (! $comparison->test($parameters[$i])) {
- $messages[] = "parameter " . ($i + 1) . " with [" .
- $comparison->overlayMessage($parameters[$i]) . "]";
- }
- }
- return "Parameter expectation differs at " . implode(" and ", $messages);
- }
-
- /**
- * Creates an identical expectation if the
- * object/value is not already some type
- * of expectation.
- * @param mixed $expected Expected value.
- * @return SimpleExpectation Expectation object.
- * @access private
- */
- function _coerceToExpectation($expected) {
- if (SimpleExpectation::isExpectation($expected)) {
- return $expected;
- }
- return new IdenticalExpectation($expected);
- }
-
- /**
- * Renders the argument list as a string for
- * messages.
- * @param array $args Incoming arguments.
- * @return string Simple description of type and value.
- * @access private
- */
- function _renderArguments($args) {
- $descriptions = array();
- if (is_array($args)) {
- foreach ($args as $arg) {
- $dumper = new SimpleDumper();
- $descriptions[] = $dumper->describeValue($arg);
- }
- }
- return implode(', ', $descriptions);
- }
- }
-
- /**
- * Confirms that the number of calls on a method is as expected.
- */
- class CallCountExpectation extends SimpleExpectation {
- protected $_method;
- protected $_count;
-
- /**
- * Stashes the method and expected count for later
- * reporting.
- * @param string $method Name of method to confirm against.
- * @param integer $count Expected number of calls.
- * @param string $message Custom error message.
- */
- function CallCountExpectation($method, $count, $message = '%s') {
- $this->_method = $method;
- $this->_count = $count;
- $this->SimpleExpectation($message);
- }
-
- /**
- * Tests the assertion. True if correct.
- * @param integer $compare Measured call count.
- * @return boolean True if expected.
- * @access public
- */
- function test($compare) {
- return ($this->_count == $compare);
- }
-
- /**
- * Reports the comparison.
- * @param integer $compare Measured call count.
- * @return string Message to show.
- * @access public
- */
- function testMessage($compare) {
- return 'Expected call count for [' . $this->_method .
- '] was [' . $this->_count .
- '] got [' . $compare . ']';
- }
- }
-
- /**
- * Confirms that the number of calls on a method is as expected.
- */
- class MinimumCallCountExpectation extends SimpleExpectation {
- protected $_method;
- protected $_count;
-
- /**
- * Stashes the method and expected count for later
- * reporting.
- * @param string $method Name of method to confirm against.
- * @param integer $count Minimum number of calls.
- * @param string $message Custom error message.
- */
- function MinimumCallCountExpectation($method, $count, $message = '%s') {
- $this->_method = $method;
- $this->_count = $count;
- $this->SimpleExpectation($message);
- }
-
- /**
- * Tests the assertion. True if correct.
- * @param integer $compare Measured call count.
- * @return boolean True if enough.
- * @access public
- */
- function test($compare) {
- return ($this->_count <= $compare);
- }
-
- /**
- * Reports the comparison.
- * @param integer $compare Measured call count.
- * @return string Message to show.
- * @access public
- */
- function testMessage($compare) {
- return 'Minimum call count for [' . $this->_method .
- '] was [' . $this->_count .
- '] got [' . $compare . ']';
- }
- }
-
- /**
- * Confirms that the number of calls on a method is as expected.
- */
- class MaximumCallCountExpectation extends SimpleExpectation {
- protected $_method;
- protected $_count;
-
- /**
- * Stashes the method and expected count for later
- * reporting.
- * @param string $method Name of method to confirm against.
- * @param integer $count Minimum number of calls.
- * @param string $message Custom error message.
- */
- function MaximumCallCountExpectation($method, $count, $message = '%s') {
- $this->_method = $method;
- $this->_count = $count;
- $this->SimpleExpectation($message);
- }
-
- /**
- * Tests the assertion. True if correct.
- * @param integer $compare Measured call count.
- * @return boolean True if not over.
- * @access public
- */
- function test($compare) {
- return ($this->_count >= $compare);
- }
-
- /**
- * Reports the comparison.
- * @param integer $compare Measured call count.
- * @return string Message to show.
- * @access public
- */
- function testMessage($compare) {
- return 'Maximum call count for [' . $this->_method .
- '] was [' . $this->_count .
- '] got [' . $compare . ']';
- }
- }
-
- /**
- * Retrieves values and references by searching the
- * parameter lists until a match is found.
- * @package SimpleTest
- * @subpackage MockObjects
- */
- class CallMap {
- protected $_map;
-
- /**
- * Creates an empty call map.
- * @access public
- */
- function CallMap() {
- $this->_map = array();
- }
-
- /**
- * Stashes a value against a method call.
- * @param array $parameters Arguments including wildcards.
- * @param mixed $value Value copied into the map.
- * @access public
- */
- function addValue($parameters, $value) {
- $this->addReference($parameters, $value);
- }
-
- /**
- * Stashes a reference against a method call.
- * @param array $parameters Array of arguments (including wildcards).
- * @param mixed $reference Array reference placed in the map.
- * @access public
- */
- function addReference($parameters, $reference) {
- $place = count($this->_map);
- $this->_map[$place] = array();
- $this->_map[$place]["params"] = new ParametersExpectation($parameters);
- $this->_map[$place]["content"] = $reference;
- }
-
- /**
- * Searches the call list for a matching parameter
- * set. Returned by reference.
- * @param array $parameters Parameters to search by
- * without wildcards.
- * @return object Object held in the first matching
- * slot, otherwise null.
- * @access public
- */
- function &findFirstMatch($parameters) {
- $slot = $this->_findFirstSlot($parameters);
- if (!isset($slot)) {
- $null = null;
- return $null;
- }
- return $slot["content"];
- }
-
- /**
- * Searches the call list for a matching parameter
- * set. True if successful.
- * @param array $parameters Parameters to search by
- * without wildcards.
- * @return boolean True if a match is present.
- * @access public
- */
- function isMatch($parameters) {
- return ($this->_findFirstSlot($parameters) != null);
- }
-
- /**
- * Searches the map for a matching item.
- * @param array $parameters Parameters to search by
- * without wildcards.
- * @return array Reference to slot or null.
- * @access private
- */
- function &_findFirstSlot($parameters) {
- $count = count($this->_map);
- for ($i = 0; $i < $count; $i++) {
- if ($this->_map[$i]["params"]->test($parameters)) {
- return $this->_map[$i];
- }
- }
- $null = null;
- return $null;
- }
- }
-
- /**
- * An empty collection of methods that can have their
- * return values set and expectations made of the
- * calls upon them. The mock will assert the
- * expectations against it's attached test case in
- * addition to the server stub behaviour.
- * @package SimpleTest
- * @subpackage MockObjects
- */
- class SimpleMock {
- protected $_wildcard = MOCK_ANYTHING;
- protected $_is_strict = true;
- protected $_returns;
- protected $_return_sequence;
- protected $_call_counts;
- protected $_expected_counts;
- protected $_max_counts;
- protected $_expected_args;
- protected $_expected_args_at;
-
- /**
- * Creates an empty return list and expectation list.
- * All call counts are set to zero.
- * @param SimpleTestCase $test Test case to test expectations in.
- * @param mixed $wildcard Parameter matching wildcard.
- * @param boolean $is_strict Enables method name checks on
- * expectations.
- */
- function SimpleMock() {
- $this->_returns = array();
- $this->_return_sequence = array();
- $this->_call_counts = array();
- $test = $this->_getCurrentTestCase();
- $test->tell($this);
- $this->_expected_counts = array();
- $this->_max_counts = array();
- $this->_expected_args = array();
- $this->_expected_args_at = array();
- }
-
- /**
- * Disables a name check when setting expectations.
- * This hack is needed for the partial mocks.
- * @access public
- */
- function disableExpectationNameChecks() {
- $this->_is_strict = false;
- }
-
- /**
- * Changes the default wildcard object.
- * @param mixed $wildcard Parameter matching wildcard.
- * @access public
- */
- function setWildcard($wildcard) {
- $this->_wildcard = $wildcard;
- }
-
- /**
- * Finds currently running test.
- * @return SimpeTestCase Current test case.
- * @access protected
- */
- function &_getCurrentTestCase() {
- return SimpleTest::getCurrent();
- }
-
- /**
- * Die if bad arguments array is passed
- * @param mixed $args The arguments value to be checked.
- * @param string $task Description of task attempt.
- * @return boolean Valid arguments
- * @access private
- */
- function _checkArgumentsIsArray($args, $task) {
- if (! is_array($args)) {
- trigger_error(
- "Cannot $task as \$args parameter is not an array",
- E_USER_ERROR);
- }
- }
-
- /**
- * Triggers a PHP error if the method is not part
- * of this object.
- * @param string $method Name of method.
- * @param string $task Description of task attempt.
- * @access protected
- */
- function _dieOnNoMethod($method, $task) {
- if ($this->_is_strict && ! method_exists($this, $method)) {
- trigger_error(
- "Cannot $task as no ${method}() in class " . get_class($this),
- E_USER_ERROR);
- }
- }
-
- /**
- * Replaces wildcard matches with wildcard
- * expectations in the argument list.
- * @param array $args Raw argument list.
- * @return array Argument list with
- * expectations.
- * @access private
- */
- function _replaceWildcards($args) {
- if ($args === false) {
- return false;
- }
- for ($i = 0; $i < count($args); $i++) {
- if ($args[$i] === $this->_wildcard) {
- $args[$i] = new AnythingExpectation();
- }
- }
- return $args;
- }
-
- /**
- * Adds one to the call count of a method.
- * @param string $method Method called.
- * @param array $args Arguments as an array.
- * @access protected
- */
- function _addCall($method, $args) {
- if (!isset($this->_call_counts[$method])) {
- $this->_call_counts[$method] = 0;
- }
- $this->_call_counts[$method]++;
- }
-
- /**
- * Fetches the call count of a method so far.
- * @param string $method Method name called.
- * @return Number of calls so far.
- * @access public
- */
- function getCallCount($method) {
- $this->_dieOnNoMethod($method, "get call count");
- $method = strtolower($method);
- if (! isset($this->_call_counts[$method])) {
- return 0;
- }
- return $this->_call_counts[$method];
- }
-
- /**
- * Sets a return for a parameter list that will
- * be passed by value for all calls to this method.
- * @param string $method Method name.
- * @param mixed $value Result of call passed by value.
- * @param array $args List of parameters to match
- * including wildcards.
- * @access public
- */
- function setReturnValue($method, $value, $args = false) {
- $this->_dieOnNoMethod($method, "set return value");
- $args = $this->_replaceWildcards($args);
- $method = strtolower($method);
- if (! isset($this->_returns[$method])) {
- $this->_returns[$method] = new CallMap();
- }
- $this->_returns[$method]->addValue($args, $value);
- }
-
- /**
- * Sets a return for a parameter list that will
- * be passed by value only when the required call count
- * is reached.
- * @param integer $timing Number of calls in the future
- * to which the result applies. If
- * not set then all calls will return
- * the value.
- * @param string $method Method name.
- * @param mixed $value Result of call passed by value.
- * @param array $args List of parameters to match
- * including wildcards.
- * @access public
- */
- function setReturnValueAt($timing, $method, $value, $args = false) {
- $this->_dieOnNoMethod($method, "set return value sequence");
- $args = $this->_replaceWildcards($args);
- $method = strtolower($method);
- if (! isset($this->_return_sequence[$method])) {
- $this->_return_sequence[$method] = array();
- }
- if (! isset($this->_return_sequence[$method][$timing])) {
- $this->_return_sequence[$method][$timing] = new CallMap();
- }
- $this->_return_sequence[$method][$timing]->addValue($args, $value);
- }
-
- /**
- * Sets a return for a parameter list that will
- * be passed by reference for all calls.
- * @param string $method Method name.
- * @param mixed $reference Result of the call will be this object.
- * @param array $args List of parameters to match
- * including wildcards.
- * @access public
- */
- function setReturnReference($method, $reference, $args = false) {
- $this->_dieOnNoMethod($method, "set return reference");
- $args = $this->_replaceWildcards($args);
- $method = strtolower($method);
- if (! isset($this->_returns[$method])) {
- $this->_returns[$method] = new CallMap();
- }
- $this->_returns[$method]->addReference($args, $reference);
- }
-
- /**
- * Sets a return for a parameter list that will
- * be passed by value only when the required call count
- * is reached.
- * @param integer $timing Number of calls in the future
- * to which the result applies. If
- * not set then all calls will return
- * the value.
- * @param string $method Method name.
- * @param mixed $reference Result of the call will be this object.
- * @param array $args List of parameters to match
- * including wildcards.
- * @access public
- */
- function setReturnReferenceAt($timing, $method, $reference, $args = false) {
- $this->_dieOnNoMethod($method, "set return reference sequence");
- $args = $this->_replaceWildcards($args);
- $method = strtolower($method);
- if (! isset($this->_return_sequence[$method])) {
- $this->_return_sequence[$method] = array();
- }
- if (! isset($this->_return_sequence[$method][$timing])) {
- $this->_return_sequence[$method][$timing] = new CallMap();
- }
- $this->_return_sequence[$method][$timing]->addReference($args, $reference);
- }
-
- /**
- * Sets up an expected call with a set of
- * expected parameters in that call. All
- * calls will be compared to these expectations
- * regardless of when the call is made.
- * @param string $method Method call to test.
- * @param array $args Expected parameters for the call
- * including wildcards.
- * @param string $message Overridden message.
- * @access public
- */
- function expect($method, $args, $message = '%s') {
- $this->_dieOnNoMethod($method, 'set expected arguments');
- $this->_checkArgumentsIsArray($args, 'set expected arguments');
- $args = $this->_replaceWildcards($args);
- $message .= Mock::getExpectationLine();
- $this->_expected_args[strtolower($method)] =
- new ParametersExpectation($args, $message);
- }
-
- /**
- * @deprecated
- */
- function expectArguments($method, $args, $message = '%s') {
- return $this->expect($method, $args, $message);
- }
-
- /**
- * Sets up an expected call with a set of
- * expected parameters in that call. The
- * expected call count will be adjusted if it
- * is set too low to reach this call.
- * @param integer $timing Number of calls in the future at
- * which to test. Next call is 0.
- * @param string $method Method call to test.
- * @param array $args Expected parameters for the call
- * including wildcards.
- * @param string $message Overridden message.
- * @access public
- */
- function expectAt($timing, $method, $args, $message = '%s') {
- $this->_dieOnNoMethod($method, 'set expected arguments at time');
- $this->_checkArgumentsIsArray($args, 'set expected arguments at time');
- $args = $this->_replaceWildcards($args);
- if (! isset($this->_expected_args_at[$timing])) {
- $this->_expected_args_at[$timing] = array();
- }
- $method = strtolower($method);
- $message .= Mock::getExpectationLine();
- $this->_expected_args_at[$timing][$method] =
- new ParametersExpectation($args, $message);
- }
-
- /**
- * @deprecated
- */
- function expectArgumentsAt($timing, $method, $args, $message = '%s') {
- return $this->expectAt($timing, $method, $args, $message);
- }
-
- /**
- * Sets an expectation for the number of times
- * a method will be called. The tally method
- * is used to check this.
- * @param string $method Method call to test.
- * @param integer $count Number of times it should
- * have been called at tally.
- * @param string $message Overridden message.
- * @access public
- */
- function expectCallCount($method, $count, $message = '%s') {
- $this->_dieOnNoMethod($method, 'set expected call count');
- $message .= Mock::getExpectationLine();
- $this->_expected_counts[strtolower($method)] =
- new CallCountExpectation($method, $count, $message);
- }
-
- /**
- * Sets the number of times a method may be called
- * before a test failure is triggered.
- * @param string $method Method call to test.
- * @param integer $count Most number of times it should
- * have been called.
- * @param string $message Overridden message.
- * @access public
- */
- function expectMaximumCallCount($method, $count, $message = '%s') {
- $this->_dieOnNoMethod($method, 'set maximum call count');
- $message .= Mock::getExpectationLine();
- $this->_max_counts[strtolower($method)] =
- new MaximumCallCountExpectation($method, $count, $message);
- }
-
- /**
- * Sets the number of times to call a method to prevent
- * a failure on the tally.
- * @param string $method Method call to test.
- * @param integer $count Least number of times it should
- * have been called.
- * @param string $message Overridden message.
- * @access public
- */
- function expectMinimumCallCount($method, $count, $message = '%s') {
- $this->_dieOnNoMethod($method, 'set minimum call count');
- $message .= Mock::getExpectationLine();
- $this->_expected_counts[strtolower($method)] =
- new MinimumCallCountExpectation($method, $count, $message);
- }
-
- /**
- * Convenience method for barring a method
- * call.
- * @param string $method Method call to ban.
- * @param string $message Overridden message.
- * @access public
- */
- function expectNever($method, $message = '%s') {
- $this->expectMaximumCallCount($method, 0, $message);
- }
-
- /**
- * Convenience method for a single method
- * call.
- * @param string $method Method call to track.
- * @param array $args Expected argument list or
- * false for any arguments.
- * @param string $message Overridden message.
- * @access public
- */
- function expectOnce($method, $args = false, $message = '%s') {
- $this->expectCallCount($method, 1, $message);
- if ($args !== false) {
- $this->expectArguments($method, $args, $message);
- }
- }
-
- /**
- * Convenience method for requiring a method
- * call.
- * @param string $method Method call to track.
- * @param array $args Expected argument list or
- * false for any arguments.
- * @param string $message Overridden message.
- * @access public
- */
- function expectAtLeastOnce($method, $args = false, $message = '%s') {
- $this->expectMinimumCallCount($method, 1, $message);
- if ($args !== false) {
- $this->expectArguments($method, $args, $message);
- }
- }
-
- /**
- * @deprecated
- */
- function tally() {
- }
-
- /**
- * Receives event from unit test that the current
- * test method has finished. Totals up the call
- * counts and triggers a test assertion if a test
- * is present for expected call counts.
- * @param string $method Current method name.
- * @access public
- */
- function atTestEnd($method) {
- foreach ($this->_expected_counts as $method => $expectation) {
- $this->_assertTrue(
- $expectation->test($this->getCallCount($method)),
- $expectation->overlayMessage($this->getCallCount($method)));
- }
- foreach ($this->_max_counts as $method => $expectation) {
- if ($expectation->test($this->getCallCount($method))) {
- $this->_assertTrue(
- true,
- $expectation->overlayMessage($this->getCallCount($method)));
- }
- }
- }
-
- /**
- * Returns the expected value for the method name
- * and checks expectations. Will generate any
- * test assertions as a result of expectations
- * if there is a test present.
- * @param string $method Name of method to simulate.
- * @param array $args Arguments as an array.
- * @return mixed Stored return.
- * @access private
- */
- function &_invoke($method, $args) {
- $method = strtolower($method);
- $step = $this->getCallCount($method);
- $this->_addCall($method, $args);
- $this->_checkExpectations($method, $args, $step);
- $result = $this->_getReturn($method, $args, $step);
- return $result;
- }
- /**
- * Finds the return value matching the incoming
- * arguments. If there is no matching value found
- * then an error is triggered.
- * @param string $method Method name.
- * @param array $args Calling arguments.
- * @param integer $step Current position in the
- * call history.
- * @return mixed Stored return.
- * @access protected
- */
- function &_getReturn($method, $args, $step) {
- if (isset($this->_return_sequence[$method][$step])) {
- if ($this->_return_sequence[$method][$step]->isMatch($args)) {
- $result = $this->_return_sequence[$method][$step]->findFirstMatch($args);
- return $result;
- }
- }
- if (isset($this->_returns[$method])) {
- $result = $this->_returns[$method]->findFirstMatch($args);
- return $result;
- }
- $null = null;
- return $null;
- }
-
- /**
- * Tests the arguments against expectations.
- * @param string $method Method to check.
- * @param array $args Argument list to match.
- * @param integer $timing The position of this call
- * in the call history.
- * @access private
- */
- function _checkExpectations($method, $args, $timing) {
- if (isset($this->_max_counts[$method])) {
- if (! $this->_max_counts[$method]->test($timing + 1)) {
- $this->_assertTrue(
- false,
- $this->_max_counts[$method]->overlayMessage($timing + 1));
- }
- }
- if (isset($this->_expected_args_at[$timing][$method])) {
- $this->_assertTrue(
- $this->_expected_args_at[$timing][$method]->test($args),
- "Mock method [$method] at [$timing] -> " .
- $this->_expected_args_at[$timing][$method]->overlayMessage($args));
- } elseif (isset($this->_expected_args[$method])) {
- $this->_assertTrue(
- $this->_expected_args[$method]->test($args),
- "Mock method [$method] -> " . $this->_expected_args[$method]->overlayMessage($args));
- }
- }
-
- /**
- * Triggers an assertion on the held test case.
- * Should be overridden when using another test
- * framework other than the SimpleTest one if the
- * assertion method has a different name.
- * @param boolean $assertion True will pass.
- * @param string $message Message that will go with
- * the test event.
- * @access protected
- */
- function _assertTrue($assertion, $message) {
- $test = $this->_getCurrentTestCase();
- $test->assertTrue($assertion, $message);
- }
- }
-
- /**
- * Static methods only service class for code generation of
- * mock objects.
- * @package SimpleTest
- * @subpackage MockObjects
- */
- class Mock {
-
- /**
- * Factory for mock object classes.
- * @access public
- */
- function Mock() {
- trigger_error('Mock factory methods are class only.');
- }
-
- /**
- * Clones a class' interface and creates a mock version
- * that can have return values and expectations set.
- * @param string $class Class to clone.
- * @param string $mock_class New class name. Default is
- * the old name with "Mock"
- * prepended.
- * @param array $methods Additional methods to add beyond
- * those in th cloned class. Use this
- * to emulate the dynamic addition of
- * methods in the cloned class or when
- * the class hasn't been written yet.
- * @static
- * @access public
- */
- static function generate($class, $mock_class = false, $methods = false) {
- $generator = new MockGenerator($class, $mock_class);
- return $generator->generate($methods);
- }
-
- /**
- * Generates a version of a class with selected
- * methods mocked only. Inherits the old class
- * and chains the mock methods of an aggregated
- * mock object.
- * @param string $class Class to clone.
- * @param string $mock_class New class name.
- * @param array $methods Methods to be overridden
- * with mock versions.
- * @static
- * @access public
- */
- static function generatePartial($class, $mock_class, $methods) {
- $generator = new MockGenerator($class, $mock_class);
- return $generator->generatePartial($methods);
- }
-
- /**
- * Uses a stack trace to find the line of an assertion.
- * @param array $stack Stack frames top most first. Only
- * needed if not using the PHP
- * backtrace function.
- * @return string Location of first expect*
- * method embedded in format string.
- * @access public
- * @static
- */
- static function getExpectationLine($stack = false) {
- if ($stack === false) {
- $stack = SimpleTestCompatibility::getStackTrace();
- }
- return SimpleDumper::getFormattedAssertionLine($stack);
- }
- }
-
- /**
- * @deprecated
- */
- class Stub extends Mock {
- }
-
- /**
- * Service class for code generation of mock objects.
- * @package SimpleTest
- * @subpackage MockObjects
- */
- class MockGenerator {
- protected $_class;
- protected $_mock_class;
- protected $_mock_base;
- protected $_reflection;
-
- function MockGenerator($class, $mock_class) {
- $this->_class = $class;
- $this->_mock_class = $mock_class;
- $this->_mock_base = SimpleTest::getMockBaseClass();
- $this->_reflection = new SimpleReflection($this->_class);
- }
-
- /**
- * Clones a class' interface and creates a mock version
- * that can have return values and expectations set.
- * @param array $methods Additional methods to add beyond
- * those in th cloned class. Use this
- * to emulate the dynamic addition of
- * methods in the cloned class or when
- * the class hasn't been written yet.
- * @access public
- */
- function generate($methods) {
- if (! $this->_reflection->classOrInterfaceExists()) {
- return false;
- }
- if (! $this->_mock_class) {
- $this->_mock_class = 'Mock' . $this->_class;
- }
- $mock_reflection = new SimpleReflection($this->_mock_class);
- if ($mock_reflection->classExistsSansAutoload()) {
- return false;
- }
- return eval(
- $this->_createClassCode($methods ? $methods : array()) .
- " return true;");
- }
-
- /**
- * Generates a version of a class with selected
- * methods mocked only. Inherits the old class
- * and chains the mock methods of an aggregated
- * mock object.
- * @param array $methods Methods to be overridden
- * with mock versions.
- * @access public
- */
- function generatePartial($methods) {
- if (! $this->_reflection->classExists($this->_class)) {
- return false;
- }
- $mock_reflection = new SimpleReflection($this->_mock_class);
- if ($mock_reflection->classExistsSansAutoload()) {
- trigger_error("Partial mock class [$mock_class] already exists");
- return false;
- }
- return eval($this->_extendClassCode($methods));
- }
-
- /**
- * The new mock class code as a string.
- * @param array $methods Additional methods.
- * @return string Code for new mock class.
- * @access private
- */
- function _createClassCode($methods) {
- $implements = '';
- $interfaces = $this->_reflection->getInterfaces();
- if (function_exists('spl_classes')) {
- $interfaces = array_diff($interfaces, array('Traversable'));
- }
- if (count($interfaces) > 0) {
- $implements = 'implements ' . implode(', ', $interfaces);
- }
- $code = "class " . $this->_mock_class . " extends " . $this->_mock_base . " $implements {\n";
- $code .= " function " . $this->_mock_class . "() {\n";
- $code .= " \$this->" . $this->_mock_base . "();\n";
- $code .= " }\n";
- $code .= $this->_createHandlerCode($methods);
- $code .= "}\n";
- return $code;
- }
-
- /**
- * The extension class code as a string. The class
- * composites a mock object and chains mocked methods
- * to it.
- * @param array $methods Mocked methods.
- * @return string Code for a new class.
- * @access private
- */
- function _extendClassCode($methods) {
- $code = "class " . $this->_mock_class . " extends " . $this->_class . " {\n";
- $code .= " var \$_mock;\n";
- $code .= $this->_addMethodList($methods);
- $code .= "\n";
- $code .= " function " . $this->_mock_class . "() {\n";
- $code .= " \$this->_mock = new " . $this->_mock_base . "();\n";
- $code .= " \$this->_mock->disableExpectationNameChecks();\n";
- $code .= " }\n";
- $code .= $this->_chainMockReturns();
- $code .= $this->_chainMockExpectations();
- $code .= $this->_overrideMethods($methods);
- $code .= "}\n";
- return $code;
- }
-
- /**
- * Creates code within a class to generate replaced
- * methods. All methods call the _invoke() handler
- * with the method name and the arguments in an
- * array.
- * @param array $methods Additional methods.
- * @access private
- */
- function _createHandlerCode($methods) {
- $code = '';
- $methods = array_merge($methods, $this->_reflection->getMethods());
- foreach ($methods as $method) {
- if ($this->_isConstructor($method)) {
- continue;
- }
- $mock_reflection = new SimpleReflection($this->_mock_base);
- if (in_array($method, $mock_reflection->getMethods())) {
- continue;
- }
- $code .= " " . $this->_reflection->getSignature($method) . " {\n";
- $code .= " \$args = func_get_args();\n";
- $code .= " \$result = &\$this->_invoke(\"$method\", \$args);\n";
- $code .= " return \$result;\n";
- $code .= " }\n";
- }
- return $code;
- }
-
- /**
- * Tests to see if a special PHP method is about to
- * be stubbed by mistake.
- * @param string $method Method name.
- * @return boolean True if special.
- * @access private
- */
- function _isConstructor($method) {
- return in_array(
- strtolower($method),
- array('__construct', '__destruct', '__clone'));
- }
-
- /**
- * Creates a list of mocked methods for error checking.
- * @param array $methods Mocked methods.
- * @return string Code for a method list.
- * @access private
- */
- function _addMethodList($methods) {
- return " var \$_mocked_methods = array('" . implode("', '", $methods) . "');\n";
- }
-
- /**
- * Creates code to abandon the expectation if not mocked.
- * @param string $alias Parameter name of method name.
- * @return string Code for bail out.
- * @access private
- */
- function _bailOutIfNotMocked($alias) {
- $code = " if (! in_array($alias, \$this->_mocked_methods)) {\n";
- $code .= " trigger_error(\"Method [$alias] is not mocked\");\n";
- $code .= " \$null = null;\n";
- $code .= " return \$null;\n";
- $code .= " }\n";
- return $code;
- }
-
- /**
- * Creates source code for chaining to the composited
- * mock object.
- * @return string Code for mock set up.
- * @access private
- */
- function _chainMockReturns() {
- $code = " function setReturnValue(\$method, \$value, \$args = false) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->setReturnValue(\$method, \$value, \$args);\n";
- $code .= " }\n";
- $code .= " function setReturnValueAt(\$timing, \$method, \$value, \$args = false) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->setReturnValueAt(\$timing, \$method, \$value, \$args);\n";
- $code .= " }\n";
- $code .= " function setReturnReference(\$method, &\$ref, \$args = false) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->setReturnReference(\$method, \$ref, \$args);\n";
- $code .= " }\n";
- $code .= " function setReturnReferenceAt(\$timing, \$method, &\$ref, \$args = false) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->setReturnReferenceAt(\$timing, \$method, \$ref, \$args);\n";
- $code .= " }\n";
- return $code;
- }
-
- /**
- * Creates source code for chaining to an aggregated
- * mock object.
- * @return string Code for expectations.
- * @access private
- */
- function _chainMockExpectations() {
- $code = " function expect(\$method, \$args = false) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->expect(\$method, \$args);\n";
- $code .= " }\n";
- $code .= " function expectArguments(\$method, \$args = false) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->expectArguments(\$method, \$args);\n";
- $code .= " }\n";
- $code .= " function expectAt(\$timing, \$method, \$args = false) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->expectArgumentsAt(\$timing, \$method, \$args);\n";
- $code .= " }\n";
- $code .= " function expectArgumentsAt(\$timing, \$method, \$args = false) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->expectArgumentsAt(\$timing, \$method, \$args);\n";
- $code .= " }\n";
- $code .= " function expectCallCount(\$method, \$count) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->expectCallCount(\$method, \$count);\n";
- $code .= " }\n";
- $code .= " function expectMaximumCallCount(\$method, \$count) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->expectMaximumCallCount(\$method, \$count);\n";
- $code .= " }\n";
- $code .= " function expectMinimumCallCount(\$method, \$count) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->expectMinimumCallCount(\$method, \$count);\n";
- $code .= " }\n";
- $code .= " function expectNever(\$method) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->expectNever(\$method);\n";
- $code .= " }\n";
- $code .= " function expectOnce(\$method, \$args = false) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->expectOnce(\$method, \$args);\n";
- $code .= " }\n";
- $code .= " function expectAtLeastOnce(\$method, \$args = false) {\n";
- $code .= $this->_bailOutIfNotMocked("\$method");
- $code .= " \$this->_mock->expectAtLeastOnce(\$method, \$args);\n";
- $code .= " }\n";
- $code .= " function tally() {\n";
- $code .= " \$this->_mock->tally();\n";
- $code .= " }\n";
- return $code;
- }
-
- /**
- * Creates source code to override a list of methods
- * with mock versions.
- * @param array $methods Methods to be overridden
- * with mock versions.
- * @return string Code for overridden chains.
- * @access private
- */
- function _overrideMethods($methods) {
- $code = "";
- foreach ($methods as $method) {
- $code .= " " . $this->_reflection->getSignature($method) . " {\n";
- $code .= " \$args = func_get_args();\n";
- $code .= " \$result = &\$this->_mock->_invoke(\"$method\", \$args);\n";
- $code .= " return \$result;\n";
- $code .= " }\n";
- }
- return $code;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/options.php b/tests/test_tools/simpletest/options.php
deleted file mode 100644
index 23008ff9..00000000
--- a/tests/test_tools/simpletest/options.php
+++ /dev/null
@@ -1,365 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @version $Id: options.php 1532 2006-12-01 12:28:55Z xue $
- */
-
- /**
- * Static global directives and options.
- * @package SimpleTest
- */
- class SimpleTestOptions {
-
- /**
- * Reads the SimpleTest version from the release file.
- * @return string Version string.
- * @static
- * @access public
- */
- static function getVersion() {
- $content = file(dirname(__FILE__) . '/VERSION');
- return trim($content[0]);
- }
-
- /**
- * Sets the name of a test case to ignore, usually
- * because the class is an abstract case that should
- * not be run.
- * @param string $class Add a class to ignore.
- * @static
- * @access public
- */
- static function ignore($class) {
- $registry =SimpleTestOptions::_getRegistry();
- $registry['IgnoreList'][] = strtolower($class);
- }
-
- /**
- * Test to see if a test case is in the ignore
- * list.
- * @param string $class Class name to test.
- * @return boolean True if should not be run.
- * @access public
- * @static
- */
- static function isIgnored($class) {
- $registry =SimpleTestOptions::_getRegistry();
- return in_array(strtolower($class), $registry['IgnoreList']);
- }
-
- /**
- * The base class name is settable here. This is the
- * class that a new stub will inherited from.
- * To modify the generated stubs simply extend the
- * SimpleStub class and set it's name
- * with this method before any stubs are generated.
- * @param string $stub_base Server stub class to use.
- * @static
- * @access public
- */
- static function setStubBaseClass($stub_base) {
- $registry =SimpleTestOptions::_getRegistry();
- $registry['StubBaseClass'] = $stub_base;
- }
-
- /**
- * Accessor for the currently set stub base class.
- * @return string Class name to inherit from.
- * @static
- * @access public
- */
- static function getStubBaseClass() {
- $registry =SimpleTestOptions::_getRegistry();
- return $registry['StubBaseClass'];
- }
-
- /**
- * The base class name is settable here. This is the
- * class that a new mock will inherited from.
- * To modify the generated mocks simply extend the
- * SimpleMock class and set it's name
- * with this method before any mocks are generated.
- * @param string $mock_base Mock base class to use.
- * @static
- * @access public
- */
- static function setMockBaseClass($mock_base) {
- $registry =SimpleTestOptions::_getRegistry();
- $registry['MockBaseClass'] = $mock_base;
- }
-
- /**
- * Accessor for the currently set mock base class.
- * @return string Class name to inherit from.
- * @static
- * @access public
- */
- static function getMockBaseClass() {
- $registry =SimpleTestOptions::_getRegistry();
- return $registry['MockBaseClass'];
- }
-
- /**
- * Adds additional mock code.
- * @param string $code Extra code that can be added
- * to the partial mocks for
- * extra functionality. Useful
- * when a test tool has overridden
- * the mock base classes.
- * @access public
- */
- static function addPartialMockCode($code = '') {
- $registry =SimpleTestOptions::_getRegistry();
- $registry['AdditionalPartialMockCode'] = $code;
- }
-
- /**
- * Accessor for additional partial mock code.
- * @return string Extra code.
- * @access public
- */
- function getPartialMockCode() {
- $registry =SimpleTestOptions::_getRegistry();
- return $registry['AdditionalPartialMockCode'];
- }
-
- /**
- * Sets proxy to use on all requests for when
- * testing from behind a firewall. Set host
- * to false to disable. This will take effect
- * if there are no other proxy settings.
- * @param string $proxy Proxy host as URL.
- * @param string $username Proxy username for authentication.
- * @param string $password Proxy password for authentication.
- * @access public
- */
- static function useProxy($proxy, $username = false, $password = false) {
- $registry =SimpleTestOptions::_getRegistry();
- $registry['DefaultProxy'] = $proxy;
- $registry['DefaultProxyUsername'] = $username;
- $registry['DefaultProxyPassword'] = $password;
- }
-
- /**
- * Accessor for default proxy host.
- * @return string Proxy URL.
- * @access public
- */
- function getDefaultProxy() {
- $registry =SimpleTestOptions::_getRegistry();
- return $registry['DefaultProxy'];
- }
-
- /**
- * Accessor for default proxy username.
- * @return string Proxy username for authentication.
- * @access public
- */
- function getDefaultProxyUsername() {
- $registry =SimpleTestOptions::_getRegistry();
- return $registry['DefaultProxyUsername'];
- }
-
- /**
- * Accessor for default proxy password.
- * @return string Proxy password for authentication.
- * @access public
- */
- function getDefaultProxyPassword() {
- $registry =SimpleTestOptions::_getRegistry();
- return $registry['DefaultProxyPassword'];
- }
-
- /**
- * Accessor for global registry of options.
- * @return hash All stored values.
- * @access private
- * @static
- */
- static function _getRegistry() {
- static $registry = false;
- if (! $registry) {
- $registry = SimpleTestOptions::_getDefaults();
- }
- return $registry;
- }
-
- /**
- * Constant default values.
- * @return hash All registry defaults.
- * @access private
- * @static
- */
- static function _getDefaults() {
- return array(
- 'StubBaseClass' => 'SimpleStub',
- 'MockBaseClass' => 'SimpleMock',
- 'IgnoreList' => array(),
- 'AdditionalPartialMockCode' => '',
- 'DefaultProxy' => false,
- 'DefaultProxyUsername' => false,
- 'DefaultProxyPassword' => false);
- }
- }
-
- /**
- * Static methods for compatibility between different
- * PHP versions.
- * @package SimpleTest
- */
- class SimpleTestCompatibility {
-
- /**
- * Identity test. Drops back to equality + types for PHP5
- * objects as the === operator counts as the
- * stronger reference constraint.
- * @param mixed $first Test subject.
- * @param mixed $second Comparison object.
- * @access public
- * @static
- */
- static function isIdentical($first, $second) {
- if ($first != $second) {
- return false;
- }
- if (version_compare(phpversion(), '5') >= 0) {
- return SimpleTestCompatibility::_isIdenticalType($first, $second);
- }
- return ($first === $second);
- }
-
- /**
- * Recursive type test.
- * @param mixed $first Test subject.
- * @param mixed $second Comparison object.
- * @access private
- * @static
- */
- static function _isIdenticalType($first, $second) {
- if (gettype($first) != gettype($second)) {
- return false;
- }
- if (is_object($first) && is_object($second)) {
- if (get_class($first) != get_class($second)) {
- return false;
- }
- return SimpleTestCompatibility::_isArrayOfIdenticalTypes(
- get_object_vars($first),
- get_object_vars($second));
- }
- if (is_array($first) && is_array($second)) {
- return SimpleTestCompatibility::_isArrayOfIdenticalTypes($first, $second);
- }
- return true;
- }
-
- /**
- * Recursive type test for each element of an array.
- * @param mixed $first Test subject.
- * @param mixed $second Comparison object.
- * @access private
- * @static
- */
- static function _isArrayOfIdenticalTypes($first, $second) {
- if (array_keys($first) != array_keys($second)) {
- return false;
- }
- foreach (array_keys($first) as $key) {
- $is_identical = SimpleTestCompatibility::_isIdenticalType(
- $first[$key],
- $second[$key]);
- if (! $is_identical) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Test for two variables being aliases.
- * @param mixed $first Test subject.
- * @param mixed $second Comparison object.
- * @access public
- * @static
- */
- static function isReference($first, $second) {
- if (version_compare(phpversion(), '5', '>=')
- && is_object($first)) {
- return ($first === $second);
- }
- $temp = $first;
- $first = uniqid("test");
- $is_ref = ($first === $second);
- $first = $temp;
- return $is_ref;
- }
-
- /**
- * Test to see if an object is a member of a
- * class hiearchy.
- * @param object $object Object to test.
- * @param string $class Root name of hiearchy.
- * @access public
- * @static
- */
- static function isA($object, $class) {
- if (version_compare(phpversion(), '5') >= 0) {
- if (! class_exists($class, false)) {
- return false;
- }
- eval("\$is_a = \$object instanceof $class;");
- return $is_a;
- }
- if (function_exists('is_a')) {
- return is_a($object, $class);
- }
- return ((strtolower($class) == get_class($object))
- or (is_subclass_of($object, $class)));
- }
-
- /**
- * Autoload safe version of class_exists().
- * @param string $class Name of class to look for.
- * @return boolean True if class is defined.
- * @access public
- * @static
- */
- static function classExists($class) {
- if (version_compare(phpversion(), '5') >= 0) {
- return class_exists($class, false);
- } else {
- return class_exists($class);
- }
- }
-
- /**
- * Sets a socket timeout for each chunk.
- * @param resource $handle Socket handle.
- * @param integer $timeout Limit in seconds.
- * @access public
- * @static
- */
- static function setTimeout($handle, $timeout) {
- if (function_exists('stream_set_timeout')) {
- stream_set_timeout($handle, $timeout, 0);
- } elseif (function_exists('socket_set_timeout')) {
- socket_set_timeout($handle, $timeout, 0);
- } elseif (function_exists('set_socket_timeout')) {
- set_socket_timeout($handle, $timeout, 0);
- }
- }
-
- /**
- * Gets the current stack trace topmost first.
- * @return array List of stack frames.
- * @access public
- * @static
- */
- static function getStackTrace() {
- if (function_exists('debug_backtrace')) {
- return array_reverse(debug_backtrace());
- }
- return array();
- }
- }
diff --git a/tests/test_tools/simpletest/page.php b/tests/test_tools/simpletest/page.php
deleted file mode 100644
index 7d0ac7b8..00000000
--- a/tests/test_tools/simpletest/page.php
+++ /dev/null
@@ -1,974 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: page.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/http.php');
- require_once(dirname(__FILE__) . '/parser.php');
- require_once(dirname(__FILE__) . '/tag.php');
- require_once(dirname(__FILE__) . '/form.php');
- require_once(dirname(__FILE__) . '/selector.php');
- /**#@-*/
-
- /**
- * Creates tags and widgets given HTML tag
- * attributes.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleTagBuilder {
-
- /**
- * Factory for the tag objects. Creates the
- * appropriate tag object for the incoming tag name
- * and attributes.
- * @param string $name HTML tag name.
- * @param hash $attributes Element attributes.
- * @return SimpleTag Tag object.
- * @access public
- */
- function createTag($name, $attributes) {
- static $map = array(
- 'a' => 'SimpleAnchorTag',
- 'title' => 'SimpleTitleTag',
- 'button' => 'SimpleButtonTag',
- 'textarea' => 'SimpleTextAreaTag',
- 'option' => 'SimpleOptionTag',
- 'label' => 'SimpleLabelTag',
- 'form' => 'SimpleFormTag',
- 'frame' => 'SimpleFrameTag');
- $attributes = $this->_keysToLowerCase($attributes);
- if (array_key_exists($name, $map)) {
- $tag_class = $map[$name];
- return new $tag_class($attributes);
- } elseif ($name == 'select') {
- return $this->_createSelectionTag($attributes);
- } elseif ($name == 'input') {
- return $this->_createInputTag($attributes);
- }
- return new SimpleTag($name, $attributes);
- }
-
- /**
- * Factory for selection fields.
- * @param hash $attributes Element attributes.
- * @return SimpleTag Tag object.
- * @access protected
- */
- function _createSelectionTag($attributes) {
- if (isset($attributes['multiple'])) {
- return new MultipleSelectionTag($attributes);
- }
- return new SimpleSelectionTag($attributes);
- }
-
- /**
- * Factory for input tags.
- * @param hash $attributes Element attributes.
- * @return SimpleTag Tag object.
- * @access protected
- */
- function _createInputTag($attributes) {
- if (! isset($attributes['type'])) {
- return new SimpleTextTag($attributes);
- }
- $type = strtolower(trim($attributes['type']));
- $map = array(
- 'submit' => 'SimpleSubmitTag',
- 'image' => 'SimpleImageSubmitTag',
- 'checkbox' => 'SimpleCheckboxTag',
- 'radio' => 'SimpleRadioButtonTag',
- 'text' => 'SimpleTextTag',
- 'hidden' => 'SimpleTextTag',
- 'password' => 'SimpleTextTag',
- 'file' => 'SimpleUploadTag');
- if (array_key_exists($type, $map)) {
- $tag_class = $map[$type];
- return new $tag_class($attributes);
- }
- return false;
- }
-
- /**
- * Make the keys lower case for case insensitive look-ups.
- * @param hash $map Hash to convert.
- * @return hash Unchanged values, but keys lower case.
- * @access private
- */
- function _keysToLowerCase($map) {
- $lower = array();
- foreach ($map as $key => $value) {
- $lower[strtolower($key)] = $value;
- }
- return $lower;
- }
- }
-
- /**
- * SAX event handler. Maintains a list of
- * open tags and dispatches them as they close.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimplePageBuilder extends SimpleSaxListener {
- protected $_tags;
- protected $_page;
- protected $_private_content_tag;
-
- /**
- * Sets the builder up empty.
- * @access public
- */
- function SimplePageBuilder() {
- $this->SimpleSaxListener();
- }
-
- /**
- * Frees up any references so as to allow the PHP garbage
- * collection from unset() to work.
- * @access public
- */
- function free() {
- unset($this->_tags);
- unset($this->_page);
- unset($this->_private_content_tags);
- }
-
- /**
- * Reads the raw content and send events
- * into the page to be built.
- * @param $response SimpleHttpResponse Fetched response.
- * @return SimplePage Newly parsed page.
- * @access public
- */
- function &parse($response) {
- $this->_tags = array();
- $this->_page = $this->_createPage($response);
- $parser = $this->_createParser($this);
- $parser->parse($response->getContent());
- $this->_page->acceptPageEnd();
- return $this->_page;
- }
-
- /**
- * Creates an empty page.
- * @return SimplePage New unparsed page.
- * @access protected
- */
- function &_createPage($response) {
- $page = new SimplePage($response);
- return $page;
- }
-
- /**
- * Creates the parser used with the builder.
- * @param $listener SimpleSaxListener Target of parser.
- * @return SimpleSaxParser Parser to generate
- * events for the builder.
- * @access protected
- */
- function &_createParser($listener) {
- $parser = new SimpleHtmlSaxParser($listener);
- return $parser;
- }
-
- /**
- * Start of element event. Opens a new tag.
- * @param string $name Element name.
- * @param hash $attributes Attributes without content
- * are marked as true.
- * @return boolean False on parse error.
- * @access public
- */
- function startElement($name, $attributes) {
- $factory = new SimpleTagBuilder();
- $tag = $factory->createTag($name, $attributes);
- if (! $tag) {
- return true;
- }
- if ($tag->getTagName() == 'label') {
- $this->_page->acceptLabelStart($tag);
- $this->_openTag($tag);
- return true;
- }
- if ($tag->getTagName() == 'form') {
- $this->_page->acceptFormStart($tag);
- return true;
- }
- if ($tag->getTagName() == 'frameset') {
- $this->_page->acceptFramesetStart($tag);
- return true;
- }
- if ($tag->getTagName() == 'frame') {
- $this->_page->acceptFrame($tag);
- return true;
- }
- if ($tag->isPrivateContent() && ! isset($this->_private_content_tag)) {
- $this->_private_content_tag = $tag;
- }
- if ($tag->expectEndTag()) {
- $this->_openTag($tag);
- return true;
- }
- $this->_page->acceptTag($tag);
- return true;
- }
-
- /**
- * End of element event.
- * @param string $name Element name.
- * @return boolean False on parse error.
- * @access public
- */
- function endElement($name) {
- if ($name == 'label') {
- $this->_page->acceptLabelEnd();
- return true;
- }
- if ($name == 'form') {
- $this->_page->acceptFormEnd();
- return true;
- }
- if ($name == 'frameset') {
- $this->_page->acceptFramesetEnd();
- return true;
- }
- if ($this->_hasNamedTagOnOpenTagStack($name)) {
- $tag = array_pop($this->_tags[$name]);
- if ($tag->isPrivateContent() && $this->_private_content_tag->getTagName() == $name) {
- unset($this->_private_content_tag);
- }
- $this->_addContentTagToOpenTags($tag);
- $this->_page->acceptTag($tag);
- return true;
- }
- return true;
- }
-
- /**
- * Test to see if there are any open tags awaiting
- * closure that match the tag name.
- * @param string $name Element name.
- * @return boolean True if any are still open.
- * @access private
- */
- function _hasNamedTagOnOpenTagStack($name) {
- return isset($this->_tags[$name]) && (count($this->_tags[$name]) > 0);
- }
-
- /**
- * Unparsed, but relevant data. The data is added
- * to every open tag.
- * @param string $text May include unparsed tags.
- * @return boolean False on parse error.
- * @access public
- */
- function addContent($text) {
- if (isset($this->_private_content_tag)) {
- $this->_private_content_tag->addContent($text);
- } else {
- $this->_addContentToAllOpenTags($text);
- }
- return true;
- }
-
- /**
- * Any content fills all currently open tags unless it
- * is part of an option tag.
- * @param string $text May include unparsed tags.
- * @access private
- */
- function _addContentToAllOpenTags($text) {
- foreach (array_keys($this->_tags) as $name) {
- for ($i = 0, $count = count($this->_tags[$name]); $i < $count; $i++) {
- $this->_tags[$name][$i]->addContent($text);
- }
- }
- }
-
- /**
- * Parsed data in tag form. The parsed tag is added
- * to every open tag. Used for adding options to select
- * fields only.
- * @param SimpleTag $tag Option tags only.
- * @access private
- */
- function _addContentTagToOpenTags($tag) {
- if ($tag->getTagName() != 'option') {
- return;
- }
- foreach (array_keys($this->_tags) as $name) {
- for ($i = 0, $count = count($this->_tags[$name]); $i < $count; $i++) {
- $this->_tags[$name][$i]->addTag($tag);
- }
- }
- }
-
- /**
- * Opens a tag for receiving content. Multiple tags
- * will be receiving input at the same time.
- * @param SimpleTag $tag New content tag.
- * @access private
- */
- function _openTag($tag) {
- $name = $tag->getTagName();
- if (! in_array($name, array_keys($this->_tags))) {
- $this->_tags[$name] = array();
- }
- $this->_tags[$name][] = $tag;
- }
- }
-
- /**
- * A wrapper for a web page.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimplePage {
- protected $_links;
- protected $_title;
- protected $_last_widget;
- protected $_label;
- protected $_left_over_labels;
- protected $_open_forms;
- protected $_complete_forms;
- protected $_frameset;
- protected $_frames;
- protected $_frameset_nesting_level;
- protected $_transport_error;
- protected $_raw;
- protected $_text;
- protected $_sent;
- protected $_headers;
- protected $_method;
- protected $_url;
- protected $_request_data;
-
- /**
- * Parses a page ready to access it's contents.
- * @param SimpleHttpResponse $response Result of HTTP fetch.
- * @access public
- */
- function SimplePage($response = false) {
- $this->_links = array();
- $this->_title = false;
- $this->_left_over_labels = array();
- $this->_open_forms = array();
- $this->_complete_forms = array();
- $this->_frameset = false;
- $this->_frames = array();
- $this->_frameset_nesting_level = 0;
- $this->_text = false;
- if ($response) {
- $this->_extractResponse($response);
- } else {
- $this->_noResponse();
- }
- }
-
- /**
- * Extracts all of the response information.
- * @param SimpleHttpResponse $response Response being parsed.
- * @access private
- */
- function _extractResponse($response) {
- $this->_transport_error = $response->getError();
- $this->_raw = $response->getContent();
- $this->_sent = $response->getSent();
- $this->_headers = $response->getHeaders();
- $this->_method = $response->getMethod();
- $this->_url = $response->getUrl();
- $this->_request_data = $response->getRequestData();
- }
-
- /**
- * Sets up a missing response.
- * @access private
- */
- function _noResponse() {
- $this->_transport_error = 'No page fetched yet';
- $this->_raw = false;
- $this->_sent = false;
- $this->_headers = false;
- $this->_method = 'GET';
- $this->_url = false;
- $this->_request_data = false;
- }
-
- /**
- * Original request as bytes sent down the wire.
- * @return mixed Sent content.
- * @access public
- */
- function getRequest() {
- return $this->_sent;
- }
-
- /**
- * Accessor for raw text of page.
- * @return string Raw unparsed content.
- * @access public
- */
- function getRaw() {
- return $this->_raw;
- }
-
- /**
- * Accessor for plain text of page as a text browser
- * would see it.
- * @return string Plain text of page.
- * @access public
- */
- function getText() {
- if (! $this->_text) {
- $this->_text = SimpleHtmlSaxParser::normalise($this->_raw);
- }
- return $this->_text;
- }
-
- /**
- * Accessor for raw headers of page.
- * @return string Header block as text.
- * @access public
- */
- function getHeaders() {
- if ($this->_headers) {
- return $this->_headers->getRaw();
- }
- return false;
- }
-
- /**
- * Original request method.
- * @return string GET, POST or HEAD.
- * @access public
- */
- function getMethod() {
- return $this->_method;
- }
-
- /**
- * Original resource name.
- * @return SimpleUrl Current url.
- * @access public
- */
- function getUrl() {
- return $this->_url;
- }
-
- /**
- * Original request data.
- * @return mixed Sent content.
- * @access public
- */
- function getRequestData() {
- return $this->_request_data;
- }
-
- /**
- * Accessor for last error.
- * @return string Error from last response.
- * @access public
- */
- function getTransportError() {
- return $this->_transport_error;
- }
-
- /**
- * Accessor for current MIME type.
- * @return string MIME type as string; e.g. 'text/html'
- * @access public
- */
- function getMimeType() {
- if ($this->_headers) {
- return $this->_headers->getMimeType();
- }
- return false;
- }
-
- /**
- * Accessor for HTTP response code.
- * @return integer HTTP response code received.
- * @access public
- */
- function getResponseCode() {
- if ($this->_headers) {
- return $this->_headers->getResponseCode();
- }
- return false;
- }
-
- /**
- * Accessor for last Authentication type. Only valid
- * straight after a challenge (401).
- * @return string Description of challenge type.
- * @access public
- */
- function getAuthentication() {
- if ($this->_headers) {
- return $this->_headers->getAuthentication();
- }
- return false;
- }
-
- /**
- * Accessor for last Authentication realm. Only valid
- * straight after a challenge (401).
- * @return string Name of security realm.
- * @access public
- */
- function getRealm() {
- if ($this->_headers) {
- return $this->_headers->getRealm();
- }
- return false;
- }
-
- /**
- * Accessor for current frame focus. Will be
- * false as no frames.
- * @return array Always empty.
- * @access public
- */
- function getFrameFocus() {
- return array();
- }
-
- /**
- * Sets the focus by index. The integer index starts from 1.
- * @param integer $choice Chosen frame.
- * @return boolean Always false.
- * @access public
- */
- function setFrameFocusByIndex($choice) {
- return false;
- }
-
- /**
- * Sets the focus by name. Always fails for a leaf page.
- * @param string $name Chosen frame.
- * @return boolean False as no frames.
- * @access public
- */
- function setFrameFocus($name) {
- return false;
- }
-
- /**
- * Clears the frame focus. Does nothing for a leaf page.
- * @access public
- */
- function clearFrameFocus() {
- }
-
- /**
- * Adds a tag to the page.
- * @param SimpleTag $tag Tag to accept.
- * @access public
- */
- function acceptTag($tag) {
- if ($tag->getTagName() == "a") {
- $this->_addLink($tag);
- } elseif ($tag->getTagName() == "title") {
- $this->_setTitle($tag);
- } elseif ($this->_isFormElement($tag->getTagName())) {
- for ($i = 0; $i < count($this->_open_forms); $i++) {
- $this->_open_forms[$i]->addWidget($tag);
- }
- $this->_last_widget = $tag;
- }
- }
-
- /**
- * Opens a label for a described widget.
- * @param SimpleFormTag $tag Tag to accept.
- * @access public
- */
- function acceptLabelStart($tag) {
- $this->_label = $tag;
- unset($this->_last_widget);
- }
-
- /**
- * Closes the most recently opened label.
- * @access public
- */
- function acceptLabelEnd() {
- if (isset($this->_label)) {
- if (isset($this->_last_widget)) {
- $this->_last_widget->setLabel($this->_label->getText());
- unset($this->_last_widget);
- } else {
- $this->_left_over_labels[] = SimpleTestCompatibility::copy($this->_label);
- }
- unset($this->_label);
- }
- }
-
- /**
- * Tests to see if a tag is a possible form
- * element.
- * @param string $name HTML element name.
- * @return boolean True if form element.
- * @access private
- */
- function _isFormElement($name) {
- return in_array($name, array('input', 'button', 'textarea', 'select'));
- }
-
- /**
- * Opens a form. New widgets go here.
- * @param SimpleFormTag $tag Tag to accept.
- * @access public
- */
- function acceptFormStart($tag) {
- $this->_open_forms[] = new SimpleForm($tag, $this->getUrl());
- }
-
- /**
- * Closes the most recently opened form.
- * @access public
- */
- function acceptFormEnd() {
- if (count($this->_open_forms)) {
- $this->_complete_forms[] = array_pop($this->_open_forms);
- }
- }
-
- /**
- * Opens a frameset. A frameset may contain nested
- * frameset tags.
- * @param SimpleFramesetTag $tag Tag to accept.
- * @access public
- */
- function acceptFramesetStart($tag) {
- if (! $this->_isLoadingFrames()) {
- $this->_frameset = $tag;
- }
- $this->_frameset_nesting_level++;
- }
-
- /**
- * Closes the most recently opened frameset.
- * @access public
- */
- function acceptFramesetEnd() {
- if ($this->_isLoadingFrames()) {
- $this->_frameset_nesting_level--;
- }
- }
-
- /**
- * Takes a single frame tag and stashes it in
- * the current frame set.
- * @param SimpleFrameTag $tag Tag to accept.
- * @access public
- */
- function acceptFrame($tag) {
- if ($this->_isLoadingFrames()) {
- if ($tag->getAttribute('src')) {
- $this->_frames[] = $tag;
- }
- }
- }
-
- /**
- * Test to see if in the middle of reading
- * a frameset.
- * @return boolean True if inframeset.
- * @access private
- */
- function _isLoadingFrames() {
- if (! $this->_frameset) {
- return false;
- }
- return ($this->_frameset_nesting_level > 0);
- }
-
- /**
- * Test to see if link is an absolute one.
- * @param string $url Url to test.
- * @return boolean True if absolute.
- * @access protected
- */
- function _linkIsAbsolute($url) {
- $parsed = new SimpleUrl($url);
- return (boolean)($parsed->getScheme() && $parsed->getHost());
- }
-
- /**
- * Adds a link to the page.
- * @param SimpleAnchorTag $tag Link to accept.
- * @access protected
- */
- function _addLink($tag) {
- $this->_links[] = $tag;
- }
-
- /**
- * Marker for end of complete page. Any work in
- * progress can now be closed.
- * @access public
- */
- function acceptPageEnd() {
- while (count($this->_open_forms)) {
- $this->_complete_forms[] = array_pop($this->_open_forms);
- }
- foreach ($this->_left_over_labels as $label) {
- for ($i = 0, $count = count($this->_complete_forms); $i < $count; $i++) {
- $this->_complete_forms[$i]->attachLabelBySelector(
- new SimpleById($label->getFor()),
- $label->getText());
- }
- }
- }
-
- /**
- * Test for the presence of a frameset.
- * @return boolean True if frameset.
- * @access public
- */
- function hasFrames() {
- return (boolean)$this->_frameset;
- }
-
- /**
- * Accessor for frame name and source URL for every frame that
- * will need to be loaded. Immediate children only.
- * @return boolean/array False if no frameset or
- * otherwise a hash of frame URLs.
- * The key is either a numerical
- * base one index or the name attribute.
- * @access public
- */
- function getFrameset() {
- if (! $this->_frameset) {
- return false;
- }
- $urls = array();
- for ($i = 0; $i < count($this->_frames); $i++) {
- $name = $this->_frames[$i]->getAttribute('name');
- $url = new SimpleUrl($this->_frames[$i]->getAttribute('src'));
- $urls[$name ? $name : $i + 1] = $url->makeAbsolute($this->getUrl());
- }
- return $urls;
- }
-
- /**
- * Fetches a list of loaded frames.
- * @return array/string Just the URL for a single page.
- * @access public
- */
- function getFrames() {
- $url = $this->getUrl();
- return $url->asString();
- }
-
- /**
- * Accessor for a list of all fixed links.
- * @return array List of urls with scheme of
- * http or https and hostname.
- * @access public
- */
- function getAbsoluteUrls() {
- $all = array();
- foreach ($this->_links as $link) {
- if ($this->_linkIsAbsolute($link->getHref())) {
- $all[] = $link->getHref();
- }
- }
- return $all;
- }
-
- /**
- * Accessor for a list of all relative links.
- * @return array List of urls without hostname.
- * @access public
- */
- function getRelativeUrls() {
- $all = array();
- foreach ($this->_links as $link) {
- if (! $this->_linkIsAbsolute($link->getHref())) {
- $all[] = $link->getHref();
- }
- }
- return $all;
- }
-
- /**
- * Accessor for URLs by the link label. Label will match
- * regardess of whitespace issues and case.
- * @param string $label Text of link.
- * @return array List of links with that label.
- * @access public
- */
- function getUrlsByLabel($label) {
- $matches = array();
- foreach ($this->_links as $link) {
- if ($link->getText() == $label) {
- $matches[] = $this->_getUrlFromLink($link);
- }
- }
- return $matches;
- }
-
- /**
- * Accessor for a URL by the id attribute.
- * @param string $id Id attribute of link.
- * @return SimpleUrl URL with that id of false if none.
- * @access public
- */
- function getUrlById($id) {
- foreach ($this->_links as $link) {
- if ($link->getAttribute('id') === (string)$id) {
- return $this->_getUrlFromLink($link);
- }
- }
- return false;
- }
-
- /**
- * Converts a link into a target URL.
- * @param SimpleAnchor $link Parsed link.
- * @return SimpleUrl URL with frame target if any.
- * @access private
- */
- function _getUrlFromLink($link) {
- $url = $this->_makeAbsolute($link->getHref());
- if ($link->getAttribute('target')) {
- $url->setTarget($link->getAttribute('target'));
- }
- return $url;
- }
-
- /**
- * Expands expandomatic URLs into fully qualified
- * URLs.
- * @param SimpleUrl $url Relative URL.
- * @return SimpleUrl Absolute URL.
- * @access protected
- */
- function _makeAbsolute($url) {
- if (! is_object($url)) {
- $url = new SimpleUrl($url);
- }
- return $url->makeAbsolute($this->getUrl());
- }
-
- /**
- * Sets the title tag contents.
- * @param SimpleTitleTag $tag Title of page.
- * @access protected
- */
- function _setTitle($tag) {
- $this->_title = $tag;
- }
-
- /**
- * Accessor for parsed title.
- * @return string Title or false if no title is present.
- * @access public
- */
- function getTitle() {
- if ($this->_title) {
- return $this->_title->getText();
- }
- return false;
- }
-
- /**
- * Finds a held form by button label. Will only
- * search correctly built forms.
- * @param SimpleSelector $selector Button finder.
- * @return SimpleForm Form object containing
- * the button.
- * @access public
- */
- function &getFormBySubmit($selector) {
- for ($i = 0; $i < count($this->_complete_forms); $i++) {
- if ($this->_complete_forms[$i]->hasSubmit($selector)) {
- return $this->_complete_forms[$i];
- }
- }
- $null = null;
- return $null;
- }
-
- /**
- * Finds a held form by image using a selector.
- * Will only search correctly built forms.
- * @param SimpleSelector $selector Image finder.
- * @return SimpleForm Form object containing
- * the image.
- * @access public
- */
- function &getFormByImage($selector) {
- for ($i = 0; $i < count($this->_complete_forms); $i++) {
- if ($this->_complete_forms[$i]->hasImage($selector)) {
- return $this->_complete_forms[$i];
- }
- }
- $null = null;
- return $null;
- }
-
- /**
- * Finds a held form by the form ID. A way of
- * identifying a specific form when we have control
- * of the HTML code.
- * @param string $id Form label.
- * @return SimpleForm Form object containing the matching ID.
- * @access public
- */
- function &getFormById($id) {
- for ($i = 0; $i < count($this->_complete_forms); $i++) {
- if ($this->_complete_forms[$i]->getId() == $id) {
- return $this->_complete_forms[$i];
- }
- }
- $null = null;
- return $null;
- }
-
- /**
- * Sets a field on each form in which the field is
- * available.
- * @param SimpleSelector $selector Field finder.
- * @param string $value Value to set field to.
- * @return boolean True if value is valid.
- * @access public
- */
- function setField($selector, $value) {
- $is_set = false;
- for ($i = 0; $i < count($this->_complete_forms); $i++) {
- if ($this->_complete_forms[$i]->setField($selector, $value)) {
- $is_set = true;
- }
- }
- return $is_set;
- }
-
- /**
- * Accessor for a form element value within a page.
- * @param SimpleSelector $selector Field finder.
- * @return string/boolean A string if the field is
- * present, false if unchecked
- * and null if missing.
- * @access public
- */
- function getField($selector) {
- for ($i = 0; $i < count($this->_complete_forms); $i++) {
- $value = $this->_complete_forms[$i]->getValue($selector);
- if (isset($value)) {
- return $value;
- }
- }
- return null;
- }
- }
diff --git a/tests/test_tools/simpletest/parser.php b/tests/test_tools/simpletest/parser.php
deleted file mode 100644
index 94fd40d0..00000000
--- a/tests/test_tools/simpletest/parser.php
+++ /dev/null
@@ -1,772 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage MockObjects
- * @version $Id: parser.php 1532 2006-12-01 12:28:55Z xue $
- */
-
- /**#@+
- * Lexer mode stack constants
- */
- if (! defined('LEXER_ENTER')) {
- define('LEXER_ENTER', 1);
- }
- if (! defined('LEXER_MATCHED')) {
- define('LEXER_MATCHED', 2);
- }
- if (! defined('LEXER_UNMATCHED')) {
- define('LEXER_UNMATCHED', 3);
- }
- if (! defined('LEXER_EXIT')) {
- define('LEXER_EXIT', 4);
- }
- if (! defined('LEXER_SPECIAL')) {
- define('LEXER_SPECIAL', 5);
- }
- /**#@-*/
-
- /**
- * Compounded regular expression. Any of
- * the contained patterns could match and
- * when one does, it's label is returned.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class ParallelRegex {
- protected $_patterns;
- protected $_labels;
- protected $_regex;
- protected $_case;
-
- /**
- * Constructor. Starts with no patterns.
- * @param boolean $case True for case sensitive, false
- * for insensitive.
- * @access public
- */
- function ParallelRegex($case) {
- $this->_case = $case;
- $this->_patterns = array();
- $this->_labels = array();
- $this->_regex = null;
- }
-
- /**
- * Adds a pattern with an optional label.
- * @param string $pattern Perl style regex, but ( and )
- * lose the usual meaning.
- * @param string $label Label of regex to be returned
- * on a match.
- * @access public
- */
- function addPattern($pattern, $label = true) {
- $count = count($this->_patterns);
- $this->_patterns[$count] = $pattern;
- $this->_labels[$count] = $label;
- $this->_regex = null;
- }
-
- /**
- * Attempts to match all patterns at once against
- * a string.
- * @param string $subject String to match against.
- * @param string $match First matched portion of
- * subject.
- * @return boolean True on success.
- * @access public
- */
- function match($subject, $match) {
- if (count($this->_patterns) == 0) {
- return false;
- }
- if (! preg_match($this->_getCompoundedRegex(), $subject, $matches)) {
- $match = '';
- return false;
- }
- $match = $matches[0];
- for ($i = 1; $i < count($matches); $i++) {
- if ($matches[$i]) {
- return $this->_labels[$i - 1];
- }
- }
- return true;
- }
-
- /**
- * Compounds the patterns into a single
- * regular expression separated with the
- * "or" operator. Caches the regex.
- * Will automatically escape (, ) and / tokens.
- * @param array $patterns List of patterns in order.
- * @access private
- */
- function _getCompoundedRegex() {
- if ($this->_regex == null) {
- for ($i = 0, $count = count($this->_patterns); $i < $count; $i++) {
- $this->_patterns[$i] = '(' . str_replace(
- array('/', '(', ')'),
- array('\/', '\(', '\)'),
- $this->_patterns[$i]) . ')';
- }
- $this->_regex = "/" . implode("|", $this->_patterns) . "/" . $this->_getPerlMatchingFlags();
- }
- return $this->_regex;
- }
-
- /**
- * Accessor for perl regex mode flags to use.
- * @return string Perl regex flags.
- * @access private
- */
- function _getPerlMatchingFlags() {
- return ($this->_case ? "msS" : "msSi");
- }
- }
-
- /**
- * States for a stack machine.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleStateStack {
- protected $_stack;
-
- /**
- * Constructor. Starts in named state.
- * @param string $start Starting state name.
- * @access public
- */
- function SimpleStateStack($start) {
- $this->_stack = array($start);
- }
-
- /**
- * Accessor for current state.
- * @return string State.
- * @access public
- */
- function getCurrent() {
- return $this->_stack[count($this->_stack) - 1];
- }
-
- /**
- * Adds a state to the stack and sets it
- * to be the current state.
- * @param string $state New state.
- * @access public
- */
- function enter($state) {
- array_push($this->_stack, $state);
- }
-
- /**
- * Leaves the current state and reverts
- * to the previous one.
- * @return boolean False if we drop off
- * the bottom of the list.
- * @access public
- */
- function leave() {
- if (count($this->_stack) == 1) {
- return false;
- }
- array_pop($this->_stack);
- return true;
- }
- }
-
- /**
- * Accepts text and breaks it into tokens.
- * Some optimisation to make the sure the
- * content is only scanned by the PHP regex
- * parser once. Lexer modes must not start
- * with leading underscores.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleLexer {
- protected $_regexes;
- protected $_parser;
- protected $_mode;
- protected $_mode_handlers;
- protected $_case;
-
- /**
- * Sets up the lexer in case insensitive matching
- * by default.
- * @param SimpleSaxParser $parser Handling strategy by
- * reference.
- * @param string $start Starting handler.
- * @param boolean $case True for case sensitive.
- * @access public
- */
- function SimpleLexer($parser, $start = "accept", $case = false) {
- $this->_case = $case;
- $this->_regexes = array();
- $this->_parser = $parser;
- $this->_mode = new SimpleStateStack($start);
- $this->_mode_handlers = array($start => $start);
- }
-
- /**
- * Adds a token search pattern for a particular
- * parsing mode. The pattern does not change the
- * current mode.
- * @param string $pattern Perl style regex, but ( and )
- * lose the usual meaning.
- * @param string $mode Should only apply this
- * pattern when dealing with
- * this type of input.
- * @access public
- */
- function addPattern($pattern, $mode = "accept") {
- if (! isset($this->_regexes[$mode])) {
- $this->_regexes[$mode] = new ParallelRegex($this->_case);
- }
- $this->_regexes[$mode]->addPattern($pattern);
- if (! isset($this->_mode_handlers[$mode])) {
- $this->_mode_handlers[$mode] = $mode;
- }
- }
-
- /**
- * Adds a pattern that will enter a new parsing
- * mode. Useful for entering parenthesis, strings,
- * tags, etc.
- * @param string $pattern Perl style regex, but ( and )
- * lose the usual meaning.
- * @param string $mode Should only apply this
- * pattern when dealing with
- * this type of input.
- * @param string $new_mode Change parsing to this new
- * nested mode.
- * @access public
- */
- function addEntryPattern($pattern, $mode, $new_mode) {
- if (! isset($this->_regexes[$mode])) {
- $this->_regexes[$mode] = new ParallelRegex($this->_case);
- }
- $this->_regexes[$mode]->addPattern($pattern, $new_mode);
- if (! isset($this->_mode_handlers[$new_mode])) {
- $this->_mode_handlers[$new_mode] = $new_mode;
- }
- }
-
- /**
- * Adds a pattern that will exit the current mode
- * and re-enter the previous one.
- * @param string $pattern Perl style regex, but ( and )
- * lose the usual meaning.
- * @param string $mode Mode to leave.
- * @access public
- */
- function addExitPattern($pattern, $mode) {
- if (! isset($this->_regexes[$mode])) {
- $this->_regexes[$mode] = new ParallelRegex($this->_case);
- }
- $this->_regexes[$mode]->addPattern($pattern, "__exit");
- if (! isset($this->_mode_handlers[$mode])) {
- $this->_mode_handlers[$mode] = $mode;
- }
- }
-
- /**
- * Adds a pattern that has a special mode. Acts as an entry
- * and exit pattern in one go, effectively calling a special
- * parser handler for this token only.
- * @param string $pattern Perl style regex, but ( and )
- * lose the usual meaning.
- * @param string $mode Should only apply this
- * pattern when dealing with
- * this type of input.
- * @param string $special Use this mode for this one token.
- * @access public
- */
- function addSpecialPattern($pattern, $mode, $special) {
- if (! isset($this->_regexes[$mode])) {
- $this->_regexes[$mode] = new ParallelRegex($this->_case);
- }
- $this->_regexes[$mode]->addPattern($pattern, "_$special");
- if (! isset($this->_mode_handlers[$special])) {
- $this->_mode_handlers[$special] = $special;
- }
- }
-
- /**
- * Adds a mapping from a mode to another handler.
- * @param string $mode Mode to be remapped.
- * @param string $handler New target handler.
- * @access public
- */
- function mapHandler($mode, $handler) {
- $this->_mode_handlers[$mode] = $handler;
- }
-
- /**
- * Splits the page text into tokens. Will fail
- * if the handlers report an error or if no
- * content is consumed. If successful then each
- * unparsed and parsed token invokes a call to the
- * held listener.
- * @param string $raw Raw HTML text.
- * @return boolean True on success, else false.
- * @access public
- */
- function parse($raw) {
- if (! isset($this->_parser)) {
- return false;
- }
- $length = strlen($raw);
- while (is_array($parsed = $this->_reduce($raw))) {
- list($raw, $unmatched, $matched, $mode) = $parsed;
- if (! $this->_dispatchTokens($unmatched, $matched, $mode)) {
- return false;
- }
- if ($raw === '') {
- return true;
- }
- if (strlen($raw) == $length) {
- return false;
- }
- $length = strlen($raw);
- }
- if (! $parsed) {
- return false;
- }
- return $this->_invokeParser($raw, LEXER_UNMATCHED);
- }
-
- /**
- * Sends the matched token and any leading unmatched
- * text to the parser changing the lexer to a new
- * mode if one is listed.
- * @param string $unmatched Unmatched leading portion.
- * @param string $matched Actual token match.
- * @param string $mode Mode after match. A boolean
- * false mode causes no change.
- * @return boolean False if there was any error
- * from the parser.
- * @access private
- */
- function _dispatchTokens($unmatched, $matched, $mode = false) {
- if (! $this->_invokeParser($unmatched, LEXER_UNMATCHED)) {
- return false;
- }
- if (is_bool($mode)) {
- return $this->_invokeParser($matched, LEXER_MATCHED);
- }
- if ($this->_isModeEnd($mode)) {
- if (! $this->_invokeParser($matched, LEXER_EXIT)) {
- return false;
- }
- return $this->_mode->leave();
- }
- if ($this->_isSpecialMode($mode)) {
- $this->_mode->enter($this->_decodeSpecial($mode));
- if (! $this->_invokeParser($matched, LEXER_SPECIAL)) {
- return false;
- }
- return $this->_mode->leave();
- }
- $this->_mode->enter($mode);
- return $this->_invokeParser($matched, LEXER_ENTER);
- }
-
- /**
- * Tests to see if the new mode is actually to leave
- * the current mode and pop an item from the matching
- * mode stack.
- * @param string $mode Mode to test.
- * @return boolean True if this is the exit mode.
- * @access private
- */
- function _isModeEnd($mode) {
- return ($mode === "__exit");
- }
-
- /**
- * Test to see if the mode is one where this mode
- * is entered for this token only and automatically
- * leaves immediately afterwoods.
- * @param string $mode Mode to test.
- * @return boolean True if this is the exit mode.
- * @access private
- */
- function _isSpecialMode($mode) {
- return (strncmp($mode, "_", 1) == 0);
- }
-
- /**
- * Strips the magic underscore marking single token
- * modes.
- * @param string $mode Mode to decode.
- * @return string Underlying mode name.
- * @access private
- */
- function _decodeSpecial($mode) {
- return substr($mode, 1);
- }
-
- /**
- * Calls the parser method named after the current
- * mode. Empty content will be ignored. The lexer
- * has a parser handler for each mode in the lexer.
- * @param string $content Text parsed.
- * @param boolean $is_match Token is recognised rather
- * than unparsed data.
- * @access private
- */
- function _invokeParser($content, $is_match) {
- if (($content === '') || ($content === false)) {
- return true;
- }
- $handler = $this->_mode_handlers[$this->_mode->getCurrent()];
- return $this->_parser->$handler($content, $is_match);
- }
-
- /**
- * Tries to match a chunk of text and if successful
- * removes the recognised chunk and any leading
- * unparsed data. Empty strings will not be matched.
- * @param string $raw The subject to parse. This is the
- * content that will be eaten.
- * @return array/boolean Three item list of unparsed
- * content followed by the
- * recognised token and finally the
- * action the parser is to take.
- * True if no match, false if there
- * is a parsing error.
- * @access private
- */
- function _reduce($raw) {
- if ($action = $this->_regexes[$this->_mode->getCurrent()]->match($raw, $match)) {
- $unparsed_character_count = strpos($raw, $match);
- $unparsed = substr($raw, 0, $unparsed_character_count);
- $raw = substr($raw, $unparsed_character_count + strlen($match));
- return array($raw, $unparsed, $match, $action);
- }
- return true;
- }
- }
-
- /**
- * Breas HTML into SAX events.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleHtmlLexer extends SimpleLexer {
-
- /**
- * Sets up the lexer with case insensitive matching
- * and adds the HTML handlers.
- * @param SimpleSaxParser $parser Handling strategy by
- * reference.
- * @access public
- */
- function SimpleHtmlLexer($parser) {
- $this->SimpleLexer($parser, 'text');
- $this->mapHandler('text', 'acceptTextToken');
- $this->_addSkipping();
- foreach ($this->_getParsedTags() as $tag) {
- $this->_addTag($tag);
- }
- $this->_addInTagTokens();
- }
-
- /**
- * List of parsed tags. Others are ignored.
- * @return array List of searched for tags.
- * @access private
- */
- function _getParsedTags() {
- return array('a', 'title', 'form', 'input', 'button', 'textarea', 'select',
- 'option', 'frameset', 'frame', 'label');
- }
-
- /**
- * The lexer has to skip certain sections such
- * as server code, client code and styles.
- * @access private
- */
- function _addSkipping() {
- $this->mapHandler('css', 'ignore');
- $this->addEntryPattern('<style', 'text', 'css');
- $this->addExitPattern('</style>', 'css');
- $this->mapHandler('js', 'ignore');
- $this->addEntryPattern('<script', 'text', 'js');
- $this->addExitPattern('</script>', 'js');
- $this->mapHandler('comment', 'ignore');
- $this->addEntryPattern('<!--', 'text', 'comment');
- $this->addExitPattern('-->', 'comment');
- }
-
- /**
- * Pattern matches to start and end a tag.
- * @param string $tag Name of tag to scan for.
- * @access private
- */
- function _addTag($tag) {
- $this->addSpecialPattern("</$tag>", 'text', 'acceptEndToken');
- $this->addEntryPattern("<$tag", 'text', 'tag');
- }
-
- /**
- * Pattern matches to parse the inside of a tag
- * including the attributes and their quoting.
- * @access private
- */
- function _addInTagTokens() {
- $this->mapHandler('tag', 'acceptStartToken');
- $this->addSpecialPattern('\s+', 'tag', 'ignore');
- $this->_addAttributeTokens();
- $this->addExitPattern('/>', 'tag');
- $this->addExitPattern('>', 'tag');
- }
-
- /**
- * Matches attributes that are either single quoted,
- * double quoted or unquoted.
- * @access private
- */
- function _addAttributeTokens() {
- $this->mapHandler('dq_attribute', 'acceptAttributeToken');
- $this->addEntryPattern('=\s*"', 'tag', 'dq_attribute');
- $this->addPattern("\\\\\"", 'dq_attribute');
- $this->addExitPattern('"', 'dq_attribute');
- $this->mapHandler('sq_attribute', 'acceptAttributeToken');
- $this->addEntryPattern("=\s*'", 'tag', 'sq_attribute');
- $this->addPattern("\\\\'", 'sq_attribute');
- $this->addExitPattern("'", 'sq_attribute');
- $this->mapHandler('uq_attribute', 'acceptAttributeToken');
- $this->addSpecialPattern('=\s*[^>\s]*', 'tag', 'uq_attribute');
- }
- }
-
- /**
- * Converts HTML tokens into selected SAX events.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleHtmlSaxParser {
- protected $_lexer;
- protected $_listener;
- protected $_tag;
- protected $_attributes;
- protected $_current_attribute;
-
- /**
- * Sets the listener.
- * @param SimpleSaxListener $listener SAX event handler.
- * @access public
- */
- function SimpleHtmlSaxParser($listener) {
- $this->_listener = $listener;
- $this->_lexer = $this->createLexer($this);
- $this->_tag = '';
- $this->_attributes = array();
- $this->_current_attribute = '';
- }
-
- /**
- * Runs the content through the lexer which
- * should call back to the acceptors.
- * @param string $raw Page text to parse.
- * @return boolean False if parse error.
- * @access public
- */
- function parse($raw) {
- return $this->_lexer->parse($raw);
- }
-
- /**
- * Sets up the matching lexer. Starts in 'text' mode.
- * @param SimpleSaxParser $parser Event generator, usually $self.
- * @return SimpleLexer Lexer suitable for this parser.
- * @access public
- * @static
- */
- static function &createLexer($parser) {
- $lexer = new SimpleHtmlLexer($parser);
- return $lexer;
- }
-
- /**
- * Accepts a token from the tag mode. If the
- * starting element completes then the element
- * is dispatched and the current attributes
- * set back to empty. The element or attribute
- * name is converted to lower case.
- * @param string $token Incoming characters.
- * @param integer $event Lexer event type.
- * @return boolean False if parse error.
- * @access public
- */
- function acceptStartToken($token, $event) {
- if ($event == LEXER_ENTER) {
- $this->_tag = strtolower(substr($token, 1));
- return true;
- }
- if ($event == LEXER_EXIT) {
- $success = $this->_listener->startElement(
- $this->_tag,
- $this->_attributes);
- $this->_tag = '';
- $this->_attributes = array();
- return $success;
- }
- if ($token != '=') {
- $this->_current_attribute = strtolower(SimpleHtmlSaxParser::decodeHtml($token));
- $this->_attributes[$this->_current_attribute] = '';
- }
- return true;
- }
-
- /**
- * Accepts a token from the end tag mode.
- * The element name is converted to lower case.
- * @param string $token Incoming characters.
- * @param integer $event Lexer event type.
- * @return boolean False if parse error.
- * @access public
- */
- function acceptEndToken($token, $event) {
- if (! preg_match('/<\/(.*)>/', $token, $matches)) {
- return false;
- }
- return $this->_listener->endElement(strtolower($matches[1]));
- }
-
- /**
- * Part of the tag data.
- * @param string $token Incoming characters.
- * @param integer $event Lexer event type.
- * @return boolean False if parse error.
- * @access public
- */
- function acceptAttributeToken($token, $event) {
- if ($event == LEXER_UNMATCHED) {
- $this->_attributes[$this->_current_attribute] .=
- SimpleHtmlSaxParser::decodeHtml($token);
- }
- if ($event == LEXER_SPECIAL) {
- $this->_attributes[$this->_current_attribute] .=
- preg_replace('/^=\s*/' , '', SimpleHtmlSaxParser::decodeHtml($token));
- }
- return true;
- }
-
- /**
- * A character entity.
- * @param string $token Incoming characters.
- * @param integer $event Lexer event type.
- * @return boolean False if parse error.
- * @access public
- */
- function acceptEntityToken($token, $event) {
- }
-
- /**
- * Character data between tags regarded as
- * important.
- * @param string $token Incoming characters.
- * @param integer $event Lexer event type.
- * @return boolean False if parse error.
- * @access public
- */
- function acceptTextToken($token, $event) {
- return $this->_listener->addContent($token);
- }
-
- /**
- * Incoming data to be ignored.
- * @param string $token Incoming characters.
- * @param integer $event Lexer event type.
- * @return boolean False if parse error.
- * @access public
- */
- function ignore($token, $event) {
- return true;
- }
-
- /**
- * Decodes any HTML entities.
- * @param string $html Incoming HTML.
- * @return string Outgoing plain text.
- * @access public
- * @static
- */
- static function decodeHtml($html) {
- static $translations;
- if (! isset($translations)) {
- $translations = array_flip(get_html_translation_table(HTML_ENTITIES));
- }
- return strtr($html, $translations);
- }
-
- /**
- * Turns HTML into text browser visible text. Images
- * are converted to their alt text and tags are supressed.
- * Entities are converted to their visible representation.
- * @param string $html HTML to convert.
- * @return string Plain text.
- * @access public
- * @static
- */
- static function normalise($html) {
- $text = preg_replace('|<!--.*?-->|', '', $html);
- $text = preg_replace('|<img.*?alt\s*=\s*"(.*?)".*?>|', ' \1 ', $text);
- $text = preg_replace('|<img.*?alt\s*=\s*\'(.*?)\'.*?>|', ' \1 ', $text);
- $text = preg_replace('|<img.*?alt\s*=\s*([a-zA-Z_]+).*?>|', ' \1 ', $text);
- $text = preg_replace('|<.*?>|', '', $text);
- $text = SimpleHtmlSaxParser::decodeHtml($text);
- $text = preg_replace('|\s+|', ' ', $text);
- return trim($text);
- }
- }
-
- /**
- * SAX event handler.
- * @package SimpleTest
- * @subpackage WebTester
- * @abstract
- */
- class SimpleSaxListener {
-
- /**
- * Sets the document to write to.
- * @access public
- */
- function SimpleSaxListener() {
- }
-
- /**
- * Start of element event.
- * @param string $name Element name.
- * @param hash $attributes Name value pairs.
- * Attributes without content
- * are marked as true.
- * @return boolean False on parse error.
- * @access public
- */
- function startElement($name, $attributes) {
- }
-
- /**
- * End of element event.
- * @param string $name Element name.
- * @return boolean False on parse error.
- * @access public
- */
- function endElement($name) {
- }
-
- /**
- * Unparsed, but relevant data.
- * @param string $text May include unparsed tags.
- * @return boolean False on parse error.
- * @access public
- */
- function addContent($text) {
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/reflection_php4.php b/tests/test_tools/simpletest/reflection_php4.php
deleted file mode 100644
index df9c76cc..00000000
--- a/tests/test_tools/simpletest/reflection_php4.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: reflection_php4.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**
- * Version specific reflection API.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleReflection {
- protected $_interface;
-
- /**
- * Stashes the class/interface.
- * @param string $interface Class or interface
- * to inspect.
- */
- function SimpleReflection($interface) {
- $this->_interface = $interface;
- }
-
- /**
- * Checks that a class has been declared.
- * @return boolean True if defined.
- * @access public
- */
- function classExists() {
- return class_exists($this->_interface);
- }
-
- /**
- * Needed to kill the autoload feature in PHP5
- * for classes created dynamically.
- * @return boolean True if defined.
- * @access public
- */
- function classExistsSansAutoload() {
- return class_exists($this->_interface);
- }
-
- /**
- * Checks that a class or interface has been
- * declared.
- * @return boolean True if defined.
- * @access public
- */
- function classOrInterfaceExists() {
- return class_exists($this->_interface);
- }
-
- /**
- * Needed to kill the autoload feature in PHP5
- * for classes created dynamically.
- * @return boolean True if defined.
- * @access public
- */
- function classOrInterfaceExistsSansAutoload() {
- return class_exists($this->_interface);
- }
-
- /**
- * Gets the list of methods on a class or
- * interface.
- * @returns array List of method names.
- * @access public
- */
- function getMethods() {
- return get_class_methods($this->_interface);
- }
-
- /**
- * Gets the list of interfaces from a class. If the
- * class name is actually an interface then just that
- * interface is returned.
- * @returns array List of interfaces.
- * @access public
- */
- function getInterfaces() {
- return array();
- }
-
- /**
- * Finds the parent class name.
- * @returns string Parent class name.
- * @access public
- */
- function getParent() {
- return strtolower(get_parent_class($this->_interface));
- }
-
- /**
- * Determines if the class is abstract, which for PHP 4
- * will never be the case.
- * @returns boolean True if abstract.
- * @access public
- */
- function isAbstract() {
- return false;
- }
-
- /**
- * Gets the source code matching the declaration
- * of a method.
- * @param string $method Method name.
- * @access public
- */
- function getSignature($method) {
- return "function $method()";
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/reflection_php5.php b/tests/test_tools/simpletest/reflection_php5.php
deleted file mode 100644
index 6d2ad360..00000000
--- a/tests/test_tools/simpletest/reflection_php5.php
+++ /dev/null
@@ -1,274 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: reflection_php5.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**
- * Version specific reflection API.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleReflection {
- protected $_interface;
-
- /**
- * Stashes the class/interface.
- * @param string $interface Class or interface
- * to inspect.
- */
- function SimpleReflection($interface) {
- $this->_interface = $interface;
- }
-
- /**
- * Checks that a class has been declared. Versions
- * before PHP5.0.2 need a check that it's not really
- * an interface.
- * @return boolean True if defined.
- * @access public
- */
- function classExists() {
- if (! class_exists($this->_interface)) {
- return false;
- }
- $reflection = new ReflectionClass($this->_interface);
- return ! $reflection->isInterface();
- }
-
- /**
- * Needed to kill the autoload feature in PHP5
- * for classes created dynamically.
- * @return boolean True if defined.
- * @access public
- */
- function classExistsSansAutoload() {
- return class_exists($this->_interface, false);
- }
-
- /**
- * Checks that a class or interface has been
- * declared.
- * @return boolean True if defined.
- * @access public
- */
- function classOrInterfaceExists() {
- return $this->_classOrInterfaceExistsWithAutoload($this->_interface, true);
- }
-
- /**
- * Needed to kill the autoload feature in PHP5
- * for classes created dynamically.
- * @return boolean True if defined.
- * @access public
- */
- function classOrInterfaceExistsSansAutoload() {
- return $this->_classOrInterfaceExistsWithAutoload($this->_interface, false);
- }
-
- /**
- * Needed to select the autoload feature in PHP5
- * for classes created dynamically.
- * @param string $interface Class or interface name.
- * @param boolean $autoload True totriggerautoload.
- * @return boolean True if interface defined.
- * @access private
- */
- function _classOrInterfaceExistsWithAutoload($interface, $autoload) {
- if (function_exists('interface_exists')) {
- if (interface_exists($this->_interface, $autoload)) {
- return true;
- }
- }
- return class_exists($this->_interface, $autoload);
- }
-
- /**
- * Gets the list of methods on a class or
- * interface. Needs to recursively look at all of
- * the interfaces included.
- * @returns array List of method names.
- * @access public
- */
- function getMethods() {
- return array_unique(get_class_methods($this->_interface));
- }
-
- /**
- * Gets the list of interfaces from a class. If the
- * class name is actually an interface then just that
- * interface is returned.
- * @returns array List of interfaces.
- * @access public
- */
- function getInterfaces() {
- $reflection = new ReflectionClass($this->_interface);
- if ($reflection->isInterface()) {
- return array($this->_interface);
- }
- return $this->_onlyParents($reflection->getInterfaces());
- }
-
- /**
- * Gets the list of methods for the implemented
- * interfaces only.
- * @returns array List of enforced method signatures.
- * @access public
- */
- function getInterfaceMethods() {
- $methods = array();
- foreach ($this->getInterfaces() as $interface) {
- $methods = array_merge($methods, get_class_methods($interface));
- }
- return array_unique($methods);
- }
-
- /**
- * Checks to see if the method signature has to be tightly
- * specified.
- * @param string $method Method name.
- * @returns boolean True if enforced.
- * @access private
- */
- function _isInterfaceMethod($method) {
- return in_array($method, $this->getInterfaceMethods());
- }
-
- /**
- * Finds the parent class name.
- * @returns string Parent class name.
- * @access public
- */
- function getParent() {
- $reflection = new ReflectionClass($this->_interface);
- $parent = $reflection->getParentClass();
- if ($parent) {
- return $parent->getName();
- }
- return false;
- }
-
- /**
- * Determines if the class is abstract.
- * @returns boolean True if abstract.
- * @access public
- */
- function isAbstract() {
- $reflection = new ReflectionClass($this->_interface);
- return $reflection->isAbstract();
- }
-
- /**
- * Wittles a list of interfaces down to only the top
- * level parents.
- * @param array $interfaces Reflection API interfaces
- * to reduce.
- * @returns array List of parent interface names.
- * @access private
- */
- function _onlyParents($interfaces) {
- $parents = array();
- foreach ($interfaces as $interface) {
- foreach($interfaces as $possible_parent) {
- if ($interface->getName() == $possible_parent->getName()) {
- continue;
- }
- if ($interface->isSubClassOf($possible_parent)) {
- break;
- }
- }
- $parents[] = $interface->getName();
- }
- return $parents;
- }
-
- /**
- * Gets the source code matching the declaration
- * of a method.
- * @param string $name Method name.
- * @return string Method signature up to last
- * bracket.
- * @access public
- */
- function getSignature($name) {
- if ($name == '__get') {
- return 'function __get($key)';
- }
- if ($name == '__set') {
- return 'function __set($key, $value)';
- }
- if (! is_callable(array($this->_interface, $name))) {
- return "function $name()";
- }
- if ($this->_isInterfaceMethod($name)) {
- return $this->_getFullSignature($name);
- }
- return "function $name()";
- }
-
- /**
- * For a signature specified in an interface, full
- * details must be replicated to be a valid implementation.
- * @param string $name Method name.
- * @return string Method signature up to last
- * bracket.
- * @access private
- */
- function _getFullSignature($name) {
- $interface = new ReflectionClass($this->_interface);
- $method = $interface->getMethod($name);
- $reference = $method->returnsReference() ? '&' : '';
- return "function $reference$name(" .
- implode(', ', $this->_getParameterSignatures($method)) .
- ")";
- }
-
- /**
- * Gets the source code for each parameter.
- * @param ReflectionMethod $method Method object from
- * reflection API
- * @return array List of strings, each
- * a snippet of code.
- * @access private
- */
- function _getParameterSignatures($method) {
- $signatures = array();
- foreach ($method->getParameters() as $parameter) {
- $type = $parameter->getClass();
- $signatures[] =
- (! is_null($type) ? $type->getName() . ' ' : '') .
- ($parameter->isPassedByReference() ? '&' : '') .
- '$' . $this->_suppressSpurious($parameter->getName()) .
- ($this->_isOptional($parameter) ? ' = null' : '');
- }
- return $signatures;
- }
-
- /**
- * The SPL library has problems with the
- * Reflection library. In particular, you can
- * get extra characters in parameter names :(.
- * @param string $name Parameter name.
- * @return string Cleaner name.
- * @access private
- */
- function _suppressSpurious($name) {
- return str_replace(array('[', ']', ' '), '', $name);
- }
-
- /**
- * Test of a reflection parameter being optional
- * that works with early versions of PHP5.
- * @param reflectionParameter $parameter Is this optional.
- * @return boolean True if optional.
- * @access private
- */
- function _isOptional($parameter) {
- if (method_exists($parameter, 'isOptional')) {
- return $parameter->isOptional();
- }
- return false;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/remote.php b/tests/test_tools/simpletest/remote.php
deleted file mode 100644
index 1868733d..00000000
--- a/tests/test_tools/simpletest/remote.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: remote.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/browser.php');
- require_once(dirname(__FILE__) . '/xml.php');
- require_once(dirname(__FILE__) . '/test_case.php');
- /**#@-*/
-
- /**
- * Runs an XML formated test on a remote server.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class RemoteTestCase {
- protected $_url;
- protected $_dry_url;
- protected $_size;
-
- /**
- * Sets the location of the remote test.
- * @param string $url Test location.
- * @param string $dry_url Location for dry run.
- * @access public
- */
- function RemoteTestCase($url, $dry_url = false) {
- $this->_url = $url;
- $this->_dry_url = $dry_url ? $dry_url : $url;
- $this->_size = false;
- }
-
- /**
- * Accessor for the test name for subclasses.
- * @return string Name of the test.
- * @access public
- */
- function getLabel() {
- return $this->_url;
- }
-
- /**
- * Runs the top level test for this class. Currently
- * reads the data as a single chunk. I'll fix this
- * once I have added iteration to the browser.
- * @param SimpleReporter $reporter Target of test results.
- * @returns boolean True if no failures.
- * @access public
- */
- function run($reporter) {
- $browser = $this->_createBrowser();
- $xml = $browser->get($this->_url);
- if (! $xml) {
- trigger_error('Cannot read remote test URL [' . $this->_url . ']');
- return false;
- }
- $parser = $this->_createParser($reporter);
- if (! $parser->parse($xml)) {
- trigger_error('Cannot parse incoming XML from [' . $this->_url . ']');
- return false;
- }
- return true;
- }
-
- /**
- * Creates a new web browser object for fetching
- * the XML report.
- * @return SimpleBrowser New browser.
- * @access protected
- */
- function &_createBrowser() {
- return new SimpleBrowser();
- }
-
- /**
- * Creates the XML parser.
- * @param SimpleReporter $reporter Target of test results.
- * @return SimpleTestXmlListener XML reader.
- * @access protected
- */
- function &_createParser($reporter) {
- return new SimpleTestXmlParser($reporter);
- }
-
- /**
- * Accessor for the number of subtests.
- * @return integer Number of test cases.
- * @access public
- */
- function getSize() {
- if ($this->_size === false) {
- $browser = $this->_createBrowser();
- $xml = $browser->get($this->_dry_url);
- if (! $xml) {
- trigger_error('Cannot read remote test URL [' . $this->_dry_url . ']');
- return false;
- }
- $reporter = new SimpleReporter();
- $parser = $this->_createParser($reporter);
- if (! $parser->parse($xml)) {
- trigger_error('Cannot parse incoming XML from [' . $this->_dry_url . ']');
- return false;
- }
- $this->_size = $reporter->getTestCaseCount();
- }
- return $this->_size;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/reporter.php b/tests/test_tools/simpletest/reporter.php
deleted file mode 100644
index a6b5a85a..00000000
--- a/tests/test_tools/simpletest/reporter.php
+++ /dev/null
@@ -1,366 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: reporter.php 1532 2006-12-01 12:28:55Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/scorer.php');
- /**#@-*/
-
- /**
- * Sample minimal test displayer. Generates only
- * failure messages and a pass count.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class HtmlReporter extends SimpleReporter {
- protected $_character_set;
-
- /**
- * Does nothing yet. The first output will
- * be sent on the first test start. For use
- * by a web browser.
- * @access public
- */
- function HtmlReporter($character_set = 'ISO-8859-1') {
- $this->SimpleReporter();
- $this->_character_set = $character_set;
- }
-
- /**
- * Paints the top of the web page setting the
- * title to the name of the starting test.
- * @param string $test_name Name class of test.
- * @access public
- */
- function paintHeader($test_name) {
- $this->sendNoCacheHeaders();
- print "<html>\n<head>\n<title>$test_name</title>\n";
- print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" .
- $this->_character_set . "\">\n";
- print "<style type=\"text/css\">\n";
- print $this->_getCss() . "\n";
- print "</style>\n";
- print "</head>\n<body>\n";
- print "<h1>$test_name</h1>\n";
- flush();
- }
-
- /**
- * Send the headers necessary to ensure the page is
- * reloaded on every request. Otherwise you could be
- * scratching your head over out of date test data.
- * @access public
- * @static
- */
- static function sendNoCacheHeaders() {
- if (! headers_sent()) {
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
- header("Cache-Control: no-store, no-cache, must-revalidate");
- header("Cache-Control: post-check=0, pre-check=0", false);
- header("Pragma: no-cache");
- }
- }
-
- /**
- * Paints the CSS. Add additional styles here.
- * @return string CSS code as text.
- * @access protected
- */
- function _getCss() {
- return ".fail { color: red; } pre { background-color: lightgray; }";
- }
-
- /**
- * Paints the end of the test with a summary of
- * the passes and failures.
- * @param string $test_name Name class of test.
- * @access public
- */
- function paintFooter($test_name) {
- $colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green");
- print "<div style=\"";
- print "padding: 8px; margin-top: 1em; background-color: $colour; color: white;";
- print "\">";
- print $this->getTestCaseProgress() . "/" . $this->getTestCaseCount();
- print " test cases complete:\n";
- print "<strong>" . $this->getPassCount() . "</strong> passes, ";
- print "<strong>" . $this->getFailCount() . "</strong> fails and ";
- print "<strong>" . $this->getExceptionCount() . "</strong> exceptions.";
- print "</div>\n";
- print "</body>\n</html>\n";
- }
-
- /**
- * Paints the test failure with a breadcrumbs
- * trail of the nesting test suites below the
- * top level test.
- * @param string $message Failure message displayed in
- * the context of the other tests.
- * @access public
- */
- function paintFail($message) {
- parent::paintFail($message);
- print "<span class=\"fail\">Fail</span>: ";
- $breadcrumb = $this->getTestList();
- array_shift($breadcrumb);
- print implode(" -&gt; ", $breadcrumb);
- print " -&gt; " . $this->_htmlEntities($message) . "<br />\n";
- }
-
- /**
- * Paints a PHP error or exception.
- * @param string $message Message is ignored.
- * @access public
- * @abstract
- */
- function paintError($message) {
- parent::paintError($message);
- print "<span class=\"fail\">Exception</span>: ";
- $breadcrumb = $this->getTestList();
- array_shift($breadcrumb);
- print implode(" -&gt; ", $breadcrumb);
- print " -&gt; <strong>" . $this->_htmlEntities($message) . "</strong><br />\n";
- }
-
- /**
- * Paints formatted text such as dumped variables.
- * @param string $message Text to show.
- * @access public
- */
- function paintFormattedMessage($message) {
- print '<pre>' . $this->_htmlEntities($message) . '</pre>';
- }
-
- /**
- * Character set adjusted entity conversion.
- * @param string $message Plain text or Unicode message.
- * @return string Browser readable message.
- * @access protected
- */
- function _htmlEntities($message) {
- return htmlentities($message, ENT_COMPAT, $this->_character_set);
- }
- }
-
- /**
- * Sample minimal test displayer. Generates only
- * failure messages and a pass count. For command
- * line use. I've tried to make it look like JUnit,
- * but I wanted to output the errors as they arrived
- * which meant dropping the dots.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class TextReporter extends SimpleReporter {
-
- /**
- * Does nothing yet. The first output will
- * be sent on the first test start.
- * @access public
- */
- function TextReporter() {
- $this->SimpleReporter();
- }
-
- /**
- * Paints the title only.
- * @param string $test_name Name class of test.
- * @access public
- */
- function paintHeader($test_name) {
- if (! SimpleReporter::inCli()) {
- header('Content-type: text/plain');
- }
- print "$test_name\n";
- flush();
- }
-
- /**
- * Paints the end of the test with a summary of
- * the passes and failures.
- * @param string $test_name Name class of test.
- * @access public
- */
- function paintFooter($test_name) {
- if ($this->getFailCount() + $this->getExceptionCount() == 0) {
- print "OK\n";
- } else {
- print "FAILURES!!!\n";
- }
- print "Test cases run: " . $this->getTestCaseProgress() .
- "/" . $this->getTestCaseCount() .
- ", Passes: " . $this->getPassCount() .
- ", Failures: " . $this->getFailCount() .
- ", Exceptions: " . $this->getExceptionCount() . "\n";
- }
-
- /**
- * Paints the test failure as a stack trace.
- * @param string $message Failure message displayed in
- * the context of the other tests.
- * @access public
- */
- function paintFail($message) {
- parent::paintFail($message);
- print $this->getFailCount() . ") $message\n";
- $breadcrumb = $this->getTestList();
- array_shift($breadcrumb);
- print "\tin " . implode("\n\tin ", array_reverse($breadcrumb));
- print "\n";
- }
-
- /**
- * Paints a PHP error or exception.
- * @param string $message Message is ignored.
- * @access public
- * @abstract
- */
- function paintError($message) {
- parent::paintError($message);
- print "Exception " . $this->getExceptionCount() . "!\n$message\n";
- }
-
- /**
- * Paints formatted text such as dumped variables.
- * @param string $message Text to show.
- * @access public
- */
- function paintFormattedMessage($message) {
- print "$message\n";
- flush();
- }
- }
-
- /**
- * Runs just a single test group, a single case or
- * even a single test within that case.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SelectiveReporter extends SimpleReporterDecorator {
- protected $_just_this_case =false;
- protected $_just_this_test = false;
- protected $_within_test_case = true;
-
- /**
- * Selects the test case or group to be run,
- * and optionally a specific test.
- * @param SimpleScorer $reporter Reporter to receive events.
- * @param string $just_this_case Only this case or group will run.
- * @param string $just_this_test Only this test method will run.
- */
- function SelectiveReporter($reporter, $just_this_case = false, $just_this_test = false) {
- if (isset($just_this_case) && $just_this_case) {
- $this->_just_this_case = strtolower($just_this_case);
- $this->_within_test_case = false;
- }
- if (isset($just_this_test) && $just_this_test) {
- $this->_just_this_test = strtolower($just_this_test);
- }
- $this->SimpleReporterDecorator($reporter);
- }
-
- /**
- * Compares criteria to actual the case/group name.
- * @param string $test_case The incoming test.
- * @return boolean True if matched.
- * @access protected
- */
- function _isCaseMatch($test_case) {
- if ($this->_just_this_case) {
- return $this->_just_this_case == strtolower($test_case);
- }
- return false;
- }
-
- /**
- * Compares criteria to actual the test name.
- * @param string $method The incoming test method.
- * @return boolean True if matched.
- * @access protected
- */
- function _isTestMatch($method) {
- if ($this->_just_this_test) {
- return $this->_just_this_test == strtolower($method);
- }
- return true;
- }
-
- /**
- * Veto everything that doesn't match the method wanted.
- * @param string $test_case Name of test case.
- * @param string $method Name of test method.
- * @return boolean True if test should be run.
- * @access public
- */
- function shouldInvoke($test_case, $method) {
- if ($this->_within_test_case && $this->_isTestMatch($method)) {
- return $this->_reporter->shouldInvoke($test_case, $method);
- }
- return false;
- }
-
- /**
- * Paints the start of a group test.
- * @param string $test_case Name of test or other label.
- * @param integer $size Number of test cases starting.
- * @access public
- */
- function paintGroupStart($test_case, $size) {
- if ($this->_isCaseMatch($test_case)) {
- $this->_within_test_case = true;
- }
- if ($this->_within_test_case) {
- $this->_reporter->paintGroupStart($test_case, $size);
- }
- }
-
- /**
- * Paints the end of a group test.
- * @param string $test_case Name of test or other label.
- * @access public
- */
- function paintGroupEnd($test_case) {
- if ($this->_within_test_case) {
- $this->_reporter->paintGroupEnd($test_case);
- }
- if ($this->_isCaseMatch($test_case)) {
- $this->_within_test_case = false;
- }
- }
-
- /**
- * Paints the start of a test case.
- * @param string $test_case Name of test or other label.
- * @access public
- */
- function paintCaseStart($test_case) {
- if ($this->_isCaseMatch($test_case)) {
- $this->_within_test_case = true;
- }
- if ($this->_within_test_case) {
- $this->_reporter->paintCaseStart($test_case);
- }
- }
-
- /**
- * Paints the end of a test case.
- * @param string $test_case Name of test or other label.
- * @access public
- */
- function paintCaseEnd($test_case) {
- if ($this->_within_test_case) {
- $this->_reporter->paintCaseEnd($test_case);
- }
- if ($this->_isCaseMatch($test_case)) {
- $this->_within_test_case = false;
- }
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/runner.php b/tests/test_tools/simpletest/runner.php
deleted file mode 100644
index d7303895..00000000
--- a/tests/test_tools/simpletest/runner.php
+++ /dev/null
@@ -1,299 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: runner.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * Includes SimpleTest files and defined the root constant
- * for dependent libraries.
- */
- require_once(dirname(__FILE__) . '/errors.php');
- require_once(dirname(__FILE__) . '/options.php');
- require_once(dirname(__FILE__) . '/scorer.php');
- require_once(dirname(__FILE__) . '/expectation.php');
- require_once(dirname(__FILE__) . '/dumper.php');
- if (! defined('SIMPLE_TEST')) {
- define('SIMPLE_TEST', dirname(__FILE__) . '/');
- }
- /**#@-*/
-
- /**
- * This is called by the class runner to run a
- * single test method. Will also run the setUp()
- * and tearDown() methods.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleInvoker {
- protected $_test_case;
-
- /**
- * Stashes the test case for later.
- * @param SimpleTestCase $test_case Test case to run.
- */
- function SimpleInvoker($test_case) {
- $this->_test_case = $test_case;
- }
-
- /**
- * Accessor for test case being run.
- * @return SimpleTestCase Test case.
- * @access public
- */
- function getTestCase() {
- return $this->_test_case;
- }
-
- /**
- * Invokes a test method and buffered with setUp()
- * and tearDown() calls.
- * @param string $method Test method to call.
- * @access public
- */
- function invoke($method) {
- $this->_test_case->setUp();
- $this->_test_case->$method();
- $this->_test_case->tearDown();
- }
- }
-
- /**
- * Do nothing decorator. Just passes the invocation
- * straight through.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleInvokerDecorator {
- protected $_invoker;
-
- /**
- * Stores the invoker to wrap.
- * @param SimpleInvoker $invoker Test method runner.
- */
- function SimpleInvokerDecorator($invoker) {
- $this->_invoker = $invoker;
- }
-
- /**
- * Accessor for test case being run.
- * @return SimpleTestCase Test case.
- * @access public
- */
- function getTestCase() {
- return $this->_invoker->getTestCase();
- }
-
- /**
- * Invokes a test method and buffered with setUp()
- * and tearDown() calls.
- * @param string $method Test method to call.
- * @access public
- */
- function invoke($method) {
- $this->_invoker->invoke($method);
- }
- }
-
- /**
- * Extension that traps errors into an error queue.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleErrorTrappingInvoker extends SimpleInvokerDecorator {
-
- /**
- /**
- * Stores the invoker to wrap.
- * @param SimpleInvoker $invoker Test method runner.
- */
- function SimpleErrorTrappingInvoker($invoker) {
- $this->SimpleInvokerDecorator($invoker);
- }
-
- /**
- * Invokes a test method and dispatches any
- * untrapped errors. Called back from
- * the visiting runner.
- * @param string $method Test method to call.
- * @access public
- */
- function invoke($method) {
- set_error_handler('simpleTestErrorHandler');
- parent::invoke($method);
- $queue = SimpleErrorQueue::instance();
- while (list($severity, $message, $file, $line, $globals) = $queue->extract()) {
- $test_case = $this->getTestCase();
- $test_case->error($severity, $message, $file, $line, $globals);
- }
- restore_error_handler();
- }
- }
-
- /**
- * The standard runner. Will run every method starting
- * with test Basically the
- * Mediator pattern.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleRunner {
- protected $_test_case;
- protected $_scorer;
-
- /**
- * Takes in the test case and reporter to mediate between.
- * @param SimpleTestCase $test_case Test case to run.
- * @param SimpleScorer $scorer Reporter to receive events.
- */
- function SimpleRunner($test_case, $scorer) {
- $this->_test_case = $test_case;
- $this->_scorer = $scorer;
- }
-
- /**
- * Accessor for test case being run.
- * @return SimpleTestCase Test case.
- * @access public
- */
- function getTestCase() {
- return $this->_test_case;
- }
-
- /**
- * Runs the test methods in the test case.
- * @param SimpleTest $test_case Test case to run test on.
- * @param string $method Name of test method.
- * @access public
- */
- function run() {
- $methods = get_class_methods(get_class($this->_test_case));
- $invoker = $this->_test_case->createInvoker();
- foreach ($methods as $method) {
- if (! $this->_isTest($method)) {
- continue;
- }
- if ($this->_isConstructor($method)) {
- continue;
- }
- $this->_scorer->paintMethodStart($method);
- if ($this->_scorer->shouldInvoke($this->_test_case->getLabel(), $method)) {
- $invoker->invoke($method);
- }
- $this->_scorer->paintMethodEnd($method);
- }
- }
-
- /**
- * Tests to see if the method is the constructor and
- * so should be ignored.
- * @param string $method Method name to try.
- * @return boolean True if constructor.
- * @access protected
- */
- function _isConstructor($method) {
- return SimpleTestCompatibility::isA(
- $this->_test_case,
- strtolower($method));
- }
-
- /**
- * Tests to see if the method is a test that should
- * be run. Currently any method that starts with 'test'
- * is a candidate.
- * @param string $method Method name to try.
- * @return boolean True if test method.
- * @access protected
- */
- function _isTest($method) {
- return strtolower(substr($method, 0, 4)) == 'test';
- }
-
- /**
- * Paints the start of a test method.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintMethodStart($test_name) {
- $this->_scorer->paintMethodStart($test_name);
- }
-
- /**
- * Paints the end of a test method.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintMethodEnd($test_name) {
- $this->_scorer->paintMethodEnd($test_name);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Message is ignored.
- * @access public
- */
- function paintPass($message) {
- $this->_scorer->paintPass($message);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Message is ignored.
- * @access public
- */
- function paintFail($message) {
- $this->_scorer->paintFail($message);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Text of error formatted by
- * the test case.
- * @access public
- */
- function paintError($message) {
- $this->_scorer->paintError($message);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param Exception $exception Object thrown.
- * @access public
- */
- function paintException($exception) {
- $this->_scorer->paintException($exception);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Text to display.
- * @access public
- */
- function paintMessage($message) {
- $this->_scorer->paintMessage($message);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Text to display.
- * @access public
- */
- function paintFormattedMessage($message) {
- $this->_scorer->paintFormattedMessage($message);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $type Event type as text.
- * @param mixed $payload Message or object.
- * @return boolean Should return false if this
- * type of signal should fail the
- * test suite.
- * @access public
- */
- function paintSignal($type, $payload) {
- $this->_scorer->paintSignal($type, $payload);
- }
- }
diff --git a/tests/test_tools/simpletest/scorer.php b/tests/test_tools/simpletest/scorer.php
deleted file mode 100644
index 48b7162b..00000000
--- a/tests/test_tools/simpletest/scorer.php
+++ /dev/null
@@ -1,776 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: scorer.php 1532 2006-12-01 12:28:55Z xue $
- */
-
- /**#@+*/
- require_once(dirname(__FILE__) . '/invoker.php');
- /**#@-*/
-
- /**
- * Can recieve test events and display them. Display
- * is achieved by making display methods available
- * and visiting the incoming event.
- * @package SimpleTest
- * @subpackage UnitTester
- * @abstract
- */
- class SimpleScorer {
- protected $_passes;
- protected $_fails;
- protected $_exceptions;
- protected $_is_dry_run;
-
- /**
- * Starts the test run with no results.
- * @access public
- */
- function SimpleScorer() {
- $this->_passes = 0;
- $this->_fails = 0;
- $this->_exceptions = 0;
- $this->_is_dry_run = false;
- }
-
- /**
- * Signals that the next evaluation will be a dry
- * run. That is, the structure events will be
- * recorded, but no tests will be run.
- * @param boolean $is_dry Dry run if true.
- * @access public
- */
- function makeDry($is_dry = true) {
- $this->_is_dry_run = $is_dry;
- }
-
- /**
- * The reporter has a veto on what should be run.
- * @param string $test_case_name name of test case.
- * @param string $method Name of test method.
- * @access public
- */
- function shouldInvoke($test_case_name, $method) {
- return ! $this->_is_dry_run;
- }
-
- /**
- * Can wrap the invoker in preperation for running
- * a test.
- * @param SimpleInvoker $invoker Individual test runner.
- * @return SimpleInvoker Wrapped test runner.
- * @access public
- */
- function &createInvoker($invoker) {
- return $invoker;
- }
-
- /**
- * Accessor for current status. Will be false
- * if there have been any failures or exceptions.
- * Used for command line tools.
- * @return boolean True if no failures.
- * @access public
- */
- function getStatus() {
- if ($this->_exceptions + $this->_fails > 0) {
- return false;
- }
- return true;
- }
-
- /**
- * Paints the start of a group test.
- * @param string $test_name Name of test or other label.
- * @param integer $size Number of test cases starting.
- * @access public
- */
- function paintGroupStart($test_name, $size) {
- }
-
- /**
- * Paints the end of a group test.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintGroupEnd($test_name) {
- }
-
- /**
- * Paints the start of a test case.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintCaseStart($test_name) {
- }
-
- /**
- * Paints the end of a test case.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintCaseEnd($test_name) {
- }
-
- /**
- * Paints the start of a test method.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintMethodStart($test_name) {
- }
-
- /**
- * Paints the end of a test method.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintMethodEnd($test_name) {
- }
-
- /**
- * Increments the pass count.
- * @param string $message Message is ignored.
- * @access public
- */
- function paintPass($message) {
- $this->_passes++;
- }
-
- /**
- * Increments the fail count.
- * @param string $message Message is ignored.
- * @access public
- */
- function paintFail($message) {
- $this->_fails++;
- }
-
- /**
- * Deals with PHP 4 throwing an error or PHP 5
- * throwing an exception.
- * @param string $message Text of error formatted by
- * the test case.
- * @access public
- */
- function paintError($message) {
- $this->_exceptions++;
- }
-
- /**
- * Accessor for the number of passes so far.
- * @return integer Number of passes.
- * @access public
- */
- function getPassCount() {
- return $this->_passes;
- }
-
- /**
- * Accessor for the number of fails so far.
- * @return integer Number of fails.
- * @access public
- */
- function getFailCount() {
- return $this->_fails;
- }
-
- /**
- * Accessor for the number of untrapped errors
- * so far.
- * @return integer Number of exceptions.
- * @access public
- */
- function getExceptionCount() {
- return $this->_exceptions;
- }
-
- /**
- * Paints a simple supplementary message.
- * @param string $message Text to display.
- * @access public
- */
- function paintMessage($message) {
- }
-
- /**
- * Paints a formatted ASCII message such as a
- * variable dump.
- * @param string $message Text to display.
- * @access public
- */
- function paintFormattedMessage($message) {
- }
-
- /**
- * By default just ignores user generated events.
- * @param string $type Event type as text.
- * @param mixed $payload Message or object.
- * @access public
- */
- function paintSignal($type, $payload) {
- }
- }
-
- /**
- * Recipient of generated test messages that can display
- * page footers and headers. Also keeps track of the
- * test nesting. This is the main base class on which
- * to build the finished test (page based) displays.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleReporter extends SimpleScorer {
- protected $_test_stack;
- protected $_size;
- protected $_progress;
-
- /**
- * Starts the display with no results in.
- * @access public
- */
- function SimpleReporter() {
- $this->SimpleScorer();
- $this->_test_stack = array();
- $this->_size = null;
- $this->_progress = 0;
- }
-
- /**
- * Paints the start of a group test. Will also paint
- * the page header and footer if this is the
- * first test. Will stash the size if the first
- * start.
- * @param string $test_name Name of test that is starting.
- * @param integer $size Number of test cases starting.
- * @access public
- */
- function paintGroupStart($test_name, $size) {
- if (! isset($this->_size)) {
- $this->_size = $size;
- }
- if (count($this->_test_stack) == 0) {
- $this->paintHeader($test_name);
- }
- $this->_test_stack[] = $test_name;
- }
-
- /**
- * Paints the end of a group test. Will paint the page
- * footer if the stack of tests has unwound.
- * @param string $test_name Name of test that is ending.
- * @param integer $progress Number of test cases ending.
- * @access public
- */
- function paintGroupEnd($test_name) {
- array_pop($this->_test_stack);
- if (count($this->_test_stack) == 0) {
- $this->paintFooter($test_name);
- }
- }
-
- /**
- * Paints the start of a test case. Will also paint
- * the page header and footer if this is the
- * first test. Will stash the size if the first
- * start.
- * @param string $test_name Name of test that is starting.
- * @access public
- */
- function paintCaseStart($test_name) {
- if (! isset($this->_size)) {
- $this->_size = 1;
- }
- if (count($this->_test_stack) == 0) {
- $this->paintHeader($test_name);
- }
- $this->_test_stack[] = $test_name;
- }
-
- /**
- * Paints the end of a test case. Will paint the page
- * footer if the stack of tests has unwound.
- * @param string $test_name Name of test that is ending.
- * @access public
- */
- function paintCaseEnd($test_name) {
- $this->_progress++;
- array_pop($this->_test_stack);
- if (count($this->_test_stack) == 0) {
- $this->paintFooter($test_name);
- }
- }
-
- /**
- * Paints the start of a test method.
- * @param string $test_name Name of test that is starting.
- * @access public
- */
- function paintMethodStart($test_name) {
- $this->_test_stack[] = $test_name;
- }
-
- /**
- * Paints the end of a test method. Will paint the page
- * footer if the stack of tests has unwound.
- * @param string $test_name Name of test that is ending.
- * @access public
- */
- function paintMethodEnd($test_name) {
- array_pop($this->_test_stack);
- }
-
- /**
- * Paints the test document header.
- * @param string $test_name First test top level
- * to start.
- * @access public
- * @abstract
- */
- function paintHeader($test_name) {
- }
-
- /**
- * Paints the test document footer.
- * @param string $test_name The top level test.
- * @access public
- * @abstract
- */
- function paintFooter($test_name) {
- }
-
- /**
- * Accessor for internal test stack. For
- * subclasses that need to see the whole test
- * history for display purposes.
- * @return array List of methods in nesting order.
- * @access public
- */
- function getTestList() {
- return $this->_test_stack;
- }
-
- /**
- * Accessor for total test size in number
- * of test cases. Null until the first
- * test is started.
- * @return integer Total number of cases at start.
- * @access public
- */
- function getTestCaseCount() {
- return $this->_size;
- }
-
- /**
- * Accessor for the number of test cases
- * completed so far.
- * @return integer Number of ended cases.
- * @access public
- */
- function getTestCaseProgress() {
- return $this->_progress;
- }
-
- /**
- * Static check for running in the comand line.
- * @return boolean True if CLI.
- * @access public
- * @static
- */
- static function inCli() {
- return php_sapi_name() == 'cli';
- }
- }
-
- /**
- * For modifying the behaviour of the visual reporters.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleReporterDecorator {
- protected $_reporter;
-
- /**
- * Mediates between teh reporter and the test case.
- * @param SimpleScorer $reporter Reporter to receive events.
- */
- function SimpleReporterDecorator($reporter) {
- $this->_reporter = $reporter;
- }
-
- /**
- * Signals that the next evaluation will be a dry
- * run. That is, the structure events will be
- * recorded, but no tests will be run.
- * @param boolean $is_dry Dry run if true.
- * @access public
- */
- function makeDry($is_dry = true) {
- $this->_reporter->makeDry($is_dry);
- }
-
- /**
- * Accessor for current status. Will be false
- * if there have been any failures or exceptions.
- * Used for command line tools.
- * @return boolean True if no failures.
- * @access public
- */
- function getStatus() {
- return $this->_reporter->getStatus();
- }
-
- /**
- * The reporter has a veto on what should be run.
- * @param string $test_case_name name of test case.
- * @param string $method Name of test method.
- * @return boolean True if test should be run.
- * @access public
- */
- function shouldInvoke($test_case_name, $method) {
- return $this->_reporter->shouldInvoke($test_case_name, $method);
- }
-
- /**
- * Can wrap the invoker in preperation for running
- * a test.
- * @param SimpleInvoker $invoker Individual test runner.
- * @return SimpleInvoker Wrapped test runner.
- * @access public
- */
- function &createInvoker($invoker) {
- return $this->_reporter->createInvoker($invoker);
- }
-
- /**
- * Paints the start of a group test.
- * @param string $test_name Name of test or other label.
- * @param integer $size Number of test cases starting.
- * @access public
- */
- function paintGroupStart($test_name, $size) {
- $this->_reporter->paintGroupStart($test_name, $size);
- }
-
- /**
- * Paints the end of a group test.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintGroupEnd($test_name) {
- $this->_reporter->paintGroupEnd($test_name);
- }
-
- /**
- * Paints the start of a test case.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintCaseStart($test_name) {
- $this->_reporter->paintCaseStart($test_name);
- }
-
- /**
- * Paints the end of a test case.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintCaseEnd($test_name) {
- $this->_reporter->paintCaseEnd($test_name);
- }
-
- /**
- * Paints the start of a test method.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintMethodStart($test_name) {
- $this->_reporter->paintMethodStart($test_name);
- }
-
- /**
- * Paints the end of a test method.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintMethodEnd($test_name) {
- $this->_reporter->paintMethodEnd($test_name);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Message is ignored.
- * @access public
- */
- function paintPass($message) {
- $this->_reporter->paintPass($message);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Message is ignored.
- * @access public
- */
- function paintFail($message) {
- $this->_reporter->paintFail($message);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Text of error formatted by
- * the test case.
- * @access public
- */
- function paintError($message) {
- $this->_reporter->paintError($message);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Text to display.
- * @access public
- */
- function paintMessage($message) {
- $this->_reporter->paintMessage($message);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Text to display.
- * @access public
- */
- function paintFormattedMessage($message) {
- $this->_reporter->paintFormattedMessage($message);
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $type Event type as text.
- * @param mixed $payload Message or object.
- * @return boolean Should return false if this
- * type of signal should fail the
- * test suite.
- * @access public
- */
- function paintSignal($type, $payload) {
- $this->_reporter->paintSignal($type, $payload);
- }
- }
-
- /**
- * For sending messages to multiple reporters at
- * the same time.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class MultipleReporter {
- protected $_reporters = array();
-
- /**
- * Adds a reporter to the subscriber list.
- * @param SimpleScorer $reporter Reporter to receive events.
- * @access public
- */
- function attachReporter($reporter) {
- $this->_reporters[] = $reporter;
- }
-
- /**
- * Signals that the next evaluation will be a dry
- * run. That is, the structure events will be
- * recorded, but no tests will be run.
- * @param boolean $is_dry Dry run if true.
- * @access public
- */
- function makeDry($is_dry = true) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->makeDry($is_dry);
- }
- }
-
- /**
- * Accessor for current status. Will be false
- * if there have been any failures or exceptions.
- * If any reporter reports a failure, the whole
- * suite fails.
- * @return boolean True if no failures.
- * @access public
- */
- function getStatus() {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- if (! $this->_reporters[$i]->getStatus()) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * The reporter has a veto on what should be run.
- * It requires all reporters to want to run the method.
- * @param string $test_case_name name of test case.
- * @param string $method Name of test method.
- * @access public
- */
- function shouldInvoke($test_case_name, $method) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- if (! $this->_reporters[$i]->shouldInvoke($test_case_name, $method)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Every reporter gets a chance to wrap the invoker.
- * @param SimpleInvoker $invoker Individual test runner.
- * @return SimpleInvoker Wrapped test runner.
- * @access public
- */
- function &createInvoker($invoker) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $invoker = $this->_reporters[$i]->createInvoker($invoker);
- }
- return $invoker;
- }
-
- /**
- * Paints the start of a group test.
- * @param string $test_name Name of test or other label.
- * @param integer $size Number of test cases starting.
- * @access public
- */
- function paintGroupStart($test_name, $size) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintGroupStart($test_name, $size);
- }
- }
-
- /**
- * Paints the end of a group test.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintGroupEnd($test_name) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintGroupEnd($test_name);
- }
- }
-
- /**
- * Paints the start of a test case.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintCaseStart($test_name) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintCaseStart($test_name);
- }
- }
-
- /**
- * Paints the end of a test case.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintCaseEnd($test_name) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintCaseEnd($test_name);
- }
- }
-
- /**
- * Paints the start of a test method.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintMethodStart($test_name) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintMethodStart($test_name);
- }
- }
-
- /**
- * Paints the end of a test method.
- * @param string $test_name Name of test or other label.
- * @access public
- */
- function paintMethodEnd($test_name) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintMethodEnd($test_name);
- }
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Message is ignored.
- * @access public
- */
- function paintPass($message) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintPass($message);
- }
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Message is ignored.
- * @access public
- */
- function paintFail($message) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintFail($message);
- }
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Text of error formatted by
- * the test case.
- * @access public
- */
- function paintError($message) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintError($message);
- }
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Text to display.
- * @access public
- */
- function paintMessage($message) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintMessage($message);
- }
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $message Text to display.
- * @access public
- */
- function paintFormattedMessage($message) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintFormattedMessage($message);
- }
- }
-
- /**
- * Chains to the wrapped reporter.
- * @param string $type Event type as text.
- * @param mixed $payload Message or object.
- * @return boolean Should return false if this
- * type of signal should fail the
- * test suite.
- * @access public
- */
- function paintSignal($type, $payload) {
- for ($i = 0; $i < count($this->_reporters); $i++) {
- $this->_reporters[$i]->paintSignal($type, $payload);
- }
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/selector.php b/tests/test_tools/simpletest/selector.php
deleted file mode 100644
index 6af21ff6..00000000
--- a/tests/test_tools/simpletest/selector.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest.
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: selector.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include SimpleTest files
- */
- require_once(dirname(__FILE__) . '/tag.php');
- require_once(dirname(__FILE__) . '/encoding.php');
- /**#@-*/
-
- /**
- * Used to extract form elements for testing against.
- * Searches by name attribute.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleByName {
- protected $_name;
-
- /**
- * Stashes the name for later comparison.
- * @param string $name Name attribute to match.
- */
- function SimpleByName($name) {
- $this->_name = $name;
- }
-
- /**
- * Compares with name attribute of widget.
- * @param SimpleWidget $widget Control to compare.
- * @access public
- */
- function isMatch($widget) {
- return ($widget->getName() == $this->_name);
- }
- }
-
- /**
- * Used to extract form elements for testing against.
- * Searches by visible label or alt text.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleByLabel {
- protected $_label;
-
- /**
- * Stashes the name for later comparison.
- * @param string $label Visible text to match.
- */
- function SimpleByLabel($label) {
- $this->_label = $label;
- }
-
- /**
- * Comparison. Compares visible text of widget or
- * related label.
- * @param SimpleWidget $widget Control to compare.
- * @access public
- */
- function isMatch($widget) {
- if (! method_exists($widget, 'isLabel')) {
- return false;
- }
- return $widget->isLabel($this->_label);
- }
- }
-
- /**
- * Used to extract form elements for testing against.
- * Searches dy id attribute.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleById {
- protected $_id;
-
- /**
- * Stashes the name for later comparison.
- * @param string $id ID atribute to match.
- */
- function SimpleById($id) {
- $this->_id = $id;
- }
-
- /**
- * Comparison. Compares id attribute of widget.
- * @param SimpleWidget $widget Control to compare.
- * @access public
- */
- function isMatch($widget) {
- return $widget->isId($this->_id);
- }
- }
-
- /**
- * Used to extract form elements for testing against.
- * Searches by visible label, name or alt text.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleByLabelOrName {
- protected $_label;
-
- /**
- * Stashes the name/label for later comparison.
- * @param string $label Visible text to match.
- */
- function SimpleByLabelOrName($label) {
- $this->_label = $label;
- }
-
- /**
- * Comparison. Compares visible text of widget or
- * related label or name.
- * @param SimpleWidget $widget Control to compare.
- * @access public
- */
- function isMatch($widget) {
- if (method_exists($widget, 'isLabel')) {
- if ($widget->isLabel($this->_label)) {
- return true;
- }
- }
- return ($widget->getName() == $this->_label);
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/shell_tester.php b/tests/test_tools/simpletest/shell_tester.php
deleted file mode 100644
index 5ac6013d..00000000
--- a/tests/test_tools/simpletest/shell_tester.php
+++ /dev/null
@@ -1,305 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: shell_tester.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/test_case.php');
- /**#@-*/
-
- /**
- * Wrapper for exec() functionality.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleShell {
- protected $_output;
-
- /**
- * Executes the shell comand and stashes the output.
- * @access public
- */
- function SimpleShell() {
- $this->_output = false;
- }
-
- /**
- * Actually runs the command. Does not trap the
- * error stream output as this need PHP 4.3+.
- * @param string $command The actual command line
- * to run.
- * @return integer Exit code.
- * @access public
- */
- function execute($command) {
- $this->_output = false;
- exec($command, $this->_output, $ret);
- return $ret;
- }
-
- /**
- * Accessor for the last output.
- * @return string Output as text.
- * @access public
- */
- function getOutput() {
- return implode("\n", $this->_output);
- }
-
- /**
- * Accessor for the last output.
- * @return array Output as array of lines.
- * @access public
- */
- function getOutputAsList() {
- return $this->_output;
- }
- }
-
- /**
- * Test case for testing of command line scripts and
- * utilities. Usually scripts taht are external to the
- * PHP code, but support it in some way.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class ShellTestCase extends SimpleTestCase {
- protected $_current_shell;
- protected $_last_status;
- protected $_last_command;
-
- /**
- * Creates an empty test case. Should be subclassed
- * with test methods for a functional test case.
- * @param string $label Name of test case. Will use
- * the class name if none specified.
- * @access public
- */
- function ShellTestCase($label = false) {
- $this->SimpleTestCase($label);
- $this->_current_shell = $this->_createShell();
- $this->_last_status = false;
- $this->_last_command = '';
- }
-
- /**
- * Executes a command and buffers the results.
- * @param string $command Command to run.
- * @return boolean True if zero exit code.
- * @access public
- */
- function execute($command) {
- $shell = $this->_getShell();
- $this->_last_status = $shell->execute($command);
- $this->_last_command = $command;
- return ($this->_last_status === 0);
- }
-
- /**
- * Dumps the output of the last command.
- * @access public
- */
- function dumpOutput() {
- $this->dump($this->getOutput());
- }
-
- /**
- * Accessor for the last output.
- * @return string Output as text.
- * @access public
- */
- function getOutput() {
- $shell = $this->_getShell();
- return $shell->getOutput();
- }
-
- /**
- * Accessor for the last output.
- * @return array Output as array of lines.
- * @access public
- */
- function getOutputAsList() {
- $shell = $this->_getShell();
- return $shell->getOutputAsList();
- }
-
- /**
- * Will trigger a pass if the two parameters have
- * the same value only. Otherwise a fail. This
- * is for testing hand extracted text, etc.
- * @param mixed $first Value to compare.
- * @param mixed $second Value to compare.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertEqual($first, $second, $message = "%s") {
- return $this->assert(
- new EqualExpectation($first),
- $second,
- $message);
- }
-
- /**
- * Will trigger a pass if the two parameters have
- * a different value. Otherwise a fail. This
- * is for testing hand extracted text, etc.
- * @param mixed $first Value to compare.
- * @param mixed $second Value to compare.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertNotEqual($first, $second, $message = "%s") {
- return $this->assert(
- new NotEqualExpectation($first),
- $second,
- $message);
- }
-
- /**
- * Tests the last status code from the shell.
- * @param integer $status Expected status of last
- * command.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertExitCode($status, $message = "%s") {
- $message = sprintf($message, "Expected status code of [$status] from [" .
- $this->_last_command . "], but got [" .
- $this->_last_status . "]");
- return $this->assertTrue($status === $this->_last_status, $message);
- }
-
- /**
- * Attempt to exactly match the combined STDERR and
- * STDOUT output.
- * @param string $expected Expected output.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertOutput($expected, $message = "%s") {
- $shell = $this->_getShell();
- return $this->assert(
- new EqualExpectation($expected),
- $shell->getOutput(),
- $message);
- }
-
- /**
- * Scans the output for a Perl regex. If found
- * anywhere it passes, else it fails.
- * @param string $pattern Regex to search for.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertOutputPattern($pattern, $message = "%s") {
- $shell = $this->_getShell();
- return $this->assert(
- new PatternExpectation($pattern),
- $shell->getOutput(),
- $message);
- }
-
- /**
- * If a Perl regex is found anywhere in the current
- * output then a failure is generated, else a pass.
- * @param string $pattern Regex to search for.
- * @param $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertNoOutputPattern($pattern, $message = "%s") {
- $shell = $this->_getShell();
- return $this->assert(
- new NoPatternExpectation($pattern),
- $shell->getOutput(),
- $message);
- }
-
- /**
- * File existence check.
- * @param string $path Full filename and path.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertFileExists($path, $message = "%s") {
- $message = sprintf($message, "File [$path] should exist");
- return $this->assertTrue(file_exists($path), $message);
- }
-
- /**
- * File non-existence check.
- * @param string $path Full filename and path.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertFileNotExists($path, $message = "%s") {
- $message = sprintf($message, "File [$path] should not exist");
- return $this->assertFalse(file_exists($path), $message);
- }
-
- /**
- * Scans a file for a Perl regex. If found
- * anywhere it passes, else it fails.
- * @param string $pattern Regex to search for.
- * @param string $path Full filename and path.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertFilePattern($pattern, $path, $message = "%s") {
- $shell = $this->_getShell();
- return $this->assert(
- new PatternExpectation($pattern),
- implode('', file($path)),
- $message);
- }
-
- /**
- * If a Perl regex is found anywhere in the named
- * file then a failure is generated, else a pass.
- * @param string $pattern Regex to search for.
- * @param string $path Full filename and path.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertNoFilePattern($pattern, $path, $message = "%s") {
- $shell = $this->_getShell();
- return $this->assert(
- new NoPatternExpectation($pattern),
- implode('', file($path)),
- $message);
- }
-
- /**
- * Accessor for current shell. Used for testing the
- * the tester itself.
- * @return Shell Current shell.
- * @access protected
- */
- function &_getShell() {
- return $this->_current_shell;
- }
-
- /**
- * Factory for the shell to run the command on.
- * @return Shell New shell object.
- * @access protected
- */
- function &_createShell() {
- $shell = new SimpleShell();
- return $shell;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/simple_test.php b/tests/test_tools/simpletest/simple_test.php
deleted file mode 100644
index cc39a08b..00000000
--- a/tests/test_tools/simpletest/simple_test.php
+++ /dev/null
@@ -1,552 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: simple_test.php 1532 2006-12-01 12:28:55Z xue $
- */
-
- /**#@+
- * Includes SimpleTest files and defined the root constant
- * for dependent libraries.
- */
- require_once(dirname(__FILE__) . '/errors.php');
- require_once(dirname(__FILE__) . '/options.php');
- require_once(dirname(__FILE__) . '/runner.php');
- require_once(dirname(__FILE__) . '/scorer.php');
- require_once(dirname(__FILE__) . '/expectation.php');
- require_once(dirname(__FILE__) . '/dumper.php');
- if (! defined('SIMPLE_TEST')) {
- define('SIMPLE_TEST', dirname(__FILE__) . '/');
- }
- /**#@-*/
-
- /**
- * Basic test case. This is the smallest unit of a test
- * suite. It searches for
- * all methods that start with the the string "test" and
- * runs them. Working test cases extend this class.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleTestCase {
- protected $_label;
- protected $_runner;
-
- /**
- * Sets up the test with no display.
- * @param string $label If no test name is given then
- * the class name is used.
- * @access public
- */
- function SimpleTestCase($label = false) {
- $this->_label = $label ? $label : get_class($this);
- $this->_runner = false;
- }
-
- /**
- * Accessor for the test name for subclasses.
- * @return string Name of the test.
- * @access public
- */
- function getLabel() {
- return $this->_label;
- }
-
- /**
- * Used to invoke the single tests.
- * @return SimpleInvoker Individual test runner.
- * @access public
- */
- function createInvoker() {
- return new SimpleErrorTrappingInvoker(new SimpleInvoker($this));
- }
-
- /**
- * Can modify the incoming reporter so as to run
- * the tests differently. This version simply
- * passes it straight through.
- * @param SimpleReporter $reporter Incoming observer.
- * @return SimpleReporter
- * @access protected
- */
- function _createRunner($reporter) {
- return new SimpleRunner($this, $reporter);
- }
-
- /**
- * Uses reflection to run every method within itself
- * starting with the string "test" unless a method
- * is specified.
- * @param SimpleReporter $reporter Current test reporter.
- * @access public
- */
- function run($reporter) {
- $reporter->paintCaseStart($this->getLabel());
- $this->_runner = $this->_createRunner($reporter);
- $this->_runner->run();
- $reporter->paintCaseEnd($this->getLabel());
- return $reporter->getStatus();
- }
-
- /**
- * Sets up unit test wide variables at the start
- * of each test method. To be overridden in
- * actual user test cases.
- * @access public
- */
- function setUp() {
- }
-
- /**
- * Clears the data set in the setUp() method call.
- * To be overridden by the user in actual user test cases.
- * @access public
- */
- function tearDown() {
- }
-
- /**
- * Sends a pass event with a message.
- * @param string $message Message to send.
- * @access public
- */
- function pass($message = "Pass") {
- $this->_runner->paintPass($message . $this->getAssertionLine(' at line [%d]'));
- }
-
- /**
- * Sends a fail event with a message.
- * @param string $message Message to send.
- * @access public
- */
- function fail($message = "Fail") {
- $this->_runner->paintFail($message . $this->getAssertionLine(' at line [%d]'));
- }
-
- /**
- * Formats a PHP error and dispatches it to the
- * runner.
- * @param integer $severity PHP error code.
- * @param string $message Text of error.
- * @param string $file File error occoured in.
- * @param integer $line Line number of error.
- * @param hash $globals PHP super global arrays.
- * @access public
- */
- function error($severity, $message, $file, $line, $globals) {
- $severity = SimpleErrorQueue::getSeverityAsString($severity);
- $this->_runner->paintError(
- "Unexpected PHP error [$message] severity [$severity] in [$file] line [$line]");
- }
-
- /**
- * Sends a user defined event to the test runner.
- * This is for small scale extension where
- * both the test case and either the runner or
- * display are subclassed.
- * @param string $type Type of event.
- * @param mixed $payload Object or message to deliver.
- * @access public
- */
- function signal($type, $payload) {
- $this->_runner->paintSignal($type, $payload);
- }
-
- /**
- * Cancels any outstanding errors.
- * @access public
- */
- function swallowErrors() {
- $queue = SimpleErrorQueue::instance();
- $queue->clear();
- }
-
- /**
- * Runs an expectation directly, for extending the
- * tests with new expectation classes.
- * @param SimpleExpectation $expectation Expectation subclass.
- * @param mixed $test_value Value to compare.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertExpectation($expectation, $test_value, $message = '%s') {
- return $this->assertTrue(
- $expectation->test($test_value),
- sprintf($message, $expectation->overlayMessage($test_value)));
- }
-
- /**
- * Called from within the test methods to register
- * passes and failures.
- * @param boolean $result Pass on true.
- * @param string $message Message to display describing
- * the test state.
- * @return boolean True on pass
- * @access public
- */
- function assertTrue($result, $message = false) {
- if (! $message) {
- $message = 'True assertion got ' . ($result ? 'True' : 'False');
- }
- if ($result) {
- $this->pass($message);
- return true;
- } else {
- $this->fail($message);
- return false;
- }
- }
-
- /**
- * Will be true on false and vice versa. False
- * is the PHP definition of false, so that null,
- * empty strings, zero and an empty array all count
- * as false.
- * @param boolean $result Pass on false.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertFalse($result, $message = false) {
- if (! $message) {
- $message = 'False assertion got ' . ($result ? 'True' : 'False');
- }
- return $this->assertTrue(! $result, $message);
- }
-
- /**
- * Uses a stack trace to find the line of an assertion.
- * @param string $format String formatting.
- * @param array $stack Stack frames top most first. Only
- * needed if not using the PHP
- * backtrace function.
- * @return string Line number of first assert*
- * method embedded in format string.
- * @access public
- */
- function getAssertionLine($format = '%d', $stack = false) {
- if ($stack === false) {
- $stack = SimpleTestCompatibility::getStackTrace();
- }
- return SimpleDumper::getFormattedAssertionLine($stack, $format);
- }
-
- /**
- * Sends a formatted dump of a variable to the
- * test suite for those emergency debugging
- * situations.
- * @param mixed $variable Variable to display.
- * @param string $message Message to display.
- * @return mixed The original variable.
- * @access public
- */
- function dump($variable, $message = false) {
- $formatted = SimpleDumper::dump($variable);
- if ($message) {
- $formatted = $message . "\n" . $formatted;
- }
- $this->_runner->paintFormattedMessage($formatted);
- return $variable;
- }
-
- /**
- * Dispatches a text message straight to the
- * test suite. Useful for status bar displays.
- * @param string $message Message to show.
- * @access public
- */
- function sendMessage($message) {
- $this->_runner->PaintMessage($message);
- }
-
- /**
- * Accessor for the number of subtests.
- * @return integer Number of test cases.
- * @access public
- * @static
- */
- static function getSize() {
- return 1;
- }
- }
-
- /**
- * This is a composite test class for combining
- * test cases and other RunnableTest classes into
- * a group test.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class GroupTest {
- protected $_label;
- protected $_test_cases;
- protected $_old_track_errors;
- protected $_xdebug_is_enabled;
-
- /**
- * Sets the name of the test suite.
- * @param string $label Name sent at the start and end
- * of the test.
- * @access public
- */
- function GroupTest($label) {
- $this->_label = $label;
- $this->_test_cases = array();
- $this->_old_track_errors = ini_get('track_errors');
- $this->_xdebug_is_enabled = function_exists('xdebug_is_enabled') ?
- xdebug_is_enabled() : false;
- }
-
- /**
- * Accessor for the test name for subclasses.
- * @return string Name of the test.
- * @access public
- */
- function getLabel() {
- return $this->_label;
- }
-
- /**
- * Adds a test into the suite. Can be either a group
- * test or some other unit test.
- * @param SimpleTestCase $test_case Suite or individual test
- * case implementing the
- * runnable test interface.
- * @access public
- */
- function addTestCase($test_case) {
- $this->_test_cases[] = $test_case;
- }
-
- /**
- * Adds a test into the suite by class name. The class will
- * be instantiated as needed.
- * @param SimpleTestCase $test_case Suite or individual test
- * case implementing the
- * runnable test interface.
- * @access public
- */
- function addTestClass($class) {
- $this->_test_cases[] = $class;
- }
-
- /**
- * Builds a group test from a library of test cases.
- * The new group is composed into this one.
- * @param string $test_file File name of library with
- * test case classes.
- * @access public
- */
- function addTestFile($test_file) {
- $existing_classes = get_declared_classes();
- if ($error = $this->_requireWithError($test_file)) {
- $this->addTestCase(new BadGroupTest($test_file, $error));
- return;
- }
- $classes = $this->_selectRunnableTests($existing_classes, get_declared_classes());
- if (count($classes) == 0) {
- $this->addTestCase(new BadGroupTest($test_file, 'No new test cases'));
- return;
- }
- $this->addTestCase($this->_createGroupFromClasses($test_file, $classes));
- }
-
- /**
- * Requires a source file recording any syntax errors.
- * @param string $file File name to require in.
- * @return string/boolean An error message on failure or false
- * if no errors.
- * @access private
- */
- function _requireWithError($file) {
- $this->_enableErrorReporting();
- include($file);
- $error = isset($php_errormsg) ? $php_errormsg : false;
- $this->_disableErrorReporting();
- $self_inflicted = array(
- 'Assigning the return value of new by reference is deprecated',
- 'var: Deprecated. Please use the public/private/protected modifiers');
- if (in_array($error, $self_inflicted)) {
- return false;
- }
- return $error;
- }
-
- /**
- * Sets up detection of parse errors. Note that XDebug
- * interferes with this and has to be disabled. This is
- * to make sure the correct error code is returned
- * from unattended scripts.
- * @access private
- */
- function _enableErrorReporting() {
- if ($this->_xdebug_is_enabled) {
- xdebug_disable();
- }
- ini_set('track_errors', true);
- }
-
- /**
- * Resets detection of parse errors to their old values.
- * This is to make sure the correct error code is returned
- * from unattended scripts.
- * @access private
- */
- function _disableErrorReporting() {
- ini_set('track_errors', $this->_old_track_errors);
- if ($this->_xdebug_is_enabled) {
- xdebug_enable();
- }
- }
-
- /**
- * Calculates the incoming test cases from a before
- * and after list of loaded classes.
- * @param array $existing_classes Classes before require().
- * @param array $new_classes Classes after require().
- * @return array New classes which are test
- * cases that shouldn't be ignored.
- * @access private
- */
- function _selectRunnableTests($existing_classes, $new_classes) {
- $classes = array();
- foreach ($new_classes as $class) {
- if (in_array($class, $existing_classes)) {
- continue;
- }
- if (! $this->_isTestCase($class)) {
- continue;
- }
- $classes[] = $class;
- }
- return $classes;
- }
-
- /**
- * Builds a group test from a class list.
- * @param string $title Title of new group.
- * @param array $classes Test classes.
- * @return GroupTest Group loaded with the new
- * test cases.
- * @access private
- */
- function _createGroupFromClasses($title, $classes) {
- $group = new GroupTest($title);
- foreach ($classes as $class) {
- if (SimpleTestOptions::isIgnored($class)) {
- continue;
- }
- $group->addTestClass($class);
- }
- return $group;
- }
-
- /**
- * Test to see if a class is derived from the
- * TestCase class.
- * @param string $class Class name.
- * @access private
- */
- function _isTestCase($class) {
- while ($class = get_parent_class($class)) {
- $class = strtolower($class);
- if ($class == "simpletestcase" || $class == "grouptest") {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Invokes run() on all of the held test cases, instantiating
- * them if necessary.
- * @param SimpleReporter $reporter Current test reporter.
- * @access public
- */
- function run($reporter) {
- $reporter->paintGroupStart($this->getLabel(), $this->getSize());
- for ($i = 0, $count = count($this->_test_cases); $i < $count; $i++) {
- if (is_string($this->_test_cases[$i])) {
- $class = $this->_test_cases[$i];
- $test = new $class();
- $test->run($reporter);
- } else {
- $this->_test_cases[$i]->run($reporter);
- }
- }
- $reporter->paintGroupEnd($this->getLabel());
- return $reporter->getStatus();
- }
-
- /**
- * Number of contained test cases.
- * @return integer Total count of cases in the group.
- * @access public
- */
- function getSize() {
- $count = 0;
- foreach ($this->_test_cases as $case) {
- if (is_string($case)) {
- $count++;
- } else {
- $count += $case->getSize();
- }
- }
- return $count;
- }
- }
-
- /**
- * This is a failing group test for when a test suite hasn't
- * loaded properly.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class BadGroupTest {
- protected $_label;
- protected $_error;
-
- /**
- * Sets the name of the test suite and error message.
- * @param string $label Name sent at the start and end
- * of the test.
- * @access public
- */
- function BadGroupTest($label, $error) {
- $this->_label = $label;
- $this->_error = $error;
- }
-
- /**
- * Accessor for the test name for subclasses.
- * @return string Name of the test.
- * @access public
- */
- function getLabel() {
- return $this->_label;
- }
-
- /**
- * Sends a single error to the reporter.
- * @param SimpleReporter $reporter Current test reporter.
- * @access public
- */
- function run($reporter) {
- $reporter->paintGroupStart($this->getLabel(), $this->getSize());
- $reporter->paintFail('Bad GroupTest [' . $this->getLabel() .
- '] with error [' . $this->_error . ']');
- $reporter->paintGroupEnd($this->getLabel());
- return $reporter->getStatus();
- }
-
- /**
- * Number of contained test cases. Always zero.
- * @return integer Total count of cases in the group.
- * @access public
- */
- function getSize() {
- return 0;
- }
- }
diff --git a/tests/test_tools/simpletest/simpletest.php b/tests/test_tools/simpletest/simpletest.php
deleted file mode 100644
index df1536ac..00000000
--- a/tests/test_tools/simpletest/simpletest.php
+++ /dev/null
@@ -1,281 +0,0 @@
-<?php
- /**
- * Global state for SimpleTest and kicker script in future versions.
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: simpletest.php 1532 2006-12-01 12:28:55Z xue $
- */
-
- /**#@+
- * include SimpleTest files
- */
- if (version_compare(phpversion(), '5') >= 0) {
- require_once(dirname(__FILE__) . '/reflection_php5.php');
- } else {
- require_once(dirname(__FILE__) . '/reflection_php4.php');
- }
- /**#@-*/
-
- /**
- * Static global directives and options. I hate this
- * class. It's a mixture of reference hacks, configuration
- * and previous design screw-ups that I have to maintain
- * to keep backward compatibility.
- * @package SimpleTest
- */
- class SimpleTest {
-
- /**
- * Reads the SimpleTest version from the release file.
- * @return string Version string.
- * @static
- * @access public
- */
- static function getVersion() {
- $content = file(dirname(__FILE__) . '/VERSION');
- return trim($content[0]);
- }
-
- /**
- * Sets the name of a test case to ignore, usually
- * because the class is an abstract case that should
- * not be run. Once PHP4 is dropped this will disappear
- * as a public method and "abstract" will rule.
- * @param string $class Add a class to ignore.
- * @static
- * @access public
- */
- static function ignore($class) {
- $registry = &SimpleTest::_getRegistry();
- $registry['IgnoreList'][strtolower($class)] = true;
- }
-
- /**
- * Scans the now complete ignore list, and adds
- * all parent classes to the list. If a class
- * is not a runnable test case, then it's parents
- * wouldn't be either. This is syntactic sugar
- * to cut down on ommissions of ignore()'s or
- * missing abstract declarations. This cannot
- * be done whilst loading classes wiithout forcing
- * a particular order on the class declarations and
- * the ignore() calls. It's nice to havethe ignore()
- * calls at the top of teh file.
- * @param array $classes Class names of interest.
- * @static
- * @access public
- */
- static function ignoreParentsIfIgnored($classes) {
- $registry = &SimpleTest::_getRegistry();
- foreach ($classes as $class) {
- if (SimpleTest::isIgnored($class)) {
- $reflection = new SimpleReflection($class);
- if ($parent = $reflection->getParent()) {
- SimpleTest::ignore($parent);
- }
- }
- }
- }
-
- /**
- * Test to see if a test case is in the ignore
- * list. Quite obviously the ignore list should
- * be a separate object and will be one day.
- * This method is internal to SimpleTest. Don't
- * use it.
- * @param string $class Class name to test.
- * @return boolean True if should not be run.
- * @access public
- * @static
- */
- static function isIgnored($class) {
- $registry = &SimpleTest::_getRegistry();
- return isset($registry['IgnoreList'][strtolower($class)]);
- }
-
- /**
- * @deprecated
- */
- function setMockBaseClass($mock_base) {
- $registry = &SimpleTest::_getRegistry();
- $registry['MockBaseClass'] = $mock_base;
- }
-
- /**
- * @deprecated
- */
- function getMockBaseClass() {
- $registry = &SimpleTest::_getRegistry();
- return $registry['MockBaseClass'];
- }
-
- /**
- * Sets proxy to use on all requests for when
- * testing from behind a firewall. Set host
- * to false to disable. This will take effect
- * if there are no other proxy settings.
- * @param string $proxy Proxy host as URL.
- * @param string $username Proxy username for authentication.
- * @param string $password Proxy password for authentication.
- * @access public
- */
- function useProxy($proxy, $username = false, $password = false) {
- $registry = &SimpleTest::_getRegistry();
- $registry['DefaultProxy'] = $proxy;
- $registry['DefaultProxyUsername'] = $username;
- $registry['DefaultProxyPassword'] = $password;
- }
-
- /**
- * Accessor for default proxy host.
- * @return string Proxy URL.
- * @access public
- */
- function getDefaultProxy() {
- $registry = &SimpleTest::_getRegistry();
- return $registry['DefaultProxy'];
- }
-
- /**
- * Accessor for default proxy username.
- * @return string Proxy username for authentication.
- * @access public
- */
- function getDefaultProxyUsername() {
- $registry = &SimpleTest::_getRegistry();
- return $registry['DefaultProxyUsername'];
- }
-
- /**
- * Accessor for default proxy password.
- * @return string Proxy password for authentication.
- * @access public
- */
- function getDefaultProxyPassword() {
- $registry = &SimpleTest::_getRegistry();
- return $registry['DefaultProxyPassword'];
- }
-
- /**
- * Sets the current test case instance. This
- * global instance can be used by the mock objects
- * to send message to the test cases.
- * @param SimpleTestCase $test Test case to register.
- * @access public
- * @static
- */
- static function setCurrent($test) {
- $registry = &SimpleTest::_getRegistry();
- $registry['CurrentTestCase'] = $test;
- }
-
- /**
- * Accessor for current test instance.
- * @return SimpleTEstCase Currently running test.
- * @access public
- * @static
- */
- static function &getCurrent() {
- $registry = &SimpleTest::_getRegistry();
- return $registry['CurrentTestCase'];
- }
-
- /**
- * Accessor for global registry of options.
- * @return hash All stored values.
- * @access private
- * @static
- */
- static function &_getRegistry() {
- static $registry = false;
- if (! $registry) {
- $registry = SimpleTest::_getDefaults();
- }
- return $registry;
- }
-
- /**
- * Constant default values.
- * @return hash All registry defaults.
- * @access private
- * @static
- */
- static function _getDefaults() {
- return array(
- 'StubBaseClass' => 'SimpleStub',
- 'MockBaseClass' => 'SimpleMock',
- 'IgnoreList' => array(),
- 'DefaultProxy' => false,
- 'DefaultProxyUsername' => false,
- 'DefaultProxyPassword' => false);
- }
- }
-
- /**
- * @deprecated
- */
- class SimpleTestOptions extends SimpleTest {
-
- /**
- * @deprecated
- */
- static function getVersion() {
- return Simpletest::getVersion();
- }
-
- /**
- * @deprecated
- */
- static function ignore($class) {
- return Simpletest::ignore($class);
- }
-
- /**
- * @deprecated
- */
- static function isIgnored($class) {
- return Simpletest::isIgnored($class);
- }
-
- /**
- * @deprecated
- */
- function setMockBaseClass($mock_base) {
- return Simpletest::setMockBaseClass($mock_base);
- }
-
- /**
- * @deprecated
- */
- function getMockBaseClass() {
- return Simpletest::getMockBaseClass();
- }
-
- /**
- * @deprecated
- */
- function useProxy($proxy, $username = false, $password = false) {
- return Simpletest::useProxy($proxy, $username, $password);
- }
-
- /**
- * @deprecated
- */
- function getDefaultProxy() {
- return Simpletest::getDefaultProxy();
- }
-
- /**
- * @deprecated
- */
- function getDefaultProxyUsername() {
- return Simpletest::getDefaultProxyUsername();
- }
-
- /**
- * @deprecated
- */
- function getDefaultProxyPassword() {
- return Simpletest::getDefaultProxyPassword();
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/socket.php b/tests/test_tools/simpletest/socket.php
deleted file mode 100644
index cfeed48a..00000000
--- a/tests/test_tools/simpletest/socket.php
+++ /dev/null
@@ -1,215 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage MockObjects
- * @version $Id: socket.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include SimpleTest files
- */
- require_once(dirname(__FILE__) . '/compatibility.php');
- /**#@-*/
-
- /**
- * Stashes an error for later. Useful for constructors
- * until PHP gets exceptions.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleStickyError {
- protected $_error = 'Constructor not chained';
-
- /**
- * Sets the error to empty.
- * @access public
- */
- function SimpleStickyError() {
- $this->_clearError();
- }
-
- /**
- * Test for an outstanding error.
- * @return boolean True if there is an error.
- * @access public
- */
- function isError() {
- return ($this->_error != '');
- }
-
- /**
- * Accessor for an outstanding error.
- * @return string Empty string if no error otherwise
- * the error message.
- * @access public
- */
- function getError() {
- return $this->_error;
- }
-
- /**
- * Sets the internal error.
- * @param string Error message to stash.
- * @access protected
- */
- function _setError($error) {
- $this->_error = $error;
- }
-
- /**
- * Resets the error state to no error.
- * @access protected
- */
- function _clearError() {
- $this->_setError('');
- }
- }
-
- /**
- * Wrapper for TCP/IP socket.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleSocket extends SimpleStickyError {
- protected $_handle;
- protected $_is_open = false;
- protected $_sent = '';
- public $lock_size;
-
- /**
- * Opens a socket for reading and writing.
- * @param string $host Hostname to send request to.
- * @param integer $port Port on remote machine to open.
- * @param integer $timeout Connection timeout in seconds.
- * @param integer $block_size Size of chunk to read.
- * @access public
- */
- function SimpleSocket($host, $port, $timeout, $block_size = 255) {
- $this->SimpleStickyError();
- if (! ($this->_handle = $this->_openSocket($host, $port, $error_number, $error, $timeout))) {
- $this->_setError("Cannot open [$host:$port] with [$error] within [$timeout] seconds");
- return;
- }
- $this->_is_open = true;
- $this->_block_size = $block_size;
- SimpleTestCompatibility::setTimeout($this->_handle, $timeout);
- }
-
- /**
- * Writes some data to the socket and saves alocal copy.
- * @param string $message String to send to socket.
- * @return boolean True if successful.
- * @access public
- */
- function write($message) {
- if ($this->isError() || ! $this->isOpen()) {
- return false;
- }
- $count = fwrite($this->_handle, $message);
- if (! $count) {
- if ($count === false) {
- $this->_setError('Cannot write to socket');
- $this->close();
- }
- return false;
- }
- fflush($this->_handle);
- $this->_sent .= $message;
- return true;
- }
-
- /**
- * Reads data from the socket. The error suppresion
- * is a workaround for PHP4 always throwing a warning
- * with a secure socket.
- * @return integer/boolean Incoming bytes. False
- * on error.
- * @access public
- */
- function read() {
- if ($this->isError() || ! $this->isOpen()) {
- return false;
- }
- $raw = @fread($this->_handle, $this->_block_size);
- if ($raw === false) {
- $this->_setError('Cannot read from socket');
- $this->close();
- }
- return $raw;
- }
-
- /**
- * Accessor for socket open state.
- * @return boolean True if open.
- * @access public
- */
- function isOpen() {
- return $this->_is_open;
- }
-
- /**
- * Closes the socket preventing further reads.
- * Cannot be reopened once closed.
- * @return boolean True if successful.
- * @access public
- */
- function close() {
- $this->_is_open = false;
- return fclose($this->_handle);
- }
-
- /**
- * Accessor for content so far.
- * @return string Bytes sent only.
- * @access public
- */
- function getSent() {
- return $this->_sent;
- }
-
- /**
- * Actually opens the low level socket.
- * @param string $host Host to connect to.
- * @param integer $port Port on host.
- * @param integer $error_number Recipient of error code.
- * @param string $error Recipoent of error message.
- * @param integer $timeout Maximum time to wait for connection.
- * @access protected
- */
- function _openSocket($host, $port, $error_number, $error, $timeout) {
- return @fsockopen($host, $port, $error_number, $error, $timeout);
- }
- }
-
- /**
- * Wrapper for TCP/IP socket over TLS.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleSecureSocket extends SimpleSocket {
-
- /**
- * Opens a secure socket for reading and writing.
- * @param string $host Hostname to send request to.
- * @param integer $port Port on remote machine to open.
- * @param integer $timeout Connection timeout in seconds.
- * @access public
- */
- function SimpleSecureSocket($host, $port, $timeout) {
- $this->SimpleSocket($host, $port, $timeout);
- }
-
- /**
- * Actually opens the low level socket.
- * @param string $host Host to connect to.
- * @param integer $port Port on host.
- * @param integer $error_number Recipient of error code.
- * @param string $error Recipient of error message.
- * @param integer $timeout Maximum time to wait for connection.
- * @access protected
- */
- function _openSocket($host, $port, $error_number, $error, $timeout) {
- return parent::_openSocket("tls://$host", $port, $error_number, $error, $timeout);
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/tag.php b/tests/test_tools/simpletest/tag.php
deleted file mode 100644
index 46fb740a..00000000
--- a/tests/test_tools/simpletest/tag.php
+++ /dev/null
@@ -1,1391 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest.
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: tag.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include SimpleTest files
- */
- require_once(dirname(__FILE__) . '/parser.php');
- require_once(dirname(__FILE__) . '/encoding.php');
- /**#@-*/
-
- /**
- * HTML or XML tag.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleTag {
- protected $_name;
- protected $_attributes;
- protected $_content;
-
- /**
- * Starts with a named tag with attributes only.
- * @param string $name Tag name.
- * @param hash $attributes Attribute names and
- * string values. Note that
- * the keys must have been
- * converted to lower case.
- */
- function SimpleTag($name, $attributes) {
- $this->_name = strtolower(trim($name));
- $this->_attributes = $attributes;
- $this->_content = '';
- }
-
- /**
- * Check to see if the tag can have both start and
- * end tags with content in between.
- * @return boolean True if content allowed.
- * @access public
- */
- function expectEndTag() {
- return true;
- }
-
- /**
- * The current tag should not swallow all content for
- * itself as it's searchable page content. Private
- * content tags are usually widgets that contain default
- * values.
- * @return boolean False as content is available
- * to other tags by default.
- * @access public
- */
- function isPrivateContent() {
- return false;
- }
-
- /**
- * Appends string content to the current content.
- * @param string $content Additional text.
- * @access public
- */
- function addContent($content) {
- $this->_content .= (string)$content;
- }
-
- /**
- * Adds an enclosed tag to the content.
- * @param SimpleTag $tag New tag.
- * @access public
- */
- function addTag($tag) {
- }
-
- /**
- * Accessor for tag name.
- * @return string Name of tag.
- * @access public
- */
- function getTagName() {
- return $this->_name;
- }
-
- /**
- * List of legal child elements.
- * @return array List of element names.
- * @access public
- */
- function getChildElements() {
- return array();
- }
-
- /**
- * Accessor for an attribute.
- * @param string $label Attribute name.
- * @return string Attribute value.
- * @access public
- */
- function getAttribute($label) {
- $label = strtolower($label);
- if (! isset($this->_attributes[$label])) {
- return false;
- }
- return (string)$this->_attributes[$label];
- }
-
- /**
- * Sets an attribute.
- * @param string $label Attribute name.
- * @return string $value New attribute value.
- * @access protected
- */
- function _setAttribute($label, $value) {
- $this->_attributes[strtolower($label)] = $value;
- }
-
- /**
- * Accessor for the whole content so far.
- * @return string Content as big raw string.
- * @access public
- */
- function getContent() {
- return $this->_content;
- }
-
- /**
- * Accessor for content reduced to visible text. Acts
- * like a text mode browser, normalising space and
- * reducing images to their alt text.
- * @return string Content as plain text.
- * @access public
- */
- function getText() {
- return SimpleHtmlSaxParser::normalise($this->_content);
- }
-
- /**
- * Test to see if id attribute matches.
- * @param string $id ID to test against.
- * @return boolean True on match.
- * @access public
- */
- function isId($id) {
- return ($this->getAttribute('id') == $id);
- }
- }
-
- /**
- * Page title.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleTitleTag extends SimpleTag {
-
- /**
- * Starts with a named tag with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleTitleTag($attributes) {
- $this->SimpleTag('title', $attributes);
- }
- }
-
- /**
- * Link.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleAnchorTag extends SimpleTag {
-
- /**
- * Starts with a named tag with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleAnchorTag($attributes) {
- $this->SimpleTag('a', $attributes);
- }
-
- /**
- * Accessor for URL as string.
- * @return string Coerced as string.
- * @access public
- */
- function getHref() {
- $url = $this->getAttribute('href');
- if (is_bool($url)) {
- $url = '';
- }
- return $url;
- }
- }
-
- /**
- * Form element.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleWidget extends SimpleTag {
- protected $_value;
- protected $_label;
- protected $_is_set;
-
- /**
- * Starts with a named tag with attributes only.
- * @param string $name Tag name.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleWidget($name, $attributes) {
- $this->SimpleTag($name, $attributes);
- $this->_value = false;
- $this->_label = false;
- $this->_is_set = false;
- }
-
- /**
- * Accessor for name submitted as the key in
- * GET/POST variables hash.
- * @return string Parsed value.
- * @access public
- */
- function getName() {
- return $this->getAttribute('name');
- }
-
- /**
- * Accessor for default value parsed with the tag.
- * @return string Parsed value.
- * @access public
- */
- function getDefault() {
- return $this->getAttribute('value');
- }
-
- /**
- * Accessor for currently set value or default if
- * none.
- * @return string Value set by form or default
- * if none.
- * @access public
- */
- function getValue() {
- if (! $this->_is_set) {
- return $this->getDefault();
- }
- return $this->_value;
- }
-
- /**
- * Sets the current form element value.
- * @param string $value New value.
- * @return boolean True if allowed.
- * @access public
- */
- function setValue($value) {
- $this->_value = $value;
- $this->_is_set = true;
- return true;
- }
-
- /**
- * Resets the form element value back to the
- * default.
- * @access public
- */
- function resetValue() {
- $this->_is_set = false;
- }
-
- /**
- * Allows setting of a label externally, say by a
- * label tag.
- * @param string $label Label to attach.
- * @access public
- */
- function setLabel($label) {
- $this->_label = trim($label);
- }
-
- /**
- * Reads external or internal label.
- * @param string $label Label to test.
- * @return boolean True is match.
- * @access public
- */
- function isLabel($label) {
- return $this->_label == trim($label);
- }
-
- /**
- * Dispatches the value into the form encoded packet.
- * @param SimpleEncoding $encoding Form packet.
- * @access public
- */
- function write($encoding) {
- if ($this->getName()) {
- $encoding->add($this->getName(), $this->getValue());
- }
- }
- }
-
- /**
- * Text, password and hidden field.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleTextTag extends SimpleWidget {
-
- /**
- * Starts with a named tag with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleTextTag($attributes) {
- $this->SimpleWidget('input', $attributes);
- if ($this->getAttribute('value') === false) {
- $this->_setAttribute('value', '');
- }
- }
-
- /**
- * Tag contains no content.
- * @return boolean False.
- * @access public
- */
- function expectEndTag() {
- return false;
- }
-
- /**
- * Sets the current form element value. Cannot
- * change the value of a hidden field.
- * @param string $value New value.
- * @return boolean True if allowed.
- * @access public
- */
- function setValue($value) {
- if ($this->getAttribute('type') == 'hidden') {
- return false;
- }
- return parent::setValue($value);
- }
- }
-
- /**
- * Submit button as input tag.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleSubmitTag extends SimpleWidget {
-
- /**
- * Starts with a named tag with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleSubmitTag($attributes) {
- $this->SimpleWidget('input', $attributes);
- if ($this->getAttribute('value') === false) {
- $this->_setAttribute('value', 'Submit');
- }
- }
-
- /**
- * Tag contains no end element.
- * @return boolean False.
- * @access public
- */
- function expectEndTag() {
- return false;
- }
-
- /**
- * Disables the setting of the button value.
- * @param string $value Ignored.
- * @return boolean True if allowed.
- * @access public
- */
- function setValue($value) {
- return false;
- }
-
- /**
- * Value of browser visible text.
- * @return string Visible label.
- * @access public
- */
- function getLabel() {
- return $this->getValue();
- }
-
- /**
- * Test for a label match when searching.
- * @param string $label Label to test.
- * @return boolean True on match.
- * @access public
- */
- function isLabel($label) {
- return trim($label) == trim($this->getLabel());
- }
- }
-
- /**
- * Image button as input tag.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleImageSubmitTag extends SimpleWidget {
-
- /**
- * Starts with a named tag with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleImageSubmitTag($attributes) {
- $this->SimpleWidget('input', $attributes);
- }
-
- /**
- * Tag contains no end element.
- * @return boolean False.
- * @access public
- */
- function expectEndTag() {
- return false;
- }
-
- /**
- * Disables the setting of the button value.
- * @param string $value Ignored.
- * @return boolean True if allowed.
- * @access public
- */
- function setValue($value) {
- return false;
- }
-
- /**
- * Value of browser visible text.
- * @return string Visible label.
- * @access public
- */
- function getLabel() {
- if ($this->getAttribute('title')) {
- return $this->getAttribute('title');
- }
- return $this->getAttribute('alt');
- }
-
- /**
- * Test for a label match when searching.
- * @param string $label Label to test.
- * @return boolean True on match.
- * @access public
- */
- function isLabel($label) {
- return trim($label) == trim($this->getLabel());
- }
-
- /**
- * Dispatches the value into the form encoded packet.
- * @param SimpleEncoding $encoding Form packet.
- * @param integer $x X coordinate of click.
- * @param integer $y Y coordinate of click.
- * @access public
- */
- function write($encoding){//, $x, $y) {
- if ($this->getName()) {
- $encoding->add($this->getName() . '.x', $x);
- $encoding->add($this->getName() . '.y', $y);
- } else {
- $encoding->add('x', $x);
- $encoding->add('y', $y);
- }
- }
- }
-
- /**
- * Submit button as button tag.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleButtonTag extends SimpleWidget {
-
- /**
- * Starts with a named tag with attributes only.
- * Defaults are very browser dependent.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleButtonTag($attributes) {
- $this->SimpleWidget('button', $attributes);
- }
-
- /**
- * Check to see if the tag can have both start and
- * end tags with content in between.
- * @return boolean True if content allowed.
- * @access public
- */
- function expectEndTag() {
- return true;
- }
-
- /**
- * Disables the setting of the button value.
- * @param string $value Ignored.
- * @return boolean True if allowed.
- * @access public
- */
- function setValue($value) {
- return false;
- }
-
- /**
- * Value of browser visible text.
- * @return string Visible label.
- * @access public
- */
- function getLabel() {
- return $this->getContent();
- }
-
- /**
- * Test for a label match when searching.
- * @param string $label Label to test.
- * @return boolean True on match.
- * @access public
- */
- function isLabel($label) {
- return trim($label) == trim($this->getLabel());
- }
- }
-
- /**
- * Content tag for text area.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleTextAreaTag extends SimpleWidget {
-
- /**
- * Starts with a named tag with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleTextAreaTag($attributes) {
- $this->SimpleWidget('textarea', $attributes);
- }
-
- /**
- * Accessor for starting value.
- * @return string Parsed value.
- * @access public
- */
- function getDefault() {
- return $this->_wrap(SimpleHtmlSaxParser::decodeHtml($this->getContent()));
- }
-
- /**
- * Applies word wrapping if needed.
- * @param string $value New value.
- * @return boolean True if allowed.
- * @access public
- */
- function setValue($value) {
- return parent::setValue($this->_wrap($value));
- }
-
- /**
- * Test to see if text should be wrapped.
- * @return boolean True if wrapping on.
- * @access private
- */
- function _wrapIsEnabled() {
- if ($this->getAttribute('cols')) {
- $wrap = $this->getAttribute('wrap');
- if (($wrap == 'physical') || ($wrap == 'hard')) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Performs the formatting that is peculiar to
- * this tag. There is strange behaviour in this
- * one, including stripping a leading new line.
- * Go figure. I am using Firefox as a guide.
- * @param string $text Text to wrap.
- * @return string Text wrapped with carriage
- * returns and line feeds
- * @access private
- */
- function _wrap($text) {
- $text = str_replace("\r\r\n", "\r\n", str_replace("\n", "\r\n", $text));
- $text = str_replace("\r\n\n", "\r\n", str_replace("\r", "\r\n", $text));
- if (strncmp($text, "\r\n", strlen("\r\n")) == 0) {
- $text = substr($text, strlen("\r\n"));
- }
- if ($this->_wrapIsEnabled()) {
- return wordwrap(
- $text,
- (integer)$this->getAttribute('cols'),
- "\r\n");
- }
- return $text;
- }
-
- /**
- * The content of textarea is not part of the page.
- * @return boolean True.
- * @access public
- */
- function isPrivateContent() {
- return true;
- }
- }
-
- /**
- * File upload widget.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleUploadTag extends SimpleWidget {
-
- /**
- * Starts with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleUploadTag($attributes) {
- $this->SimpleWidget('input', $attributes);
- }
-
- /**
- * Tag contains no content.
- * @return boolean False.
- * @access public
- */
- function expectEndTag() {
- return false;
- }
-
- /**
- * Dispatches the value into the form encoded packet.
- * @param SimpleEncoding $encoding Form packet.
- * @access public
- */
- function write($encoding) {
- if (! file_exists($this->getValue())) {
- return;
- }
- $encoding->attach(
- $this->getName(),
- implode('', file($this->getValue())),
- basename($this->getValue()));
- }
- }
-
- /**
- * Drop down widget.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleSelectionTag extends SimpleWidget {
- protected $_options;
- protected $_choice;
-
- /**
- * Starts with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleSelectionTag($attributes) {
- $this->SimpleWidget('select', $attributes);
- $this->_options = array();
- $this->_choice = false;
- }
-
- /**
- * Adds an option tag to a selection field.
- * @param SimpleOptionTag $tag New option.
- * @access public
- */
- function addTag($tag) {
- if ($tag->getTagName() == 'option') {
- $this->_options[] = $tag;
- }
- }
-
- /**
- * Text within the selection element is ignored.
- * @param string $content Ignored.
- * @access public
- */
- function addContent($content) {
- }
-
- /**
- * Scans options for defaults. If none, then
- * the first option is selected.
- * @return string Selected field.
- * @access public
- */
- function getDefault() {
- for ($i = 0, $count = count($this->_options); $i < $count; $i++) {
- if ($this->_options[$i]->getAttribute('selected') !== false) {
- return $this->_options[$i]->getDefault();
- }
- }
- if ($count > 0) {
- return $this->_options[0]->getDefault();
- }
- return '';
- }
-
- /**
- * Can only set allowed values.
- * @param string $value New choice.
- * @return boolean True if allowed.
- * @access public
- */
- function setValue($value) {
- for ($i = 0, $count = count($this->_options); $i < $count; $i++) {
- if ($this->_options[$i]->isValue($value)) {
- $this->_choice = $i;
- return true;
- }
- }
- return false;
- }
-
- /**
- * Accessor for current selection value.
- * @return string Value attribute or
- * content of opton.
- * @access public
- */
- function getValue() {
- if ($this->_choice === false) {
- return $this->getDefault();
- }
- return $this->_options[$this->_choice]->getValue();
- }
- }
-
- /**
- * Drop down widget.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class MultipleSelectionTag extends SimpleWidget {
- protected $_options;
- protected $_values;
-
- /**
- * Starts with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function MultipleSelectionTag($attributes) {
- $this->SimpleWidget('select', $attributes);
- $this->_options = array();
- $this->_values = false;
- }
-
- /**
- * Adds an option tag to a selection field.
- * @param SimpleOptionTag $tag New option.
- * @access public
- */
- function addTag($tag) {
- if ($tag->getTagName() == 'option') {
- $this->_options[] = $tag;
- }
- }
-
- /**
- * Text within the selection element is ignored.
- * @param string $content Ignored.
- * @access public
- */
- function addContent($content) {
- }
-
- /**
- * Scans options for defaults to populate the
- * value array().
- * @return array Selected fields.
- * @access public
- */
- function getDefault() {
- $default = array();
- for ($i = 0, $count = count($this->_options); $i < $count; $i++) {
- if ($this->_options[$i]->getAttribute('selected') !== false) {
- $default[] = $this->_options[$i]->getDefault();
- }
- }
- return $default;
- }
-
- /**
- * Can only set allowed values. Any illegal value
- * will result in a failure, but all correct values
- * will be set.
- * @param array $desired New choices.
- * @return boolean True if all allowed.
- * @access public
- */
- function setValue($desired) {
- $achieved = array();
- foreach ($desired as $value) {
- $success = false;
- for ($i = 0, $count = count($this->_options); $i < $count; $i++) {
- if ($this->_options[$i]->isValue($value)) {
- $achieved[] = $this->_options[$i]->getValue();
- $success = true;
- break;
- }
- }
- if (! $success) {
- return false;
- }
- }
- $this->_values = $achieved;
- return true;
- }
-
- /**
- * Accessor for current selection value.
- * @return array List of currently set options.
- * @access public
- */
- function getValue() {
- if ($this->_values === false) {
- return $this->getDefault();
- }
- return $this->_values;
- }
- }
-
- /**
- * Option for selection field.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleOptionTag extends SimpleWidget {
-
- /**
- * Stashes the attributes.
- */
- function SimpleOptionTag($attributes) {
- $this->SimpleWidget('option', $attributes);
- }
-
- /**
- * Does nothing.
- * @param string $value Ignored.
- * @return boolean Not allowed.
- * @access public
- */
- function setValue($value) {
- return false;
- }
-
- /**
- * Test to see if a value matches the option.
- * @param string $compare Value to compare with.
- * @return boolean True if possible match.
- * @access public
- */
- function isValue($compare) {
- $compare = trim($compare);
- if (trim($this->getValue()) == $compare) {
- return true;
- }
- return trim($this->getContent()) == $compare;
- }
-
- /**
- * Accessor for starting value. Will be set to
- * the option label if no value exists.
- * @return string Parsed value.
- * @access public
- */
- function getDefault() {
- if ($this->getAttribute('value') === false) {
- return $this->getContent();
- }
- return $this->getAttribute('value');
- }
-
- /**
- * The content of options is not part of the page.
- * @return boolean True.
- * @access public
- */
- function isPrivateContent() {
- return true;
- }
- }
-
- /**
- * Radio button.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleRadioButtonTag extends SimpleWidget {
-
- /**
- * Stashes the attributes.
- * @param array $attributes Hash of attributes.
- */
- function SimpleRadioButtonTag($attributes) {
- $this->SimpleWidget('input', $attributes);
- if ($this->getAttribute('value') === false) {
- $this->_setAttribute('value', 'on');
- }
- }
-
- /**
- * Tag contains no content.
- * @return boolean False.
- * @access public
- */
- function expectEndTag() {
- return false;
- }
-
- /**
- * The only allowed value sn the one in the
- * "value" attribute.
- * @param string $value New value.
- * @return boolean True if allowed.
- * @access public
- */
- function setValue($value) {
- if ($value === false) {
- return parent::setValue($value);
- }
- if ($value !== $this->getAttribute('value')) {
- return false;
- }
- return parent::setValue($value);
- }
-
- /**
- * Accessor for starting value.
- * @return string Parsed value.
- * @access public
- */
- function getDefault() {
- if ($this->getAttribute('checked') !== false) {
- return $this->getAttribute('value');
- }
- return false;
- }
- }
-
- /**
- * Checkbox widget.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleCheckboxTag extends SimpleWidget {
-
- /**
- * Starts with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleCheckboxTag($attributes) {
- $this->SimpleWidget('input', $attributes);
- if ($this->getAttribute('value') === false) {
- $this->_setAttribute('value', 'on');
- }
- }
-
- /**
- * Tag contains no content.
- * @return boolean False.
- * @access public
- */
- function expectEndTag() {
- return false;
- }
-
- /**
- * The only allowed value in the one in the
- * "value" attribute. The default for this
- * attribute is "on". If this widget is set to
- * true, then the usual value will be taken.
- * @param string $value New value.
- * @return boolean True if allowed.
- * @access public
- */
- function setValue($value) {
- if ($value === false) {
- return parent::setValue($value);
- }
- if ($value === true) {
- return parent::setValue($this->getAttribute('value'));
- }
- if ($value != $this->getAttribute('value')) {
- return false;
- }
- return parent::setValue($value);
- }
-
- /**
- * Accessor for starting value. The default
- * value is "on".
- * @return string Parsed value.
- * @access public
- */
- function getDefault() {
- if ($this->getAttribute('checked') !== false) {
- return $this->getAttribute('value');
- }
- return false;
- }
- }
-
- /**
- * A group of multiple widgets with some shared behaviour.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleTagGroup {
- protected $_widgets = array();
-
- /**
- * Adds a tag to the group.
- * @param SimpleWidget $widget
- * @access public
- */
- function addWidget($widget) {
- $this->_widgets[] = $widget;
- }
-
- /**
- * Accessor to widget set.
- * @return array All widgets.
- * @access protected
- */
- function &_getWidgets() {
- return $this->_widgets;
- }
-
- /**
- * Accessor for an attribute.
- * @param string $label Attribute name.
- * @return boolean Always false.
- * @access public
- */
- function getAttribute($label) {
- return false;
- }
-
- /**
- * Fetches the name for the widget from the first
- * member.
- * @return string Name of widget.
- * @access public
- */
- function getName() {
- if (count($this->_widgets) > 0) {
- return $this->_widgets[0]->getName();
- }
- }
-
- /**
- * Scans the widgets for one with the appropriate
- * ID field.
- * @param string $id ID value to try.
- * @return boolean True if matched.
- * @access public
- */
- function isId($id) {
- for ($i = 0, $count = count($this->_widgets); $i < $count; $i++) {
- if ($this->_widgets[$i]->isId($id)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Scans the widgets for one with the appropriate
- * attached label.
- * @param string $label Attached label to try.
- * @return boolean True if matched.
- * @access public
- */
- function isLabel($label) {
- for ($i = 0, $count = count($this->_widgets); $i < $count; $i++) {
- if ($this->_widgets[$i]->isLabel($label)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Dispatches the value into the form encoded packet.
- * @param SimpleEncoding $encoding Form packet.
- * @access public
- */
- function write($encoding) {
- $encoding->add($this->getName(), $this->getValue());
- }
- }
-
- /**
- * A group of tags with the same name within a form.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleCheckboxGroup extends SimpleTagGroup {
-
- /**
- * Accessor for current selected widget or false
- * if none.
- * @return string/array Widget values or false if none.
- * @access public
- */
- function getValue() {
- $values = array();
- $widgets = $this->_getWidgets();
- for ($i = 0, $count = count($widgets); $i < $count; $i++) {
- if ($widgets[$i]->getValue() !== false) {
- $values[] = $widgets[$i]->getValue();
- }
- }
- return $this->_coerceValues($values);
- }
-
- /**
- * Accessor for starting value that is active.
- * @return string/array Widget values or false if none.
- * @access public
- */
- function getDefault() {
- $values = array();
- $widgets = $this->_getWidgets();
- for ($i = 0, $count = count($widgets); $i < $count; $i++) {
- if ($widgets[$i]->getDefault() !== false) {
- $values[] = $widgets[$i]->getDefault();
- }
- }
- return $this->_coerceValues($values);
- }
-
- /**
- * Accessor for current set values.
- * @param string/array/boolean $values Either a single string, a
- * hash or false for nothing set.
- * @return boolean True if all values can be set.
- * @access public
- */
- function setValue($values) {
- $values = $this->_makeArray($values);
- if (! $this->_valuesArePossible($values)) {
- return false;
- }
- $widgets = $this->_getWidgets();
- for ($i = 0, $count = count($widgets); $i < $count; $i++) {
- $possible = $widgets[$i]->getAttribute('value');
- if (in_array($widgets[$i]->getAttribute('value'), $values)) {
- $widgets[$i]->setValue($possible);
- } else {
- $widgets[$i]->setValue(false);
- }
- }
- return true;
- }
-
- /**
- * Tests to see if a possible value set is legal.
- * @param string/array/boolean $values Either a single string, a
- * hash or false for nothing set.
- * @return boolean False if trying to set a
- * missing value.
- * @access private
- */
- function _valuesArePossible($values) {
- $matches = array();
- $widgets = $this->_getWidgets();
- for ($i = 0, $count = count($widgets); $i < $count; $i++) {
- $possible = $widgets[$i]->getAttribute('value');
- if (in_array($possible, $values)) {
- $matches[] = $possible;
- }
- }
- return ($values == $matches);
- }
-
- /**
- * Converts the output to an appropriate format. This means
- * that no values is false, a single value is just that
- * value and only two or more are contained in an array.
- * @param array $values List of values of widgets.
- * @return string/array/boolean Expected format for a tag.
- * @access private
- */
- function _coerceValues($values) {
- if (count($values) == 0) {
- return false;
- } elseif (count($values) == 1) {
- return $values[0];
- } else {
- return $values;
- }
- }
-
- /**
- * Converts false or string into array. The opposite of
- * the coercian method.
- * @param string/array/boolean $value A single item is converted
- * to a one item list. False
- * gives an empty list.
- * @return array List of values, possibly empty.
- * @access private
- */
- function _makeArray($value) {
- if ($value === false) {
- return array();
- }
- if (is_string($value)) {
- return array($value);
- }
- return $value;
- }
- }
-
- /**
- * A group of tags with the same name within a form.
- * Used for radio buttons.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleRadioGroup extends SimpleTagGroup {
-
- /**
- * Each tag is tried in turn until one is
- * successfully set. The others will be
- * unchecked if successful.
- * @param string $value New value.
- * @return boolean True if any allowed.
- * @access public
- */
- function setValue($value) {
- if (! $this->_valueIsPossible($value)) {
- return false;
- }
- $index = false;
- $widgets = $this->_getWidgets();
- for ($i = 0, $count = count($widgets); $i < $count; $i++) {
- if (! $widgets[$i]->setValue($value)) {
- $widgets[$i]->setValue(false);
- }
- }
- return true;
- }
-
- /**
- * Tests to see if a value is allowed.
- * @param string Attempted value.
- * @return boolean True if a valid value.
- * @access private
- */
- function _valueIsPossible($value) {
- $widgets = $this->_getWidgets();
- for ($i = 0, $count = count($widgets); $i < $count; $i++) {
- if ($widgets[$i]->getAttribute('value') == $value) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Accessor for current selected widget or false
- * if none.
- * @return string/boolean Value attribute or
- * content of opton.
- * @access public
- */
- function getValue() {
- $widgets = $this->_getWidgets();
- for ($i = 0, $count = count($widgets); $i < $count; $i++) {
- if ($widgets[$i]->getValue() !== false) {
- return $widgets[$i]->getValue();
- }
- }
- return false;
- }
-
- /**
- * Accessor for starting value that is active.
- * @return string/boolean Value of first checked
- * widget or false if none.
- * @access public
- */
- function getDefault() {
- $widgets = $this->_getWidgets();
- for ($i = 0, $count = count($widgets); $i < $count; $i++) {
- if ($widgets[$i]->getDefault() !== false) {
- return $widgets[$i]->getDefault();
- }
- }
- return false;
- }
- }
-
- /**
- * Tag to keep track of labels.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleLabelTag extends SimpleTag {
-
- /**
- * Starts with a named tag with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleLabelTag($attributes) {
- $this->SimpleTag('label', $attributes);
- }
-
- /**
- * Access for the ID to attach the label to.
- * @return string For attribute.
- * @access public
- */
- function getFor() {
- return $this->getAttribute('for');
- }
- }
-
- /**
- * Tag to aid parsing the form.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleFormTag extends SimpleTag {
-
- /**
- * Starts with a named tag with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleFormTag($attributes) {
- $this->SimpleTag('form', $attributes);
- }
- }
-
- /**
- * Tag to aid parsing the frames in a page.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleFrameTag extends SimpleTag {
-
- /**
- * Starts with a named tag with attributes only.
- * @param hash $attributes Attribute names and
- * string values.
- */
- function SimpleFrameTag($attributes) {
- $this->SimpleTag('frame', $attributes);
- }
-
- /**
- * Tag contains no content.
- * @return boolean False.
- * @access public
- */
- function expectEndTag() {
- return false;
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/test_case.php b/tests/test_tools/simpletest/test_case.php
deleted file mode 100644
index 74253d80..00000000
--- a/tests/test_tools/simpletest/test_case.php
+++ /dev/null
@@ -1,689 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: test_case.php 2309 2007-10-08 03:24:07Z wei $
- */
-
- /**#@+
- * Includes SimpleTest files and defined the root constant
- * for dependent libraries.
- */
- require_once(dirname(__FILE__) . '/invoker.php');
- require_once(dirname(__FILE__) . '/errors.php');
- require_once(dirname(__FILE__) . '/compatibility.php');
- require_once(dirname(__FILE__) . '/scorer.php');
- require_once(dirname(__FILE__) . '/expectation.php');
- require_once(dirname(__FILE__) . '/dumper.php');
- require_once(dirname(__FILE__) . '/simpletest.php');
- if (version_compare(phpversion(), '5') >= 0) {
- require_once(dirname(__FILE__) . '/exceptions.php');
- require_once(dirname(__FILE__) . '/reflection_php5.php');
- } else {
- require_once(dirname(__FILE__) . '/reflection_php4.php');
- }
- if (! defined('SIMPLE_TEST')) {
- /**
- * @ignore
- */
- define('SIMPLE_TEST', dirname(__FILE__) . '/');
- }
- /**#@-*/
-
- /**
- * Basic test case. This is the smallest unit of a test
- * suite. It searches for
- * all methods that start with the the string "test" and
- * runs them. Working test cases extend this class.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleTestCase {
- protected $_label = false;
- protected $_reporter;
- protected $_observers;
-
- /**
- * Sets up the test with no display.
- * @param string $label If no test name is given then
- * the class name is used.
- * @access public
- */
- function SimpleTestCase($label = false) {
- if ($label) {
- $this->_label = $label;
- }
- }
-
- /**
- * Accessor for the test name for subclasses.
- * @return string Name of the test.
- * @access public
- */
- function getLabel() {
- return $this->_label ? $this->_label : get_class($this);
- }
-
- /**
- * Used to invoke the single tests.
- * @return SimpleInvoker Individual test runner.
- * @access public
- */
- function createInvoker() {
- $invoker = new SimpleErrorTrappingInvoker(new SimpleInvoker($this));
- if (version_compare(phpversion(), '5') >= 0) {
- $invoker = new SimpleExceptionTrappingInvoker($invoker);
- }
- return $invoker;
- }
-
- /**
- * Uses reflection to run every method within itself
- * starting with the string "test" unless a method
- * is specified.
- * @param SimpleReporter $reporter Current test reporter.
- * @access public
- */
- function run($reporter) {
- SimpleTest::setCurrent($this);
- $this->_reporter = $reporter;
- $this->_reporter->paintCaseStart($this->getLabel());
- foreach ($this->getTests() as $method) {
- if ($this->_reporter->shouldInvoke($this->getLabel(), $method)) {
- $invoker = $this->_reporter->createInvoker($this->createInvoker());
- $invoker->before($method);
- $invoker->invoke($method);
- $invoker->after($method);
- }
- }
- $this->_reporter->paintCaseEnd($this->getLabel());
- unset($this->_reporter);
- return $reporter->getStatus();
- }
-
- /**
- * Gets a list of test names. Normally that will
- * be all internal methods that start with the
- * name "test". This method should be overridden
- * if you want a different rule.
- * @return array List of test names.
- * @access public
- */
- function getTests() {
- $methods = array();
- foreach (get_class_methods(get_class($this)) as $method) {
- if ($this->_isTest($method)) {
- $methods[] = $method;
- }
- }
- return $methods;
- }
-
- /**
- * Tests to see if the method is a test that should
- * be run. Currently any method that starts with 'test'
- * is a candidate unless it is the constructor.
- * @param string $method Method name to try.
- * @return boolean True if test method.
- * @access protected
- */
- function _isTest($method) {
- if (strtolower(substr($method, 0, 4)) == 'test') {
- return ! SimpleTestCompatibility::isA($this, strtolower($method));
- }
- return false;
- }
-
- /**
- * Announces the start of the test.
- * @param string $method Test method just started.
- * @access public
- */
- function before($method) {
- $this->_reporter->paintMethodStart($method);
- $this->_observers = array();
- }
-
- /**
- * Sets up unit test wide variables at the start
- * of each test method. To be overridden in
- * actual user test cases.
- * @access public
- */
- function setUp() {
- }
-
- /**
- * Clears the data set in the setUp() method call.
- * To be overridden by the user in actual user test cases.
- * @access public
- */
- function tearDown() {
- }
-
- /**
- * Announces the end of the test. Includes private clean up.
- * @param string $method Test method just finished.
- * @access public
- */
- function after($method) {
- for ($i = 0; $i < count($this->_observers); $i++) {
- $this->_observers[$i]->atTestEnd($method);
- }
- $this->_reporter->paintMethodEnd($method);
- }
-
- /**
- * Sets up an observer for the test end.
- * @param object $observer Must have atTestEnd()
- * method.
- * @access public
- */
- function tell($observer) {
- $this->_observers[] = $observer;
- }
-
- /**
- * Sends a pass event with a message.
- * @param string $message Message to send.
- * @access public
- */
- function pass($message = "Pass") {
- if (! isset($this->_reporter)) {
- trigger_error('Can only make assertions within test methods');
- }
- $this->_reporter->paintPass(
- $message . $this->getAssertionLine());
- return true;
- }
-
- /**
- * Sends a fail event with a message.
- * @param string $message Message to send.
- * @access public
- */
- function fail($message = "Fail") {
- if (! isset($this->_reporter)) {
- trigger_error('Can only make assertions within test methods');
- }
- $this->_reporter->paintFail(
- $message . $this->getAssertionLine());
- return false;
- }
-
- /**
- * Formats a PHP error and dispatches it to the
- * reporter.
- * @param integer $severity PHP error code.
- * @param string $message Text of error.
- * @param string $file File error occoured in.
- * @param integer $line Line number of error.
- * @access public
- */
- function error($severity, $message, $file, $line) {
- if (! isset($this->_reporter)) {
- trigger_error('Can only make assertions within test methods');
- }
- $this->_reporter->paintError(
- "Unexpected PHP error [$message] severity [$severity] in [$file] line [$line]");
- }
-
- /**
- * Formats an exception and dispatches it to the
- * reporter.
- * @param Exception $exception Object thrown.
- * @access public
- */
- function exception($exception) {
- $this->_reporter->paintError(
- 'Unexpected exception of type [' . get_class($exception) .
- '] with message ['. $exception->getMessage() .
- '] in ['. $exception->getFile() .
- '] line [' . $exception->getLine() .
- '] stack [' . $exception->getTraceAsString() .']');
- }
-
- /**
- * Sends a user defined event to the test reporter.
- * This is for small scale extension where
- * both the test case and either the reporter or
- * display are subclassed.
- * @param string $type Type of event.
- * @param mixed $payload Object or message to deliver.
- * @access public
- */
- function signal($type, $payload) {
- if (! isset($this->_reporter)) {
- trigger_error('Can only make assertions within test methods');
- }
- $this->_reporter->paintSignal($type, $payload);
- }
-
- /**
- * Cancels any outstanding errors.
- * @access public
- */
- function swallowErrors() {
- $queue = &SimpleErrorQueue::instance();
- $queue->clear();
- }
-
- /**
- * Runs an expectation directly, for extending the
- * tests with new expectation classes.
- * @param SimpleExpectation $expectation Expectation subclass.
- * @param mixed $compare Value to compare.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assert($expectation, $compare, $message = '%s') {
- return $this->assertTrue(
- $expectation->test($compare),
- sprintf($message, $expectation->overlayMessage($compare)));
- }
-
- /**
- * @deprecated
- */
- function assertExpectation($expectation, $compare, $message = '%s') {
- return $this->assert($expectation, $compare, $message);
- }
-
- /**
- * Called from within the test methods to register
- * passes and failures.
- * @param boolean $result Pass on true.
- * @param string $message Message to display describing
- * the test state.
- * @return boolean True on pass
- * @access public
- */
- function assertTrue($result, $message = false) {
- if (! $message) {
- $message = 'True assertion got ' . ($result ? 'True' : 'False');
- }
- if ($result) {
- return $this->pass($message);
- } else {
- return $this->fail($message);
- }
- }
-
- /**
- * Will be true on false and vice versa. False
- * is the PHP definition of false, so that null,
- * empty strings, zero and an empty array all count
- * as false.
- * @param boolean $result Pass on false.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertFalse($result, $message = false) {
- if (! $message) {
- $message = 'False assertion got ' . ($result ? 'True' : 'False');
- }
- return $this->assertTrue(! $result, $message);
- }
-
- /**
- * Uses a stack trace to find the line of an assertion.
- * @param string $format String formatting.
- * @param array $stack Stack frames top most first. Only
- * needed if not using the PHP
- * backtrace function.
- * @return string Line number of first assert*
- * method embedded in format string.
- * @access public
- */
- function getAssertionLine($stack = false) {
- if ($stack === false) {
- $stack = SimpleTestCompatibility::getStackTrace();
- }
- return SimpleDumper::getFormattedAssertionLine($stack);
- }
-
- /**
- * Sends a formatted dump of a variable to the
- * test suite for those emergency debugging
- * situations.
- * @param mixed $variable Variable to display.
- * @param string $message Message to display.
- * @return mixed The original variable.
- * @access public
- */
- function dump($variable, $message = false) {
- $formatted = SimpleDumper::dump($variable);
- if ($message) {
- $formatted = $message . "\n" . $formatted;
- }
- $this->_reporter->paintFormattedMessage($formatted);
- return $variable;
- }
-
- /**
- * Dispatches a text message straight to the
- * test suite. Useful for status bar displays.
- * @param string $message Message to show.
- * @access public
- */
- function sendMessage($message) {
- $this->_reporter->PaintMessage($message);
- }
-
- /**
- * Accessor for the number of subtests.
- * @return integer Number of test cases.
- * @access public
- * @static
- */
- static function getSize() {
- return 1;
- }
- }
-
- /**
- * This is a composite test class for combining
- * test cases and other RunnableTest classes into
- * a group test.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class GroupTest {
- protected $_label;
- protected $_test_cases;
- protected $_old_track_errors;
- protected $_xdebug_is_enabled;
-
- /**
- * Sets the name of the test suite.
- * @param string $label Name sent at the start and end
- * of the test.
- * @access public
- */
- function GroupTest($label = false) {
- $this->_label = $label ? $label : get_class($this);
- $this->_test_cases = array();
- $this->_old_track_errors = ini_get('track_errors');
- $this->_xdebug_is_enabled = function_exists('xdebug_is_enabled') ?
- xdebug_is_enabled() : false;
- }
-
- /**
- * Accessor for the test name for subclasses.
- * @return string Name of the test.
- * @access public
- */
- function getLabel() {
- return $this->_label;
- }
-
- function setLabel($value)
- {
- $this->_label = $value;
- }
-
- /**
- * Adds a test into the suite. Can be either a group
- * test or some other unit test.
- * @param SimpleTestCase $test_case Suite or individual test
- * case implementing the
- * runnable test interface.
- * @access public
- */
- function addTestCase($test_case) {
- $this->_test_cases[] = $test_case;
- }
-
- /**
- * Adds a test into the suite by class name. The class will
- * be instantiated as needed.
- * @param SimpleTestCase $test_case Suite or individual test
- * case implementing the
- * runnable test interface.
- * @access public
- */
- function addTestClass($class) {
- if ($this->_getBaseTestCase($class) == 'grouptest') {
- $this->_test_cases[] = new $class();
- } else {
- $this->_test_cases[] = $class;
- }
- }
-
- /**
- * Builds a group test from a library of test cases.
- * The new group is composed into this one.
- * @param string $test_file File name of library with
- * test case classes.
- * @access public
- */
- function addTestFile($test_file) {
- $existing_classes = get_declared_classes();
- if ($error = $this->_requireWithError($test_file)) {
- $this->addTestCase(new BadGroupTest($test_file, $error));
- return;
- }
- $classes = $this->_selectRunnableTests($existing_classes, get_declared_classes());
- if (count($classes) == 0) {
- $this->addTestCase(new BadGroupTest($test_file, "No runnable test cases in [$test_file]"));
- return;
- }
- $group = $this->_createGroupFromClasses($test_file, $classes);
- $this->addTestCase($group);
- }
-
- /**
- * Requires a source file recording any syntax errors.
- * @param string $file File name to require in.
- * @return string/boolean An error message on failure or false
- * if no errors.
- * @access private
- */
- function _requireWithError($file) {
- $this->_enableErrorReporting();
- include_once($file);
- $error = isset($php_errormsg) ? $php_errormsg : false;
- $this->_disableErrorReporting();
- $self_inflicted_errors = array(
- 'Assigning the return value of new by reference is deprecated',
- 'var: Deprecated. Please use the public/private/protected modifiers');
- if (in_array($error, $self_inflicted_errors)) {
- return false;
- }
- return $error;
- }
-
- /**
- * Sets up detection of parse errors. Note that XDebug
- * interferes with this and has to be disabled. This is
- * to make sure the correct error code is returned
- * from unattended scripts.
- * @access private
- */
- function _enableErrorReporting() {
- if ($this->_xdebug_is_enabled) {
- xdebug_disable();
- }
- ini_set('track_errors', true);
- }
-
- /**
- * Resets detection of parse errors to their old values.
- * This is to make sure the correct error code is returned
- * from unattended scripts.
- * @access private
- */
- function _disableErrorReporting() {
- ini_set('track_errors', $this->_old_track_errors);
- if ($this->_xdebug_is_enabled) {
- xdebug_enable();
- }
- }
-
- /**
- * Calculates the incoming test cases from a before
- * and after list of loaded classes. Skips abstract
- * classes.
- * @param array $existing_classes Classes before require().
- * @param array $new_classes Classes after require().
- * @return array New classes which are test
- * cases that shouldn't be ignored.
- * @access private
- */
- function _selectRunnableTests($existing_classes, $new_classes) {
- $classes = array();
- foreach ($new_classes as $class) {
- if (in_array($class, $existing_classes)) {
- continue;
- }
- if ($this->_getBaseTestCase($class)) {
- $reflection = new SimpleReflection($class);
- if ($reflection->isAbstract()) {
- SimpleTest::ignore($class);
- }
- $classes[] = $class;
- }
- }
- return $classes;
- }
-
- /**
- * Builds a group test from a class list.
- * @param string $title Title of new group.
- * @param array $classes Test classes.
- * @return GroupTest Group loaded with the new
- * test cases.
- * @access private
- */
- function &_createGroupFromClasses($title, $classes) {
- SimpleTest::ignoreParentsIfIgnored($classes);
- $group = new GroupTest($title);
- foreach ($classes as $class) {
- if (! SimpleTest::isIgnored($class)) {
- $group->addTestClass($class);
- }
- }
- return $group;
- }
-
- /**
- * Test to see if a class is derived from the
- * SimpleTestCase class.
- * @param string $class Class name.
- * @access private
- */
- function _getBaseTestCase($class) {
- while ($class = get_parent_class($class)) {
- $class = strtolower($class);
- if ($class == "simpletestcase" || $class == "grouptest") {
- return $class;
- }
- }
- return false;
- }
-
- /**
- * Delegates to a visiting collector to add test
- * files.
- * @param string $path Path to scan from.
- * @param SimpleCollector $collector Directory scanner.
- * @access public
- */
- function collect($path, $collector) {
- $collector->collect($this, $path);
- }
-
- /**
- * Invokes run() on all of the held test cases, instantiating
- * them if necessary.
- * @param SimpleReporter $reporter Current test reporter.
- * @access public
- */
- function run($reporter) {
- $reporter->paintGroupStart($this->getLabel(), $this->getSize());
- for ($i = 0, $count = count($this->_test_cases); $i < $count; $i++) {
- if (is_string($this->_test_cases[$i])) {
- $class = $this->_test_cases[$i];
- $test = new $class();
- $test->run($reporter);
- } else {
- $this->_test_cases[$i]->run($reporter);
- }
- }
- $reporter->paintGroupEnd($this->getLabel());
- return $reporter->getStatus();
- }
-
- /**
- * Number of contained test cases.
- * @return integer Total count of cases in the group.
- * @access public
- */
- function getSize() {
- $count = 0;
- foreach ($this->_test_cases as $case) {
- if (is_string($case)) {
- $count++;
- } else {
- $count += $case->getSize();
- }
- }
- return $count;
- }
- }
-
- /**
- * This is a failing group test for when a test suite hasn't
- * loaded properly.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class BadGroupTest {
- protected $_label;
- protected $_error;
-
- /**
- * Sets the name of the test suite and error message.
- * @param string $label Name sent at the start and end
- * of the test.
- * @access public
- */
- function BadGroupTest($label, $error) {
- $this->_label = $label;
- $this->_error = $error;
- }
-
- /**
- * Accessor for the test name for subclasses.
- * @return string Name of the test.
- * @access public
- */
- function getLabel() {
- return $this->_label;
- }
-
- /**
- * Sends a single error to the reporter.
- * @param SimpleReporter $reporter Current test reporter.
- * @access public
- */
- function run($reporter) {
- $reporter->paintGroupStart($this->getLabel(), $this->getSize());
- $reporter->paintFail('Bad GroupTest [' . $this->getLabel() .
- '] with error [' . $this->_error . ']');
- $reporter->paintGroupEnd($this->getLabel());
- return $reporter->getStatus();
- }
-
- /**
- * Number of contained test cases. Always zero.
- * @return integer Total count of cases in the group.
- * @access public
- */
- function getSize() {
- return 0;
- }
- }
diff --git a/tests/test_tools/simpletest/unit_tester.php b/tests/test_tools/simpletest/unit_tester.php
deleted file mode 100644
index 672a3050..00000000
--- a/tests/test_tools/simpletest/unit_tester.php
+++ /dev/null
@@ -1,372 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: unit_tester.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/test_case.php');
- require_once(dirname(__FILE__) . '/dumper.php');
- /**#@-*/
-
- /**
- * Standard unit test class for day to day testing
- * of PHP code XP style. Adds some useful standard
- * assertions.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class UnitTestCase extends SimpleTestCase {
-
- /**
- * Creates an empty test case. Should be subclassed
- * with test methods for a functional test case.
- * @param string $label Name of test case. Will use
- * the class name if none specified.
- * @access public
- */
- function UnitTestCase($label = false) {
- if (! $label) {
- $label = get_class($this);
- }
- $this->SimpleTestCase($label);
- }
-
- /**
- * Will be true if the value is null.
- * @param null $value Supposedly null value.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertNull($value, $message = "%s") {
- $dumper = new SimpleDumper();
- $message = sprintf(
- $message,
- "[" . $dumper->describeValue($value) . "] should be null");
- return $this->assertTrue(! isset($value), $message);
- }
-
- /**
- * Will be true if the value is set.
- * @param mixed $value Supposedly set value.
- * @param string $message Message to display.
- * @return boolean True on pass.
- * @access public
- */
- function assertNotNull($value, $message = "%s") {
- $dumper = new SimpleDumper();
- $message = sprintf(
- $message,
- "[" . $dumper->describeValue($value) . "] should not be null");
- return $this->assertTrue(isset($value), $message);
- }
-
- /**
- * Type and class test. Will pass if class
- * matches the type name or is a subclass or
- * if not an object, but the type is correct.
- * @param mixed $object Object to test.
- * @param string $type Type name as string.
- * @param string $message Message to display.
- * @return boolean True on pass.
- * @access public
- */
- function assertIsA($object, $type, $message = "%s") {
- return $this->assert(
- new IsAExpectation($type),
- $object,
- $message);
- }
-
- /**
- * Type and class mismatch test. Will pass if class
- * name or underling type does not match the one
- * specified.
- * @param mixed $object Object to test.
- * @param string $type Type name as string.
- * @param string $message Message to display.
- * @return boolean True on pass.
- * @access public
- */
- function assertNotA($object, $type, $message = "%s") {
- return $this->assert(
- new NotAExpectation($type),
- $object,
- $message);
- }
-
- /**
- * Will trigger a pass if the two parameters have
- * the same value only. Otherwise a fail.
- * @param mixed $first Value to compare.
- * @param mixed $second Value to compare.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertEqual($first, $second, $message = "%s") {
- return $this->assert(
- new EqualExpectation($first),
- $second,
- $message);
- }
-
- /**
- * Will trigger a pass if the two parameters have
- * a different value. Otherwise a fail.
- * @param mixed $first Value to compare.
- * @param mixed $second Value to compare.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertNotEqual($first, $second, $message = "%s") {
- return $this->assert(
- new NotEqualExpectation($first),
- $second,
- $message);
- }
-
- /**
- * Will trigger a pass if the if the first parameter
- * is near enough to the second by the margin.
- * @param mixed $first Value to compare.
- * @param mixed $second Value to compare.
- * @param mixed $margin Fuzziness of match.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertWithinMargin($first, $second, $margin, $message = "%s") {
- return $this->assert(
- new WithinMarginExpectation($first, $margin),
- $second,
- $message);
- }
-
- /**
- * Will trigger a pass if the two parameters differ
- * by more than the margin.
- * @param mixed $first Value to compare.
- * @param mixed $second Value to compare.
- * @param mixed $margin Fuzziness of match.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertOutsideMargin($first, $second, $margin, $message = "%s") {
- return $this->assert(
- new OutsideMarginExpectation($first, $margin),
- $second,
- $message);
- }
-
- /**
- * Will trigger a pass if the two parameters have
- * the same value and same type. Otherwise a fail.
- * @param mixed $first Value to compare.
- * @param mixed $second Value to compare.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertIdentical($first, $second, $message = "%s") {
- return $this->assert(
- new IdenticalExpectation($first),
- $second,
- $message);
- }
-
- /**
- * Will trigger a pass if the two parameters have
- * the different value or different type.
- * @param mixed $first Value to compare.
- * @param mixed $second Value to compare.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertNotIdentical($first, $second, $message = "%s") {
- return $this->assert(
- new NotIdenticalExpectation($first),
- $second,
- $message);
- }
-
- /**
- * Will trigger a pass if both parameters refer
- * to the same object. Fail otherwise.
- * @param mixed $first Object reference to check.
- * @param mixed $second Hopefully the same object.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertReference($first, $second, $message = "%s") {
- $dumper = new SimpleDumper();
- $message = sprintf(
- $message,
- "[" . $dumper->describeValue($first) .
- "] and [" . $dumper->describeValue($second) .
- "] should reference the same object");
- return $this->assertTrue(
- SimpleTestCompatibility::isReference($first, $second),
- $message);
- }
-
- /**
- * Will trigger a pass if both parameters refer
- * to different objects. Fail otherwise. The objects
- * have to be identical though.
- * @param mixed $first Object reference to check.
- * @param mixed $second Hopefully not the same object.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertClone($first, $second, $message = "%s") {
- $dumper = new SimpleDumper();
- $message = sprintf(
- $message,
- "[" . $dumper->describeValue($first) .
- "] and [" . $dumper->describeValue($second) .
- "] should not be the same object");
- $identical = new IdenticalExpectation($first);
- return $this->assertTrue(
- $identical->test($second) &&
- ! SimpleTestCompatibility::isReference($first, $second),
- $message);
- }
-
- /**
- * @deprecated
- */
- function assertCopy($first, $second, $message = "%s") {
- $dumper = new SimpleDumper();
- $message = sprintf(
- $message,
- "[" . $dumper->describeValue($first) .
- "] and [" . $dumper->describeValue($second) .
- "] should not be the same object");
- return $this->assertFalse(
- SimpleTestCompatibility::isReference($first, $second),
- $message);
- }
-
- /**
- * Will trigger a pass if the Perl regex pattern
- * is found in the subject. Fail otherwise.
- * @param string $pattern Perl regex to look for including
- * the regex delimiters.
- * @param string $subject String to search in.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertPattern($pattern, $subject, $message = "%s") {
- return $this->assert(
- new PatternExpectation($pattern),
- $subject,
- $message);
- }
-
- /**
- * @deprecated
- */
- function assertWantedPattern($pattern, $subject, $message = "%s") {
- return $this->assertPattern($pattern, $subject, $message);
- }
-
- /**
- * Will trigger a pass if the perl regex pattern
- * is not present in subject. Fail if found.
- * @param string $pattern Perl regex to look for including
- * the regex delimiters.
- * @param string $subject String to search in.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertNoPattern($pattern, $subject, $message = "%s") {
- return $this->assert(
- new NoPatternExpectation($pattern),
- $subject,
- $message);
- }
-
- /**
- * @deprecated
- */
- function assertNoUnwantedPattern($pattern, $subject, $message = "%s") {
- return $this->assertNoPattern($pattern, $subject, $message);
- }
-
- /**
- * Confirms that no errors have occoured so
- * far in the test method.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertNoErrors($message = "%s") {
- $queue = &SimpleErrorQueue::instance();
- return $this->assertTrue(
- $queue->isEmpty(),
- sprintf($message, "Should be no errors"));
- }
-
- /**
- * Confirms that an error has occoured and
- * optionally that the error text matches exactly.
- * @param string $expected Expected error text or
- * false for no check.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertError($expected = false, $message = "%s") {
- $queue = &SimpleErrorQueue::instance();
- if ($queue->isEmpty()) {
- $this->fail(sprintf($message, "Expected error not found"));
- return;
- }
- list($severity, $content, $file, $line, $globals) = $queue->extract();
- $severity = SimpleErrorQueue::getSeverityAsString($severity);
- if (! $expected) {
- return $this->pass(
- "Captured a PHP error of [$content] severity [$severity] in [$file] line [$line] -> %s");
- }
- $expected = $this->_coerceToExpectation($expected);
- return $this->assert(
- $expected,
- $content,
- "Expected PHP error [$content] severity [$severity] in [$file] line [$line] -> %s");
- }
-
- /**
- * Creates an equality expectation if the
- * object/value is not already some type
- * of expectation.
- * @param mixed $expected Expected value.
- * @return SimpleExpectation Expectation object.
- * @access private
- */
- function _coerceToExpectation($expected) {
- if (SimpleTestCompatibility::isA($expected, 'SimpleExpectation')) {
- return $expected;
- }
- return new EqualExpectation($expected);
- }
-
- /**
- * @deprecated
- */
- function assertErrorPattern($pattern, $message = "%s") {
- return $this->assertError(new PatternExpectation($pattern), $message);
- }
- }
diff --git a/tests/test_tools/simpletest/url.php b/tests/test_tools/simpletest/url.php
deleted file mode 100644
index dedc6a9b..00000000
--- a/tests/test_tools/simpletest/url.php
+++ /dev/null
@@ -1,524 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: url.php 1532 2006-12-01 12:28:55Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/encoding.php');
- /**#@-*/
-
- /**
- * URL parser to replace parse_url() PHP function which
- * got broken in PHP 4.3.0. Adds some browser specific
- * functionality such as expandomatics.
- * Guesses a bit trying to separate the host from
- * the path and tries to keep a raw, possibly unparsable,
- * request string as long as possible.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleUrl {
- protected $_scheme;
- protected $_username;
- protected $_password;
- protected $_host;
- protected $_port;
- protected $_path;
- protected $_request;
- protected $_fragment;
- protected $_x;
- protected $_y;
- protected $_target;
- protected $_raw = false;
-
- /**
- * Constructor. Parses URL into sections.
- * @param string $url Incoming URL.
- * @access public
- */
- function SimpleUrl($url) {
- list($x, $y) = $this->_chompCoordinates($url);
- $this->setCoordinates($x, $y);
- $this->_scheme = $this->_chompScheme($url);
- list($this->_username, $this->_password) = $this->_chompLogin($url);
- $this->_host = $this->_chompHost($url);
- $this->_port = false;
- if (preg_match('/(.*?):(.*)/', $this->_host, $host_parts)) {
- $this->_host = $host_parts[1];
- $this->_port = (integer)$host_parts[2];
- }
- $this->_path = $this->_chompPath($url);
- $this->_request = $this->_parseRequest($this->_chompRequest($url));
- $this->_fragment = (strncmp($url, "#", 1) == 0 ? substr($url, 1) : false);
- $this->_target = false;
- }
-
- /**
- * Extracts the X, Y coordinate pair from an image map.
- * @param string $url URL so far. The coordinates will be
- * removed.
- * @return array X, Y as a pair of integers.
- * @access private
- */
- function _chompCoordinates($url) {
- if (preg_match('/(.*)\?(\d+),(\d+)$/', $url, $matches)) {
- $url = $matches[1];
- return array((integer)$matches[2], (integer)$matches[3]);
- }
- return array(false, false);
- }
-
- /**
- * Extracts the scheme part of an incoming URL.
- * @param string $url URL so far. The scheme will be
- * removed.
- * @return string Scheme part or false.
- * @access private
- */
- function _chompScheme($url) {
- if (preg_match('/(.*?):(\/\/)(.*)/', $url, $matches)) {
- $url = $matches[2] . $matches[3];
- return $matches[1];
- }
- return false;
- }
-
- /**
- * Extracts the username and password from the
- * incoming URL. The // prefix will be reattached
- * to the URL after the doublet is extracted.
- * @param string $url URL so far. The username and
- * password are removed.
- * @return array Two item list of username and
- * password. Will urldecode() them.
- * @access private
- */
- function _chompLogin($url) {
- $prefix = '';
- if (preg_match('/^(\/\/)(.*)/', $url, $matches)) {
- $prefix = $matches[1];
- $url = $matches[2];
- }
- if (preg_match('/(.*?)@(.*)/', $url, $matches)) {
- $url = $prefix . $matches[2];
- $parts = split(":", $matches[1]);
- return array(
- urldecode($parts[0]),
- isset($parts[1]) ? urldecode($parts[1]) : false);
- }
- $url = $prefix . $url;
- return array(false, false);
- }
-
- /**
- * Extracts the host part of an incoming URL.
- * Includes the port number part. Will extract
- * the host if it starts with // or it has
- * a top level domain or it has at least two
- * dots.
- * @param string $url URL so far. The host will be
- * removed.
- * @return string Host part guess or false.
- * @access private
- */
- function _chompHost($url) {
- if (preg_match('/^(\/\/)(.*?)(\/.*|\?.*|#.*|$)/', $url, $matches)) {
- $url = $matches[3];
- return $matches[2];
- }
- if (preg_match('/(.*?)(\.\.\/|\.\/|\/|\?|#|$)(.*)/', $url, $matches)) {
- $tlds = SimpleUrl::getAllTopLevelDomains();
- if (preg_match('/[a-z0-9\-]+\.(' . $tlds . ')/i', $matches[1])) {
- $url = $matches[2] . $matches[3];
- return $matches[1];
- } elseif (preg_match('/[a-z0-9\-]+\.[a-z0-9\-]+\.[a-z0-9\-]+/i', $matches[1])) {
- $url = $matches[2] . $matches[3];
- return $matches[1];
- }
- }
- return false;
- }
-
- /**
- * Extracts the path information from the incoming
- * URL. Strips this path from the URL.
- * @param string $url URL so far. The host will be
- * removed.
- * @return string Path part or '/'.
- * @access private
- */
- function _chompPath($url) {
- if (preg_match('/(.*?)(\?|#|$)(.*)/', $url, $matches)) {
- $url = $matches[2] . $matches[3];
- return ($matches[1] ? $matches[1] : '');
- }
- return '';
- }
-
- /**
- * Strips off the request data.
- * @param string $url URL so far. The request will be
- * removed.
- * @return string Raw request part.
- * @access private
- */
- function _chompRequest($url) {
- if (preg_match('/\?(.*?)(#|$)(.*)/', $url, $matches)) {
- $url = $matches[2] . $matches[3];
- return $matches[1];
- }
- return '';
- }
-
- /**
- * Breaks the request down into an object.
- * @param string $raw Raw request.
- * @return SimpleFormEncoding Parsed data.
- * @access private
- */
- function _parseRequest($raw) {
- $this->_raw = $raw;
- $request = new SimpleGetEncoding();
- foreach (split("&", $raw) as $pair) {
- if (preg_match('/(.*?)=(.*)/', $pair, $matches)) {
- $request->add($matches[1], urldecode($matches[2]));
- } elseif ($pair) {
- $request->add($pair, '');
- }
- }
- return $request;
- }
-
- /**
- * Accessor for protocol part.
- * @param string $default Value to use if not present.
- * @return string Scheme name, e.g "http".
- * @access public
- */
- function getScheme($default = false) {
- return $this->_scheme ? $this->_scheme : $default;
- }
-
- /**
- * Accessor for user name.
- * @return string Username preceding host.
- * @access public
- */
- function getUsername() {
- return $this->_username;
- }
-
- /**
- * Accessor for password.
- * @return string Password preceding host.
- * @access public
- */
- function getPassword() {
- return $this->_password;
- }
-
- /**
- * Accessor for hostname and port.
- * @param string $default Value to use if not present.
- * @return string Hostname only.
- * @access public
- */
- function getHost($default = false) {
- return $this->_host ? $this->_host : $default;
- }
-
- /**
- * Accessor for top level domain.
- * @return string Last part of host.
- * @access public
- */
- function getTld() {
- $path_parts = pathinfo($this->getHost());
- return (isset($path_parts['extension']) ? $path_parts['extension'] : false);
- }
-
- /**
- * Accessor for port number.
- * @return integer TCP/IP port number.
- * @access public
- */
- function getPort() {
- return $this->_port;
- }
-
- /**
- * Accessor for path.
- * @return string Full path including leading slash if implied.
- * @access public
- */
- function getPath() {
- if (! $this->_path && $this->_host) {
- return '/';
- }
- return $this->_path;
- }
-
- /**
- * Accessor for page if any. This may be a
- * directory name if ambiguious.
- * @return Page name.
- * @access public
- */
- function getPage() {
- if (! preg_match('/([^\/]*?)$/', $this->getPath(), $matches)) {
- return false;
- }
- return $matches[1];
- }
-
- /**
- * Gets the path to the page.
- * @return string Path less the page.
- * @access public
- */
- function getBasePath() {
- if (! preg_match('/(.*\/)[^\/]*?$/', $this->getPath(), $matches)) {
- return false;
- }
- return $matches[1];
- }
-
- /**
- * Accessor for fragment at end of URL after the "#".
- * @return string Part after "#".
- * @access public
- */
- function getFragment() {
- return $this->_fragment;
- }
-
- /**
- * Sets image coordinates. Set to false to clear
- * them.
- * @param integer $x Horizontal position.
- * @param integer $y Vertical position.
- * @access public
- */
- function setCoordinates($x = false, $y = false) {
- if (($x === false) || ($y === false)) {
- $this->_x = $this->_y = false;
- return;
- }
- $this->_x = (integer)$x;
- $this->_y = (integer)$y;
- }
-
- /**
- * Accessor for horizontal image coordinate.
- * @return integer X value.
- * @access public
- */
- function getX() {
- return $this->_x;
- }
-
- /**
- * Accessor for vertical image coordinate.
- * @return integer Y value.
- * @access public
- */
- function getY() {
- return $this->_y;
- }
-
- /**
- * Accessor for current request parameters
- * in URL string form. Will return teh original request
- * if at all possible even if it doesn't make much
- * sense.
- * @return string Form is string "?a=1&b=2", etc.
- * @access public
- */
- function getEncodedRequest() {
- if ($this->_raw) {
- $encoded = $this->_raw;
- } else {
- $encoded = $this->_request->asUrlRequest();
- }
- if ($encoded) {
- return '?' . preg_replace('/^\?/', '', $encoded);
- }
- return '';
- }
-
- /**
- * Adds an additional parameter to the request.
- * @param string $key Name of parameter.
- * @param string $value Value as string.
- * @access public
- */
- function addRequestParameter($key, $value) {
- $this->_raw = false;
- $this->_request->add($key, $value);
- }
-
- /**
- * Adds additional parameters to the request.
- * @param hash/SimpleFormEncoding $parameters Additional
- * parameters.
- * @access public
- */
- function addRequestParameters($parameters) {
- $this->_raw = false;
- $this->_request->merge($parameters);
- }
-
- /**
- * Clears down all parameters.
- * @access public
- */
- function clearRequest() {
- $this->_raw = false;
- $this->_request = new SimpleGetEncoding();
- }
-
- /**
- * Gets the frame target if present. Although
- * not strictly part of the URL specification it
- * acts as similarily to the browser.
- * @return boolean/string Frame name or false if none.
- * @access public
- */
- function getTarget() {
- return $this->_target;
- }
-
- /**
- * Attaches a frame target.
- * @param string $frame Name of frame.
- * @access public
- */
- function setTarget($frame) {
- $this->_raw = false;
- $this->_target = $frame;
- }
-
- /**
- * Renders the URL back into a string.
- * @return string URL in canonical form.
- * @access public
- */
- function asString() {
- $scheme = $identity = $host = $path = $encoded = $fragment = '';
- if ($this->_username && $this->_password) {
- $identity = $this->_username . ':' . $this->_password . '@';
- }
- if ($this->getHost()) {
- $scheme = $this->getScheme() ? $this->getScheme() : 'http';
- $host = $this->getHost();
- }
- if (substr($this->_path, 0, 1) == '/') {
- $path = $this->normalisePath($this->_path);
- }
- $encoded = $this->getEncodedRequest();
- $fragment = $this->getFragment() ? '#'. $this->getFragment() : '';
- $coords = $this->getX() === false ? '' : '?' . $this->getX() . ',' . $this->getY();
- return "$scheme://$identity$host$path$encoded$fragment$coords";
- }
-
- /**
- * Replaces unknown sections to turn a relative
- * URL into an absolute one. The base URL can
- * be either a string or a SimpleUrl object.
- * @param string/SimpleUrl $base Base URL.
- * @access public
- */
- function makeAbsolute($base) {
- if (! is_object($base)) {
- $base = new SimpleUrl($base);
- }
- $scheme = $this->getScheme() ? $this->getScheme() : $base->getScheme();
- if ($this->getHost()) {
- $host = $this->getHost();
- $port = $this->getPort() ? ':' . $this->getPort() : '';
- $identity = $this->getIdentity() ? $this->getIdentity() . '@' : '';
- if (! $identity) {
- $identity = $base->getIdentity() ? $base->getIdentity() . '@' : '';
- }
- } else {
- $host = $base->getHost();
- $port = $base->getPort() ? ':' . $base->getPort() : '';
- $identity = $base->getIdentity() ? $base->getIdentity() . '@' : '';
- }
- $path = $this->normalisePath($this->_extractAbsolutePath($base));
- $encoded = $this->getEncodedRequest();
- $fragment = $this->getFragment() ? '#'. $this->getFragment() : '';
- $coords = $this->getX() === false ? '' : '?' . $this->getX() . ',' . $this->getY();
- return new SimpleUrl("$scheme://$identity$host$port$path$encoded$fragment$coords");
- }
-
- /**
- * Replaces unknown sections of the path with base parts
- * to return a complete absolute one.
- * @param string/SimpleUrl $base Base URL.
- * @param string Absolute path.
- * @access private
- */
- function _extractAbsolutePath($base) {
- if ($this->getHost()) {
- return $this->_path;
- }
- if (! $this->_isRelativePath($this->_path)) {
- return $this->_path;
- }
- if ($this->_path) {
- return $base->getBasePath() . $this->_path;
- }
- return $base->getPath();
- }
-
- /**
- * Simple test to see if a path part is relative.
- * @param string $path Path to test.
- * @return boolean True if starts with a "/".
- * @access private
- */
- function _isRelativePath($path) {
- return (substr($path, 0, 1) != '/');
- }
-
- /**
- * Extracts the username and password for use in rendering
- * a URL.
- * @return string/boolean Form of username:password or false.
- * @access public
- */
- function getIdentity() {
- if ($this->_username && $this->_password) {
- return $this->_username . ':' . $this->_password;
- }
- return false;
- }
-
- /**
- * Replaces . and .. sections of the path.
- * @param string $path Unoptimised path.
- * @return string Path with dots removed if possible.
- * @access public
- */
- function normalisePath($path) {
- $path = preg_replace('|/[^/]+/\.\./|', '/', $path);
- return preg_replace('|/\./|', '/', $path);
- }
-
- /**
- * A pipe seperated list of all TLDs that result in two part
- * domain names.
- * @return string Pipe separated list.
- * @access public
- * @static
- */
- static function getAllTopLevelDomains() {
- return 'com|edu|net|org|gov|mil|int|biz|info|name|pro|aero|coop|museum';
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/user_agent.php b/tests/test_tools/simpletest/user_agent.php
deleted file mode 100644
index 161a1b68..00000000
--- a/tests/test_tools/simpletest/user_agent.php
+++ /dev/null
@@ -1,332 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: user_agent.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/cookies.php');
- require_once(dirname(__FILE__) . '/http.php');
- require_once(dirname(__FILE__) . '/encoding.php');
- require_once(dirname(__FILE__) . '/authentication.php');
- /**#@-*/
-
- if (! defined('DEFAULT_MAX_REDIRECTS')) {
- define('DEFAULT_MAX_REDIRECTS', 3);
- }
-
- if (! defined('DEFAULT_CONNECTION_TIMEOUT')) {
- define('DEFAULT_CONNECTION_TIMEOUT', 15);
- }
-
- /**
- * Fetches web pages whilst keeping track of
- * cookies and authentication.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class SimpleUserAgent {
- protected $_cookie_jar;
- protected $_cookies_enabled = true;
- protected $_authenticator;
- protected $_max_redirects = DEFAULT_MAX_REDIRECTS;
- protected $_proxy = false;
- protected $_proxy_username = false;
- protected $_proxy_password = false;
- protected $_connection_timeout = DEFAULT_CONNECTION_TIMEOUT;
- protected $_additional_headers = array();
-
- /**
- * Starts with no cookies, realms or proxies.
- * @access public
- */
- function SimpleUserAgent() {
- $this->_cookie_jar = new SimpleCookieJar();
- $this->_authenticator = new SimpleAuthenticator();
- }
-
- /**
- * Removes expired and temporary cookies as if
- * the browser was closed and re-opened. Authorisation
- * has to be obtained again as well.
- * @param string/integer $date Time when session restarted.
- * If omitted then all persistent
- * cookies are kept.
- * @access public
- */
- function restart($date = false) {
- $this->_cookie_jar->restartSession($date);
- $this->_authenticator->restartSession();
- }
-
- /**
- * Adds a header to every fetch.
- * @param string $header Header line to add to every
- * request until cleared.
- * @access public
- */
- function addHeader($header) {
- $this->_additional_headers[] = $header;
- }
-
- /**
- * Ages the cookies by the specified time.
- * @param integer $interval Amount in seconds.
- * @access public
- */
- function ageCookies($interval) {
- $this->_cookie_jar->agePrematurely($interval);
- }
-
- /**
- * Sets an additional cookie. If a cookie has
- * the same name and path it is replaced.
- * @param string $name Cookie key.
- * @param string $value Value of cookie.
- * @param string $host Host upon which the cookie is valid.
- * @param string $path Cookie path if not host wide.
- * @param string $expiry Expiry date.
- * @access public
- */
- function setCookie($name, $value, $host = false, $path = '/', $expiry = false) {
- $this->_cookie_jar->setCookie($name, $value, $host, $path, $expiry);
- }
-
- /**
- * Reads the most specific cookie value from the
- * browser cookies.
- * @param string $host Host to search.
- * @param string $path Applicable path.
- * @param string $name Name of cookie to read.
- * @return string False if not present, else the
- * value as a string.
- * @access public
- */
- function getCookieValue($host, $path, $name) {
- return $this->_cookie_jar->getCookieValue($host, $path, $name);
- }
-
- /**
- * Reads the current cookies within the base URL.
- * @param string $name Key of cookie to find.
- * @param SimpleUrl $base Base URL to search from.
- * @return string/boolean Null if there is no base URL, false
- * if the cookie is not set.
- * @access public
- */
- function getBaseCookieValue($name, $base) {
- if (! $base) {
- return null;
- }
- return $this->getCookieValue($base->getHost(), $base->getPath(), $name);
- }
-
- /**
- * Switches off cookie sending and recieving.
- * @access public
- */
- function ignoreCookies() {
- $this->_cookies_enabled = false;
- }
-
- /**
- * Switches back on the cookie sending and recieving.
- * @access public
- */
- function useCookies() {
- $this->_cookies_enabled = true;
- }
-
- /**
- * Sets the socket timeout for opening a connection.
- * @param integer $timeout Maximum time in seconds.
- * @access public
- */
- function setConnectionTimeout($timeout) {
- $this->_connection_timeout = $timeout;
- }
-
- /**
- * Sets the maximum number of redirects before
- * a page will be loaded anyway.
- * @param integer $max Most hops allowed.
- * @access public
- */
- function setMaximumRedirects($max) {
- $this->_max_redirects = $max;
- }
-
- /**
- * Sets proxy to use on all requests for when
- * testing from behind a firewall. Set URL
- * to false to disable.
- * @param string $proxy Proxy URL.
- * @param string $username Proxy username for authentication.
- * @param string $password Proxy password for authentication.
- * @access public
- */
- function useProxy($proxy, $username, $password) {
- if (! $proxy) {
- $this->_proxy = false;
- return;
- }
- if ((strncmp($proxy, 'http://', 7) != 0) && (strncmp($proxy, 'https://', 8) != 0)) {
- $proxy = 'http://'. $proxy;
- }
- $this->_proxy = new SimpleUrl($proxy);
- $this->_proxy_username = $username;
- $this->_proxy_password = $password;
- }
-
- /**
- * Test to see if the redirect limit is passed.
- * @param integer $redirects Count so far.
- * @return boolean True if over.
- * @access private
- */
- function _isTooManyRedirects($redirects) {
- return ($redirects > $this->_max_redirects);
- }
-
- /**
- * Sets the identity for the current realm.
- * @param string $host Host to which realm applies.
- * @param string $realm Full name of realm.
- * @param string $username Username for realm.
- * @param string $password Password for realm.
- * @access public
- */
- function setIdentity($host, $realm, $username, $password) {
- $this->_authenticator->setIdentityForRealm($host, $realm, $username, $password);
- }
-
- /**
- * Fetches a URL as a response object. Will keep trying if redirected.
- * It will also collect authentication realm information.
- * @param string/SimpleUrl $url Target to fetch.
- * @param SimpleEncoding $encoding Additional parameters for request.
- * @return SimpleHttpResponse Hopefully the target page.
- * @access public
- */
- function &fetchResponse($url, $encoding) {
- if ($encoding->getMethod() != 'POST') {
- $url->addRequestParameters($encoding);
- $encoding->clear();
- }
- $response = $this->_fetchWhileRedirected($url, $encoding);
- if ($headers = $response->getHeaders()) {
- if ($headers->isChallenge()) {
- $this->_authenticator->addRealm(
- $url,
- $headers->getAuthentication(),
- $headers->getRealm());
- }
- }
- return $response;
- }
-
- /**
- * Fetches the page until no longer redirected or
- * until the redirect limit runs out.
- * @param SimpleUrl $url Target to fetch.
- * @param SimpelFormEncoding $encoding Additional parameters for request.
- * @return SimpleHttpResponse Hopefully the target page.
- * @access private
- */
- function &_fetchWhileRedirected($url, $encoding) {
- $redirects = 0;
- do {
- $response = $this->_fetch($url, $encoding);
- if ($response->isError()) {
- return $response;
- }
- $headers = $response->getHeaders();
- $location = new SimpleUrl($headers->getLocation());
- $url = $location->makeAbsolute($url);
- if ($this->_cookies_enabled) {
- $headers->writeCookiesToJar($this->_cookie_jar, $url);
- }
- if (! $headers->isRedirect()) {
- break;
- }
- $encoding = new SimpleGetEncoding();
- } while (! $this->_isTooManyRedirects(++$redirects));
- return $response;
- }
-
- /**
- * Actually make the web request.
- * @param SimpleUrl $url Target to fetch.
- * @param SimpleFormEncoding $encoding Additional parameters for request.
- * @return SimpleHttpResponse Headers and hopefully content.
- * @access protected
- */
- function &_fetch($url, $encoding) {
- $request = $this->_createRequest($url, $encoding);
- $response = $request->fetch($this->_connection_timeout);
- return $response;
- }
-
- /**
- * Creates a full page request.
- * @param SimpleUrl $url Target to fetch as url object.
- * @param SimpleFormEncoding $encoding POST/GET parameters.
- * @return SimpleHttpRequest New request.
- * @access private
- */
- function &_createRequest($url, $encoding) {
- $request = $this->_createHttpRequest($url, $encoding);
- $this->_addAdditionalHeaders($request);
- if ($this->_cookies_enabled) {
- $request->readCookiesFromJar($this->_cookie_jar, $url);
- }
- $this->_authenticator->addHeaders($request, $url);
- return $request;
- }
-
- /**
- * Builds the appropriate HTTP request object.
- * @param SimpleUrl $url Target to fetch as url object.
- * @param SimpleFormEncoding $parameters POST/GET parameters.
- * @return SimpleHttpRequest New request object.
- * @access protected
- */
- function &_createHttpRequest($url, $encoding) {
- $request = new SimpleHttpRequest($this->_createRoute($url), $encoding);
- return $request;
- }
-
- /**
- * Sets up either a direct route or via a proxy.
- * @param SimpleUrl $url Target to fetch as url object.
- * @return SimpleRoute Route to take to fetch URL.
- * @access protected
- */
- function &_createRoute($url) {
- if ($this->_proxy) {
- $route = new SimpleProxyRoute(
- $url,
- $this->_proxy,
- $this->_proxy_username,
- $this->_proxy_password);
- } else {
- $route = new SimpleRoute($url);
- }
- return $route;
- }
-
- /**
- * Adds additional manual headers.
- * @param SimpleHttpRequest $request Outgoing request.
- * @access private
- */
- function _addAdditionalHeaders($request) {
- foreach ($this->_additional_headers as $header) {
- $request->addHeaderLine($header);
- }
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/web_tester.php b/tests/test_tools/simpletest/web_tester.php
deleted file mode 100644
index c6a48110..00000000
--- a/tests/test_tools/simpletest/web_tester.php
+++ /dev/null
@@ -1,1454 +0,0 @@
-<?php
- /**
- * Base include file for SimpleTest.
- * @package SimpleTest
- * @subpackage WebTester
- * @version $Id: web_tester.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/test_case.php');
- require_once(dirname(__FILE__) . '/browser.php');
- require_once(dirname(__FILE__) . '/page.php');
- require_once(dirname(__FILE__) . '/expectation.php');
- /**#@-*/
-
- /**
- * Test for an HTML widget value match.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class FieldExpectation extends SimpleExpectation {
- protected $_value;
-
- /**
- * Sets the field value to compare against.
- * @param mixed $value Test value to match. Can be an
- * expectation for say pattern matching.
- * @param string $message Optiona message override. Can use %s as
- * a placeholder for the original message.
- * @access public
- */
- function FieldExpectation($value, $message = '%s') {
- $this->SimpleExpectation($message);
- if (is_array($value)) {
- sort($value);
- }
- $this->_value = $value;
- }
-
- /**
- * Tests the expectation. True if it matches
- * a string value or an array value in any order.
- * @param mixed $compare Comparison value. False for
- * an unset field.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- if ($this->_value === false) {
- return ($compare === false);
- }
- if ($this->_isSingle($this->_value)) {
- return $this->_testSingle($compare);
- }
- if (is_array($this->_value)) {
- return $this->_testMultiple($compare);
- }
- return false;
- }
-
- /**
- * Tests for valid field comparisons with a single option.
- * @param mixed $value Value to type check.
- * @return boolean True if integer, string or float.
- * @access private
- */
- function _isSingle($value) {
- return is_string($value) || is_integer($value) || is_float($value);
- }
-
- /**
- * String comparison for simple field with a single option.
- * @param mixed $compare String to test against.
- * @returns boolean True if matching.
- * @access private
- */
- function _testSingle($compare) {
- if (is_array($compare) && count($compare) == 1) {
- $compare = $compare[0];
- }
- if (! $this->_isSingle($compare)) {
- return false;
- }
- return ($this->_value == $compare);
- }
-
- /**
- * List comparison for multivalue field.
- * @param mixed $compare List in any order to test against.
- * @returns boolean True if matching.
- * @access private
- */
- function _testMultiple($compare) {
- if (is_string($compare)) {
- $compare = array($compare);
- }
- if (! is_array($compare)) {
- return false;
- }
- sort($compare);
- return ($this->_value === $compare);
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- $dumper = $this->_getDumper();
- if (is_array($compare)) {
- sort($compare);
- }
- if ($this->test($compare)) {
- return "Field expectation [" . $dumper->describeValue($this->_value) . "]";
- } else {
- return "Field expectation [" . $dumper->describeValue($this->_value) .
- "] fails with [" .
- $this->_dumper->describeValue($compare) . "] " .
- $this->_dumper->describeDifference($this->_value, $compare);
- }
- }
- }
-
- /**
- * Test for a specific HTTP header within a header block.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class HttpHeaderExpectation extends SimpleExpectation {
- protected $_expected_header;
- protected $_expected_value;
-
- /**
- * Sets the field and value to compare against.
- * @param string $header Case insenstive trimmed header name.
- * @param mixed $value Optional value to compare. If not
- * given then any value will match. If
- * an expectation object then that will
- * be used instead.
- * @param string $message Optiona message override. Can use %s as
- * a placeholder for the original message.
- */
- function HttpHeaderExpectation($header, $value = false, $message = '%s') {
- $this->SimpleExpectation($message);
- $this->_expected_header = $this->_normaliseHeader($header);
- $this->_expected_value = $value;
- }
-
- /**
- * Accessor for aggregated object.
- * @return mixed Expectation set in constructor.
- * @access protected
- */
- function _getExpectation() {
- return $this->_expected_value;
- }
-
- /**
- * Removes whitespace at ends and case variations.
- * @param string $header Name of header.
- * @param string Trimmed and lowecased header
- * name.
- * @access private
- */
- function _normaliseHeader($header) {
- return strtolower(trim($header));
- }
-
- /**
- * Tests the expectation. True if it matches
- * a string value or an array value in any order.
- * @param mixed $compare Raw header block to search.
- * @return boolean True if header present.
- * @access public
- */
- function test($compare) {
- return is_string($this->_findHeader($compare));
- }
-
- /**
- * Searches the incoming result. Will extract the matching
- * line as text.
- * @param mixed $compare Raw header block to search.
- * @return string Matching header line.
- * @access protected
- */
- function _findHeader($compare) {
- $lines = split("\r\n", $compare);
- foreach ($lines as $line) {
- if ($this->_testHeaderLine($line)) {
- return $line;
- }
- }
- return false;
- }
-
- /**
- * Compares a single header line against the expectation.
- * @param string $line A single line to compare.
- * @return boolean True if matched.
- * @access private
- */
- function _testHeaderLine($line) {
- if (count($parsed = split(':', $line, 2)) < 2) {
- return false;
- }
- list($header, $value) = $parsed;
- if ($this->_normaliseHeader($header) != $this->_expected_header) {
- return false;
- }
- return $this->_testHeaderValue($value, $this->_expected_value);
- }
-
- /**
- * Tests the value part of the header.
- * @param string $value Value to test.
- * @param mixed $expected Value to test against.
- * @return boolean True if matched.
- * @access protected
- */
- function _testHeaderValue($value, $expected) {
- if ($expected === false) {
- return true;
- }
- if (SimpleExpectation::isExpectation($expected)) {
- return $expected->test(trim($value));
- }
- return (trim($value) == trim($expected));
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Raw header block to search.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- if (SimpleExpectation::isExpectation($this->_expected_value)) {
- $message = $this->_expected_value->testMessage($compare);
- } else {
- $message = $this->_expected_header .
- ($this->_expected_value ? ': ' . $this->_expected_value : '');
- }
- if (is_string($line = $this->_findHeader($compare))) {
- return "Searching for header [$message] found [$line]";
- } else {
- return "Failed to find header [$message]";
- }
- }
- }
-
- /**
- * Test for a specific HTTP header within a header block that
- * should not be found.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class NoHttpHeaderExpectation extends HttpHeaderExpectation {
- protected $_expected_header;
- protected $_expected_value;
-
- /**
- * Sets the field and value to compare against.
- * @param string $unwanted Case insenstive trimmed header name.
- * @param string $message Optiona message override. Can use %s as
- * a placeholder for the original message.
- */
- function NoHttpHeaderExpectation($unwanted, $message = '%s') {
- $this->HttpHeaderExpectation($unwanted, false, $message);
- }
-
- /**
- * Tests that the unwanted header is not found.
- * @param mixed $compare Raw header block to search.
- * @return boolean True if header present.
- * @access public
- */
- function test($compare) {
- return ($this->_findHeader($compare) === false);
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Raw header block to search.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- $expectation = $this->_getExpectation();
- if (is_string($line = $this->_findHeader($compare))) {
- return "Found unwanted header [$expectation] with [$line]";
- } else {
- return "Did not find unwanted header [$expectation]";
- }
- }
- }
-
- /**
- * Test for a text substring.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class TextExpectation extends SimpleExpectation {
- protected $_substring;
-
- /**
- * Sets the value to compare against.
- * @param string $substring Text to search for.
- * @param string $message Customised message on failure.
- * @access public
- */
- function TextExpectation($substring, $message = '%s') {
- $this->SimpleExpectation($message);
- $this->_substring = $substring;
- }
-
- /**
- * Accessor for the substring.
- * @return string Text to match.
- * @access protected
- */
- function _getSubstring() {
- return $this->_substring;
- }
-
- /**
- * Tests the expectation. True if the text contains the
- * substring.
- * @param string $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return (strpos($compare, $this->_substring) !== false);
- }
-
- /**
- * Returns a human readable test message.
- * @param mixed $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- if ($this->test($compare)) {
- return $this->_describeTextMatch($this->_getSubstring(), $compare);
- } else {
- $dumper = $this->_getDumper();
- return "Text [" . $this->_getSubstring() .
- "] not detected in [" .
- $dumper->describeValue($compare) . "]";
- }
- }
-
- /**
- * Describes a pattern match including the string
- * found and it's position.
- * @param string $substring Text to search for.
- * @param string $subject Subject to search.
- * @access protected
- */
- function _describeTextMatch($substring, $subject) {
- $position = strpos($subject, $substring);
- $dumper = $this->_getDumper();
- return "Text [$substring] detected at character [$position] in [" .
- $dumper->describeValue($subject) . "] in region [" .
- $dumper->clipString($subject, 100, $position) . "]";
- }
- }
-
- /**
- * Fail if a substring is detected within the
- * comparison text.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class NoTextExpectation extends TextExpectation {
-
- /**
- * Sets the reject pattern
- * @param string $substring Text to search for.
- * @param string $message Customised message on failure.
- * @access public
- */
- function NoTextExpectation($substring, $message = '%s') {
- $this->TextExpectation($substring, $message);
- }
-
- /**
- * Tests the expectation. False if the substring appears
- * in the text.
- * @param string $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function test($compare) {
- return ! parent::test($compare);
- }
-
- /**
- * Returns a human readable test message.
- * @param string $compare Comparison value.
- * @return string Description of success
- * or failure.
- * @access public
- */
- function testMessage($compare) {
- if ($this->test($compare)) {
- $dumper = $this->_getDumper();
- return "Text [" . $this->_getSubstring() .
- "] not detected in [" .
- $dumper->describeValue($compare) . "]";
- } else {
- return $this->_describeTextMatch($this->_getSubstring(), $compare);
- }
- }
- }
-
- /**
- * Test case for testing of web pages. Allows
- * fetching of pages, parsing of HTML and
- * submitting forms.
- * @package SimpleTest
- * @subpackage WebTester
- */
- class WebTestCase extends SimpleTestCase {
- protected $_browser;
- protected $_ignore_errors = false;
-
- /**
- * Creates an empty test case. Should be subclassed
- * with test methods for a functional test case.
- * @param string $label Name of test case. Will use
- * the class name if none specified.
- * @access public
- */
- function WebTestCase($label = false) {
- $this->SimpleTestCase($label);
- }
-
- /**
- * Announces the start of the test.
- * @param string $method Test method just started.
- * @access public
- */
- function before($method) {
- parent::before($method);
- $this->setBrowser($this->createBrowser());
- }
-
- /**
- * Announces the end of the test. Includes private clean up.
- * @param string $method Test method just finished.
- * @access public
- */
- function after($method) {
- $this->unsetBrowser();
- parent::after($method);
- }
-
- /**
- * Gets a current browser reference for setting
- * special expectations or for detailed
- * examination of page fetches.
- * @return SimpleBrowser Current test browser object.
- * @access public
- */
- function &getBrowser() {
- return $this->_browser;
- }
-
- /**
- * Gets a current browser reference for setting
- * special expectations or for detailed
- * examination of page fetches.
- * @param SimpleBrowser $browser New test browser object.
- * @access public
- */
- function setBrowser($browser) {
- return $this->_browser = $browser;
- }
-
- /**
- * Clears the current browser reference to help the
- * PHP garbage collector.
- * @access public
- */
- function unsetBrowser() {
- unset($this->_browser);
- }
-
- /**
- * Creates a new default web browser object.
- * Will be cleared at the end of the test method.
- * @return TestBrowser New browser.
- * @access public
- */
- function &createBrowser() {
- $browser = new SimpleBrowser();
- return $browser;
- }
-
- /**
- * Gets the last response error.
- * @return string Last low level HTTP error.
- * @access public
- */
- function getTransportError() {
- return $this->_browser->getTransportError();
- }
-
- /**
- * Accessor for the currently selected URL.
- * @return string Current location or false if
- * no page yet fetched.
- * @access public
- */
- function getUrl() {
- return $this->_browser->getUrl();
- }
-
- /**
- * Dumps the current request for debugging.
- * @access public
- */
- function showRequest() {
- $this->dump($this->_browser->getRequest());
- }
-
- /**
- * Dumps the current HTTP headers for debugging.
- * @access public
- */
- function showHeaders() {
- $this->dump($this->_browser->getHeaders());
- }
-
- /**
- * Dumps the current HTML source for debugging.
- * @access public
- */
- function showSource() {
- $this->dump($this->_browser->getContent());
- }
-
- /**
- * Dumps the visible text only for debugging.
- * @access public
- */
- function showText() {
- $this->dump(wordwrap($this->_browser->getContentAsText(), 80));
- }
-
- /**
- * Simulates the closing and reopening of the browser.
- * Temporary cookies will be discarded and timed
- * cookies will be expired if later than the
- * specified time.
- * @param string/integer $date Time when session restarted.
- * If ommitted then all persistent
- * cookies are kept. Time is either
- * Cookie format string or timestamp.
- * @access public
- */
- function restart($date = false) {
- if ($date === false) {
- $date = time();
- }
- $this->_browser->restart($date);
- }
-
- /**
- * Moves cookie expiry times back into the past.
- * Useful for testing timeouts and expiries.
- * @param integer $interval Amount to age in seconds.
- * @access public
- */
- function ageCookies($interval) {
- $this->_browser->ageCookies($interval);
- }
-
- /**
- * Disables frames support. Frames will not be fetched
- * and the frameset page will be used instead.
- * @access public
- */
- function ignoreFrames() {
- $this->_browser->ignoreFrames();
- }
-
- /**
- * Switches off cookie sending and recieving.
- * @access public
- */
- function ignoreCookies() {
- $this->_browser->ignoreCookies();
- }
-
- /**
- * Skips errors for the next request only. You might
- * want to confirm that a page is unreachable for
- * example.
- * @access public
- */
- function ignoreErrors() {
- $this->_ignore_errors = true;
- }
-
- /**
- * Issues a fail if there is a transport error anywhere
- * in the current frameset. Only one such error is
- * reported.
- * @param string/boolean $result HTML or failure.
- * @return string/boolean $result Passes through result.
- * @access private
- */
- function _failOnError($result) {
- if (! $this->_ignore_errors) {
- if ($error = $this->_browser->getTransportError()) {
- $this->fail($error);
- }
- }
- $this->_ignore_errors = false;
- return $result;
- }
-
- /**
- * Adds a header to every fetch.
- * @param string $header Header line to add to every
- * request until cleared.
- * @access public
- */
- function addHeader($header) {
- $this->_browser->addHeader($header);
- }
-
- /**
- * Sets the maximum number of redirects before
- * the web page is loaded regardless.
- * @param integer $max Maximum hops.
- * @access public
- */
- function setMaximumRedirects($max) {
- if (! $this->_browser) {
- trigger_error(
- 'Can only set maximum redirects in a test method, setUp() or tearDown()');
- }
- $this->_browser->setMaximumRedirects($max);
- }
-
- /**
- * Sets the socket timeout for opening a connection and
- * receiving at least one byte of information.
- * @param integer $timeout Maximum time in seconds.
- * @access public
- */
- function setConnectionTimeout($timeout) {
- $this->_browser->setConnectionTimeout($timeout);
- }
-
- /**
- * Sets proxy to use on all requests for when
- * testing from behind a firewall. Set URL
- * to false to disable.
- * @param string $proxy Proxy URL.
- * @param string $username Proxy username for authentication.
- * @param string $password Proxy password for authentication.
- * @access public
- */
- function useProxy($proxy, $username = false, $password = false) {
- $this->_browser->useProxy($proxy, $username, $password);
- }
-
- /**
- * Fetches a page into the page buffer. If
- * there is no base for the URL then the
- * current base URL is used. After the fetch
- * the base URL reflects the new location.
- * @param string $url URL to fetch.
- * @param hash $parameters Optional additional GET data.
- * @return boolean/string Raw page on success.
- * @access public
- */
- function get($url, $parameters = false) {
- return $this->_failOnError($this->_browser->get($url, $parameters));
- }
-
- /**
- * Fetches a page by POST into the page buffer.
- * If there is no base for the URL then the
- * current base URL is used. After the fetch
- * the base URL reflects the new location.
- * @param string $url URL to fetch.
- * @param hash $parameters Optional additional GET data.
- * @return boolean/string Raw page on success.
- * @access public
- */
- function post($url, $parameters = false) {
- return $this->_failOnError($this->_browser->post($url, $parameters));
- }
-
- /**
- * Does a HTTP HEAD fetch, fetching only the page
- * headers. The current base URL is unchanged by this.
- * @param string $url URL to fetch.
- * @param hash $parameters Optional additional GET data.
- * @return boolean True on success.
- * @access public
- */
- function head($url, $parameters = false) {
- return $this->_failOnError($this->_browser->head($url, $parameters));
- }
-
- /**
- * Equivalent to hitting the retry button on the
- * browser. Will attempt to repeat the page fetch.
- * @return boolean True if fetch succeeded.
- * @access public
- */
- function retry() {
- return $this->_failOnError($this->_browser->retry());
- }
-
- /**
- * Equivalent to hitting the back button on the
- * browser.
- * @return boolean True if history entry and
- * fetch succeeded.
- * @access public
- */
- function back() {
- return $this->_failOnError($this->_browser->back());
- }
-
- /**
- * Equivalent to hitting the forward button on the
- * browser.
- * @return boolean True if history entry and
- * fetch succeeded.
- * @access public
- */
- function forward() {
- return $this->_failOnError($this->_browser->forward());
- }
-
- /**
- * Retries a request after setting the authentication
- * for the current realm.
- * @param string $username Username for realm.
- * @param string $password Password for realm.
- * @return boolean/string HTML on successful fetch. Note
- * that authentication may still have
- * failed.
- * @access public
- */
- function authenticate($username, $password) {
- return $this->_failOnError(
- $this->_browser->authenticate($username, $password));
- }
-
- /**
- * Gets the cookie value for the current browser context.
- * @param string $name Name of cookie.
- * @return string Value of cookie or false if unset.
- * @access public
- */
- function getCookie($name) {
- return $this->_browser->getCurrentCookieValue($name);
- }
-
- /**
- * Sets a cookie in the current browser.
- * @param string $name Name of cookie.
- * @param string $value Cookie value.
- * @param string $host Host upon which the cookie is valid.
- * @param string $path Cookie path if not host wide.
- * @param string $expiry Expiry date.
- * @access public
- */
- function setCookie($name, $value, $host = false, $path = "/", $expiry = false) {
- $this->_browser->setCookie($name, $value, $host, $path, $expiry);
- }
-
- /**
- * Accessor for current frame focus. Will be
- * false if no frame has focus.
- * @return integer/string/boolean Label if any, otherwise
- * the position in the frameset
- * or false if none.
- * @access public
- */
- function getFrameFocus() {
- return $this->_browser->getFrameFocus();
- }
-
- /**
- * Sets the focus by index. The integer index starts from 1.
- * @param integer $choice Chosen frame.
- * @return boolean True if frame exists.
- * @access public
- */
- function setFrameFocusByIndex($choice) {
- return $this->_browser->setFrameFocusByIndex($choice);
- }
-
- /**
- * Sets the focus by name.
- * @param string $name Chosen frame.
- * @return boolean True if frame exists.
- * @access public
- */
- function setFrameFocus($name) {
- return $this->_browser->setFrameFocus($name);
- }
-
- /**
- * Clears the frame focus. All frames will be searched
- * for content.
- * @access public
- */
- function clearFrameFocus() {
- return $this->_browser->clearFrameFocus();
- }
-
- /**
- * Clicks a visible text item. Will first try buttons,
- * then links and then images.
- * @param string $label Visible text or alt text.
- * @return string/boolean Raw page or false.
- * @access public
- */
- function click($label) {
- return $this->_failOnError($this->_browser->click($label));
- }
-
- /**
- * Clicks the submit button by label. The owning
- * form will be submitted by this.
- * @param string $label Button label. An unlabeled
- * button can be triggered by 'Submit'.
- * @param hash $additional Additional form values.
- * @return boolean/string Page on success, else false.
- * @access public
- */
- function clickSubmit($label = 'Submit', $additional = false) {
- return $this->_failOnError(
- $this->_browser->clickSubmit($label, $additional));
- }
-
- /**
- * Clicks the submit button by name attribute. The owning
- * form will be submitted by this.
- * @param string $name Name attribute of button.
- * @param hash $additional Additional form values.
- * @return boolean/string Page on success.
- * @access public
- */
- function clickSubmitByName($name, $additional = false) {
- return $this->_failOnError(
- $this->_browser->clickSubmitByName($name, $additional));
- }
-
- /**
- * Clicks the submit button by ID attribute. The owning
- * form will be submitted by this.
- * @param string $id ID attribute of button.
- * @param hash $additional Additional form values.
- * @return boolean/string Page on success.
- * @access public
- */
- function clickSubmitById($id, $additional = false) {
- return $this->_failOnError(
- $this->_browser->clickSubmitById($id, $additional));
- }
-
- /**
- * Clicks the submit image by some kind of label. Usually
- * the alt tag or the nearest equivalent. The owning
- * form will be submitted by this. Clicking outside of
- * the boundary of the coordinates will result in
- * a failure.
- * @param string $label Alt attribute of button.
- * @param integer $x X-coordinate of imaginary click.
- * @param integer $y Y-coordinate of imaginary click.
- * @param hash $additional Additional form values.
- * @return boolean/string Page on success.
- * @access public
- */
- function clickImage($label, $x = 1, $y = 1, $additional = false) {
- return $this->_failOnError(
- $this->_browser->clickImage($label, $x, $y, $additional));
- }
-
- /**
- * Clicks the submit image by the name. Usually
- * the alt tag or the nearest equivalent. The owning
- * form will be submitted by this. Clicking outside of
- * the boundary of the coordinates will result in
- * a failure.
- * @param string $name Name attribute of button.
- * @param integer $x X-coordinate of imaginary click.
- * @param integer $y Y-coordinate of imaginary click.
- * @param hash $additional Additional form values.
- * @return boolean/string Page on success.
- * @access public
- */
- function clickImageByName($name, $x = 1, $y = 1, $additional = false) {
- return $this->_failOnError(
- $this->_browser->clickImageByName($name, $x, $y, $additional));
- }
-
- /**
- * Clicks the submit image by ID attribute. The owning
- * form will be submitted by this. Clicking outside of
- * the boundary of the coordinates will result in
- * a failure.
- * @param integer/string $id ID attribute of button.
- * @param integer $x X-coordinate of imaginary click.
- * @param integer $y Y-coordinate of imaginary click.
- * @param hash $additional Additional form values.
- * @return boolean/string Page on success.
- * @access public
- */
- function clickImageById($id, $x = 1, $y = 1, $additional = false) {
- return $this->_failOnError(
- $this->_browser->clickImageById($id, $x, $y, $additional));
- }
-
- /**
- * Submits a form by the ID.
- * @param string $id Form ID. No button information
- * is submitted this way.
- * @return boolean/string Page on success.
- * @access public
- */
- function submitFormById($id) {
- return $this->_failOnError($this->_browser->submitFormById($id));
- }
-
- /**
- * Follows a link by name. Will click the first link
- * found with this link text by default, or a later
- * one if an index is given. Match is case insensitive
- * with normalised space.
- * @param string $label Text between the anchor tags.
- * @param integer $index Link position counting from zero.
- * @return boolean/string Page on success.
- * @access public
- */
- function clickLink($label, $index = 0) {
- return $this->_failOnError($this->_browser->clickLink($label, $index));
- }
-
- /**
- * Follows a link by id attribute.
- * @param string $id ID attribute value.
- * @return boolean/string Page on success.
- * @access public
- */
- function clickLinkById($id) {
- return $this->_failOnError($this->_browser->clickLinkById($id));
- }
-
- /**
- * Will trigger a pass if the two parameters have
- * the same value only. Otherwise a fail. This
- * is for testing hand extracted text, etc.
- * @param mixed $first Value to compare.
- * @param mixed $second Value to compare.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertEqual($first, $second, $message = "%s") {
- return $this->assert(
- new EqualExpectation($first),
- $second,
- $message);
- }
-
- /**
- * Will trigger a pass if the two parameters have
- * a different value. Otherwise a fail. This
- * is for testing hand extracted text, etc.
- * @param mixed $first Value to compare.
- * @param mixed $second Value to compare.
- * @param string $message Message to display.
- * @return boolean True on pass
- * @access public
- */
- function assertNotEqual($first, $second, $message = "%s") {
- return $this->assert(
- new NotEqualExpectation($first),
- $second,
- $message);
- }
-
- /**
- * Tests for the presence of a link label. Match is
- * case insensitive with normalised space.
- * @param string $label Text between the anchor tags.
- * @param string $message Message to display. Default
- * can be embedded with %s.
- * @return boolean True if link present.
- * @access public
- */
- function assertLink($label, $message = "%s") {
- return $this->assertTrue(
- $this->_browser->isLink($label),
- sprintf($message, "Link [$label] should exist"));
- }
-
- /**
- * Tests for the non-presence of a link label. Match is
- * case insensitive with normalised space.
- * @param string/integer $label Text between the anchor tags
- * or ID attribute.
- * @param string $message Message to display. Default
- * can be embedded with %s.
- * @return boolean True if link missing.
- * @access public
- */
- function assertNoLink($label, $message = "%s") {
- return $this->assertFalse(
- $this->_browser->isLink($label),
- sprintf($message, "Link [$label] should not exist"));
- }
-
- /**
- * Tests for the presence of a link id attribute.
- * @param string $id Id attribute value.
- * @param string $message Message to display. Default
- * can be embedded with %s.
- * @return boolean True if link present.
- * @access public
- */
- function assertLinkById($id, $message = "%s") {
- return $this->assertTrue(
- $this->_browser->isLinkById($id),
- sprintf($message, "Link ID [$id] should exist"));
- }
-
- /**
- * Tests for the non-presence of a link label. Match is
- * case insensitive with normalised space.
- * @param string $id Id attribute value.
- * @param string $message Message to display. Default
- * can be embedded with %s.
- * @return boolean True if link missing.
- * @access public
- */
- function assertNoLinkById($id, $message = "%s") {
- return $this->assertFalse(
- $this->_browser->isLinkById($id),
- sprintf($message, "Link ID [$id] should not exist"));
- }
-
- /**
- * Sets all form fields with that label, or name if there
- * is no label attached.
- * @param string $name Name of field in forms.
- * @param string $value New value of field.
- * @return boolean True if field exists, otherwise false.
- * @access public
- */
- function setField($label, $value) {
- return $this->_browser->setField($label, $value);
- }
-
- /**
- * Sets all form fields with that name.
- * @param string $name Name of field in forms.
- * @param string $value New value of field.
- * @return boolean True if field exists, otherwise false.
- * @access public
- */
- function setFieldByName($name, $value) {
- return $this->_browser->setFieldByName($name, $value);
- }
-
- /**
- * Sets all form fields with that name.
- * @param string/integer $id Id of field in forms.
- * @param string $value New value of field.
- * @return boolean True if field exists, otherwise false.
- * @access public
- */
- function setFieldById($id, $value) {
- return $this->_browser->setFieldById($id, $value);
- }
-
- /**
- * Confirms that the form element is currently set
- * to the expected value. A missing form will always
- * fail. If no value is given then only the existence
- * of the field is checked.
- * @param string $name Name of field in forms.
- * @param mixed $expected Expected string/array value or
- * false for unset fields.
- * @param string $message Message to display. Default
- * can be embedded with %s.
- * @return boolean True if pass.
- * @access public
- */
- function assertField($label, $expected = true, $message = '%s') {
- $value = $this->_browser->getField($label);
- return $this->_assertFieldValue($label, $value, $expected, $message);
- }
-
- /**
- * Confirms that the form element is currently set
- * to the expected value. A missing form element will always
- * fail. If no value is given then only the existence
- * of the field is checked.
- * @param string $name Name of field in forms.
- * @param mixed $expected Expected string/array value or
- * false for unset fields.
- * @param string $message Message to display. Default
- * can be embedded with %s.
- * @return boolean True if pass.
- * @access public
- */
- function assertFieldByName($name, $expected = true, $message = '%s') {
- $value = $this->_browser->getFieldByName($name);
- return $this->_assertFieldValue($name, $value, $expected, $message);
- }
-
- /**
- * Confirms that the form element is currently set
- * to the expected value. A missing form will always
- * fail. If no ID is given then only the existence
- * of the field is checked.
- * @param string/integer $id Name of field in forms.
- * @param mixed $expected Expected string/array value or
- * false for unset fields.
- * @param string $message Message to display. Default
- * can be embedded with %s.
- * @return boolean True if pass.
- * @access public
- */
- function assertFieldById($id, $expected = true, $message = '%s') {
- $value = $this->_browser->getFieldById($id);
- return $this->_assertFieldValue($id, $value, $expected, $message);
- }
-
- /**
- * Tests the field value against the expectation.
- * @param string $identifier Name, ID or label.
- * @param mixed $value Current field value.
- * @param mixed $expected Expected value to match.
- * @param string $message Failure message.
- * @return boolean True if pass
- * @access protected
- */
- function _assertFieldValue($identifier, $value, $expected, $message) {
- if ($expected === true) {
- return $this->assertTrue(
- isset($value),
- sprintf($message, "Field [$identifier] should exist"));
- }
- if (! SimpleExpectation::isExpectation($expected)) {
- $identifier = str_replace('%', '%%', $identifier);
- $expected = new FieldExpectation(
- $expected,
- "Field [$identifier] should match with [%s]");
- }
- return $this->assert($expected, $value, $message);
- }
-
- /**
- * Checks the response code against a list
- * of possible values.
- * @param array $responses Possible responses for a pass.
- * @param string $message Message to display. Default
- * can be embedded with %s.
- * @return boolean True if pass.
- * @access public
- */
- function assertResponse($responses, $message = '%s') {
- $responses = (is_array($responses) ? $responses : array($responses));
- $code = $this->_browser->getResponseCode();
- $message = sprintf($message, "Expecting response in [" .
- implode(", ", $responses) . "] got [$code]");
- return $this->assertTrue(in_array($code, $responses), $message);
- }
-
- /**
- * Checks the mime type against a list
- * of possible values.
- * @param array $types Possible mime types for a pass.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertMime($types, $message = '%s') {
- $types = (is_array($types) ? $types : array($types));
- $type = $this->_browser->getMimeType();
- $message = sprintf($message, "Expecting mime type in [" .
- implode(", ", $types) . "] got [$type]");
- return $this->assertTrue(in_array($type, $types), $message);
- }
-
- /**
- * Attempt to match the authentication type within
- * the security realm we are currently matching.
- * @param string $authentication Usually basic.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertAuthentication($authentication = false, $message = '%s') {
- if (! $authentication) {
- $message = sprintf($message, "Expected any authentication type, got [" .
- $this->_browser->getAuthentication() . "]");
- return $this->assertTrue(
- $this->_browser->getAuthentication(),
- $message);
- } else {
- $message = sprintf($message, "Expected authentication [$authentication] got [" .
- $this->_browser->getAuthentication() . "]");
- return $this->assertTrue(
- strtolower($this->_browser->getAuthentication()) == strtolower($authentication),
- $message);
- }
- }
-
- /**
- * Checks that no authentication is necessary to view
- * the desired page.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertNoAuthentication($message = '%s') {
- $message = sprintf($message, "Expected no authentication type, got [" .
- $this->_browser->getAuthentication() . "]");
- return $this->assertFalse($this->_browser->getAuthentication(), $message);
- }
-
- /**
- * Attempts to match the current security realm.
- * @param string $realm Name of security realm.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertRealm($realm, $message = '%s') {
- if (! SimpleExpectation::isExpectation($realm)) {
- $realm = new EqualExpectation($realm);
- }
- return $this->assert(
- $realm,
- $this->_browser->getRealm(),
- "Expected realm -> $message");
- }
-
- /**
- * Checks each header line for the required value. If no
- * value is given then only an existence check is made.
- * @param string $header Case insensitive header name.
- * @param mixed $value Case sensitive trimmed string to
- * match against. An expectation object
- * can be used for pattern matching.
- * @return boolean True if pass.
- * @access public
- */
- function assertHeader($header, $value = false, $message = '%s') {
- return $this->assert(
- new HttpHeaderExpectation($header, $value),
- $this->_browser->getHeaders(),
- $message);
- }
-
- /**
- * @deprecated
- */
- function assertHeaderPattern($header, $pattern, $message = '%s') {
- return $this->assert(
- new HttpHeaderExpectation($header, new PatternExpectation($pattern)),
- $this->_browser->getHeaders(),
- $message);
- }
-
- /**
- * Confirms that the header type has not been received.
- * Only the landing page is checked. If you want to check
- * redirect pages, then you should limit redirects so
- * as to capture the page you want.
- * @param string $header Case insensitive header name.
- * @return boolean True if pass.
- * @access public
- */
- function assertNoHeader($header, $message = '%s') {
- return $this->assert(
- new NoHttpHeaderExpectation($header),
- $this->_browser->getHeaders(),
- $message);
- }
-
- /**
- * @deprecated
- */
- function assertNoUnwantedHeader($header, $message = '%s') {
- return $this->assertNoHeader($header, $message);
- }
-
- /**
- * Tests the text between the title tags.
- * @param string $title Expected title.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertTitle($title = false, $message = '%s') {
- if (! SimpleExpectation::isExpectation($title)) {
- $title = new EqualExpectation($title);
- }
- return $this->assert($title, $this->_browser->getTitle(), $message);
- }
-
- /**
- * Will trigger a pass if the text is found in the plain
- * text form of the page.
- * @param string $text Text to look for.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertText($text, $message = '%s') {
- return $this->assert(
- new TextExpectation($text),
- $this->_browser->getContentAsText(),
- $message);
- }
-
- /**
- * @deprecated
- */
- function assertWantedText($text, $message = '%s') {
- return $this->assertText($text, $message);
- }
-
- /**
- * Will trigger a pass if the text is not found in the plain
- * text form of the page.
- * @param string $text Text to look for.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertNoText($text, $message = '%s') {
- return $this->assert(
- new NoTextExpectation($text),
- $this->_browser->getContentAsText(),
- $message);
- }
-
- /**
- * @deprecated
- */
- function assertNoUnwantedText($text, $message = '%s') {
- return $this->assertNoText($text, $message);
- }
-
- /**
- * Will trigger a pass if the Perl regex pattern
- * is found in the raw content.
- * @param string $pattern Perl regex to look for including
- * the regex delimiters.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertPattern($pattern, $message = '%s') {
- return $this->assert(
- new PatternExpectation($pattern),
- $this->_browser->getContent(),
- $message);
- }
-
- /**
- * @deprecated
- */
- function assertWantedPattern($pattern, $message = '%s') {
- return $this->assertPattern($pattern, $message);
- }
-
- /**
- * Will trigger a pass if the perl regex pattern
- * is not present in raw content.
- * @param string $pattern Perl regex to look for including
- * the regex delimiters.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertNoPattern($pattern, $message = '%s') {
- return $this->assert(
- new NoPatternExpectation($pattern),
- $this->_browser->getContent(),
- $message);
- }
-
- /**
- * @deprecated
- */
- function assertNoUnwantedPattern($pattern, $message = '%s') {
- return $this->assertNoPattern($pattern, $message);
- }
-
- /**
- * Checks that a cookie is set for the current page
- * and optionally checks the value.
- * @param string $name Name of cookie to test.
- * @param string $expected Expected value as a string or
- * false if any value will do.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertCookie($name, $expected = false, $message = '%s') {
- $value = $this->getCookie($name);
- if (! $expected) {
- return $this->assertTrue(
- $value,
- sprintf($message, "Expecting cookie [$name]"));
- }
- if (! SimpleExpectation::isExpectation($expected)) {
- $expected = new EqualExpectation($expected);
- }
- return $this->assert($expected, $value, "Expecting cookie [$name] -> $message");
- }
-
- /**
- * Checks that no cookie is present or that it has
- * been successfully cleared.
- * @param string $name Name of cookie to test.
- * @param string $message Message to display.
- * @return boolean True if pass.
- * @access public
- */
- function assertNoCookie($name, $message = '%s') {
- return $this->assertTrue(
- $this->getCookie($name) === false,
- sprintf($message, "Not expecting cookie [$name]"));
- }
- } \ No newline at end of file
diff --git a/tests/test_tools/simpletest/xml.php b/tests/test_tools/simpletest/xml.php
deleted file mode 100644
index 54b53011..00000000
--- a/tests/test_tools/simpletest/xml.php
+++ /dev/null
@@ -1,613 +0,0 @@
-<?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: xml.php 1398 2006-09-08 19:31:03Z xue $
- */
-
- /**#@+
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/scorer.php');
- /**#@-*/
-
- /**
- * Creates the XML needed for remote communication
- * by SimpleTest.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class XmlReporter extends SimpleReporter {
- protected $_indent;
- protected $_namespace;
-
- /**
- * Does nothing yet.
- * @access public
- */
- function XmlReporter($namespace = false, $indent = ' ') {
- $this->SimpleReporter();
- $this->_namespace = ($namespace ? $namespace . ':' : '');
- $this->_indent = $indent;
- }
-
- /**
- * Calculates the pretty printing indent level
- * from the current level of nesting.
- * @param integer $offset Extra indenting level.
- * @return string Leading space.
- * @access protected
- */
- function _getIndent($offset = 0) {
- return str_repeat(
- $this->_indent,
- count($this->getTestList()) + $offset);
- }
-
- /**
- * Converts character string to parsed XML
- * entities string.
- * @param string text Unparsed character data.
- * @return string Parsed character data.
- * @access public
- */
- function toParsedXml($text) {
- return str_replace(
- array('&', '<', '>', '"', '\''),
- array('&amp;', '&lt;', '&gt;', '&quot;', '&apos;'),
- $text);
- }
-
- /**
- * Paints the start of a group test.
- * @param string $test_name Name of test that is starting.
- * @param integer $size Number of test cases starting.
- * @access public
- */
- function paintGroupStart($test_name, $size) {
- parent::paintGroupStart($test_name, $size);
- print $this->_getIndent();
- print "<" . $this->_namespace . "group size=\"$size\">\n";
- print $this->_getIndent(1);
- print "<" . $this->_namespace . "name>" .
- $this->toParsedXml($test_name) .
- "</" . $this->_namespace . "name>\n";
- }
-
- /**
- * Paints the end of a group test.
- * @param string $test_name Name of test that is ending.
- * @access public
- */
- function paintGroupEnd($test_name) {
- print $this->_getIndent();
- print "</" . $this->_namespace . "group>\n";
- parent::paintGroupEnd($test_name);
- }
-
- /**
- * Paints the start of a test case.
- * @param string $test_name Name of test that is starting.
- * @access public
- */
- function paintCaseStart($test_name) {
- parent::paintCaseStart($test_name);
- print $this->_getIndent();
- print "<" . $this->_namespace . "case>\n";
- print $this->_getIndent(1);
- print "<" . $this->_namespace . "name>" .
- $this->toParsedXml($test_name) .
- "</" . $this->_namespace . "name>\n";
- }
-
- /**
- * Paints the end of a test case.
- * @param string $test_name Name of test that is ending.
- * @access public
- */
- function paintCaseEnd($test_name) {
- print $this->_getIndent();
- print "</" . $this->_namespace . "case>\n";
- parent::paintCaseEnd($test_name);
- }
-
- /**
- * Paints the start of a test method.
- * @param string $test_name Name of test that is starting.
- * @access public
- */
- function paintMethodStart($test_name) {
- parent::paintMethodStart($test_name);
- print $this->_getIndent();
- print "<" . $this->_namespace . "test>\n";
- print $this->_getIndent(1);
- print "<" . $this->_namespace . "name>" .
- $this->toParsedXml($test_name) .
- "</" . $this->_namespace . "name>\n";
- }
-
- /**
- * Paints the end of a test method.
- * @param string $test_name Name of test that is ending.
- * @param integer $progress Number of test cases ending.
- * @access public
- */
- function paintMethodEnd($test_name) {
- print $this->_getIndent();
- print "</" . $this->_namespace . "test>\n";
- parent::paintMethodEnd($test_name);
- }
-
- /**
- * Increments the pass count.
- * @param string $message Message is ignored.
- * @access public
- */
- function paintPass($message) {
- parent::paintPass($message);
- print $this->_getIndent(1);
- print "<" . $this->_namespace . "pass>";
- print $this->toParsedXml($message);
- print "</" . $this->_namespace . "pass>\n";
- }
-
- /**
- * Increments the fail count.
- * @param string $message Message is ignored.
- * @access public
- */
- function paintFail($message) {
- parent::paintFail($message);
- print $this->_getIndent(1);
- print "<" . $this->_namespace . "fail>";
- print $this->toParsedXml($message);
- print "</" . $this->_namespace . "fail>\n";
- }
-
- /**
- * Paints a PHP error or exception.
- * @param string $message Message is ignored.
- * @access public
- * @abstract
- */
- function paintError($message) {
- parent::paintError($message);
- print $this->_getIndent(1);
- print "<" . $this->_namespace . "exception>";
- print $this->toParsedXml($message);
- print "</" . $this->_namespace . "exception>\n";
- }
-
- /**
- * Paints a simple supplementary message.
- * @param string $message Text to display.
- * @access public
- */
- function paintMessage($message) {
- parent::paintMessage($message);
- print $this->_getIndent(1);
- print "<" . $this->_namespace . "message>";
- print $this->toParsedXml($message);
- print "</" . $this->_namespace . "message>\n";
- }
-
- /**
- * Paints a formatted ASCII message such as a
- * variable dump.
- * @param string $message Text to display.
- * @access public
- */
- function paintFormattedMessage($message) {
- parent::paintFormattedMessage($message);
- print $this->_getIndent(1);
- print "<" . $this->_namespace . "formatted>";
- print "<![CDATA[$message]]>";
- print "</" . $this->_namespace . "formatted>\n";
- }
-
- /**
- * Serialises the event object.
- * @param string $type Event type as text.
- * @param mixed $payload Message or object.
- * @access public
- */
- function paintSignal($type, $payload) {
- parent::paintSignal($type, $payload);
- print $this->_getIndent(1);
- print "<" . $this->_namespace . "signal type=\"$type\">";
- print "<![CDATA[" . serialize($payload) . "]]>";
- print "</" . $this->_namespace . "signal>\n";
- }
-
- /**
- * Paints the test document header.
- * @param string $test_name First test top level
- * to start.
- * @access public
- * @abstract
- */
- function paintHeader($test_name) {
- if (! SimpleReporter::inCli()) {
- header('Content-type: text/xml');
- }
- print "<?xml version=\"1.0\"";
- if ($this->_namespace) {
- print " xmlns:" . $this->_namespace .
- "=\"www.lastcraft.com/SimpleTest/Beta3/Report\"";
- }
- print "?>\n";
- print "<" . $this->_namespace . "run>\n";
- }
-
- /**
- * Paints the test document footer.
- * @param string $test_name The top level test.
- * @access public
- * @abstract
- */
- function paintFooter($test_name) {
- print "</" . $this->_namespace . "run>\n";
- }
- }
-
- /**
- * Accumulator for incoming tag. Holds the
- * incoming test structure information for
- * later dispatch to the reporter.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class NestingXmlTag {
- protected $_name;
- protected $_attributes;
-
- /**
- * Sets the basic test information except
- * the name.
- * @param hash $attributes Name value pairs.
- * @access public
- */
- function NestingXmlTag($attributes) {
- $this->_name = false;
- $this->_attributes = $attributes;
- }
-
- /**
- * Sets the test case/method name.
- * @param string $name Name of test.
- * @access public
- */
- function setName($name) {
- $this->_name = $name;
- }
-
- /**
- * Accessor for name.
- * @return string Name of test.
- * @access public
- */
- function getName() {
- return $this->_name;
- }
-
- /**
- * Accessor for attributes.
- * @return hash All attributes.
- * @access protected
- */
- function _getAttributes() {
- return $this->_attributes;
- }
- }
-
- /**
- * Accumulator for incoming method tag. Holds the
- * incoming test structure information for
- * later dispatch to the reporter.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class NestingMethodTag extends NestingXmlTag {
-
- /**
- * Sets the basic test information except
- * the name.
- * @param hash $attributes Name value pairs.
- * @access public
- */
- function NestingMethodTag($attributes) {
- $this->NestingXmlTag($attributes);
- }
-
- /**
- * Signals the appropriate start event on the
- * listener.
- * @param SimpleReporter $listener Target for events.
- * @access public
- */
- function paintStart($listener) {
- $listener->paintMethodStart($this->getName());
- }
-
- /**
- * Signals the appropriate end event on the
- * listener.
- * @param SimpleReporter $listener Target for events.
- * @access public
- */
- function paintEnd($listener) {
- $listener->paintMethodEnd($this->getName());
- }
- }
-
- /**
- * Accumulator for incoming case tag. Holds the
- * incoming test structure information for
- * later dispatch to the reporter.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class NestingCaseTag extends NestingXmlTag {
-
- /**
- * Sets the basic test information except
- * the name.
- * @param hash $attributes Name value pairs.
- * @access public
- */
- function NestingCaseTag($attributes) {
- $this->NestingXmlTag($attributes);
- }
-
- /**
- * Signals the appropriate start event on the
- * listener.
- * @param SimpleReporter $listener Target for events.
- * @access public
- */
- function paintStart($listener) {
- $listener->paintCaseStart($this->getName());
- }
-
- /**
- * Signals the appropriate end event on the
- * listener.
- * @param SimpleReporter $listener Target for events.
- * @access public
- */
- function paintEnd($listener) {
- $listener->paintCaseEnd($this->getName());
- }
- }
-
- /**
- * Accumulator for incoming group tag. Holds the
- * incoming test structure information for
- * later dispatch to the reporter.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class NestingGroupTag extends NestingXmlTag {
-
- /**
- * Sets the basic test information except
- * the name.
- * @param hash $attributes Name value pairs.
- * @access public
- */
- function NestingGroupTag($attributes) {
- $this->NestingXmlTag($attributes);
- }
-
- /**
- * Signals the appropriate start event on the
- * listener.
- * @param SimpleReporter $listener Target for events.
- * @access public
- */
- function paintStart($listener) {
- $listener->paintGroupStart($this->getName(), $this->getSize());
- }
-
- /**
- * Signals the appropriate end event on the
- * listener.
- * @param SimpleReporter $listener Target for events.
- * @access public
- */
- function paintEnd($listener) {
- $listener->paintGroupEnd($this->getName());
- }
-
- /**
- * The size in the attributes.
- * @return integer Value of size attribute or zero.
- * @access public
- */
- function getSize() {
- $attributes = $this->_getAttributes();
- if (isset($attributes['SIZE'])) {
- return (integer)$attributes['SIZE'];
- }
- return 0;
- }
- }
-
- /**
- * Parser for importing the output of the XmlReporter.
- * Dispatches that output to another reporter.
- * @package SimpleTest
- * @subpackage UnitTester
- */
- class SimpleTestXmlParser {
- protected $_listener;
- protected $_expat;
- protected $_tag_stack;
- protected $_in_content_tag;
- protected $_content;
- protected $_attributes;
-
- /**
- * Loads a listener with the SimpleReporter
- * interface.
- * @param SimpleReporter $listener Listener of tag events.
- * @access public
- */
- function SimpleTestXmlParser($listener) {
- $this->_listener = $listener;
- $this->_expat = $this->_createParser();
- $this->_tag_stack = array();
- $this->_in_content_tag = false;
- $this->_content = '';
- $this->_attributes = array();
- }
-
- /**
- * Parses a block of XML sending the results to
- * the listener.
- * @param string $chunk Block of text to read.
- * @return boolean True if valid XML.
- * @access public
- */
- function parse($chunk) {
- if (! xml_parse($this->_expat, $chunk)) {
- trigger_error('XML parse error with ' .
- xml_error_string(xml_get_error_code($this->_expat)));
- return false;
- }
- return true;
- }
-
- /**
- * Sets up expat as the XML parser.
- * @return resource Expat handle.
- * @access protected
- */
- function &_createParser() {
- $expat = xml_parser_create();
- xml_set_object($expat, $this);
- xml_set_element_handler($expat, '_startElement', '_endElement');
- xml_set_character_data_handler($expat, '_addContent');
- xml_set_default_handler($expat, '_default');
- return $expat;
- }
-
- /**
- * Opens a new test nesting level.
- * @return NestedXmlTag The group, case or method tag
- * to start.
- * @access private
- */
- function _pushNestingTag($nested) {
- array_unshift($this->_tag_stack, $nested);
- }
-
- /**
- * Accessor for current test structure tag.
- * @return NestedXmlTag The group, case or method tag
- * being parsed.
- * @access private
- */
- function &_getCurrentNestingTag() {
- return $this->_tag_stack[0];
- }
-
- /**
- * Ends a nesting tag.
- * @return NestedXmlTag The group, case or method tag
- * just finished.
- * @access private
- */
- function _popNestingTag() {
- return array_shift($this->_tag_stack);
- }
-
- /**
- * Test if tag is a leaf node with only text content.
- * @param string $tag XML tag name.
- * @return @boolean True if leaf, false if nesting.
- * @private
- */
- function _isLeaf($tag) {
- return in_array($tag, array(
- 'NAME', 'PASS', 'FAIL', 'EXCEPTION', 'MESSAGE', 'FORMATTED', 'SIGNAL'));
- }
-
- /**
- * Handler for start of event element.
- * @param resource $expat Parser handle.
- * @param string $tag Element name.
- * @param hash $attributes Name value pairs.
- * Attributes without content
- * are marked as true.
- * @access protected
- */
- function _startElement($expat, $tag, $attributes) {
- $this->_attributes = $attributes;
- if ($tag == 'GROUP') {
- $this->_pushNestingTag(new NestingGroupTag($attributes));
- } elseif ($tag == 'CASE') {
- $this->_pushNestingTag(new NestingCaseTag($attributes));
- } elseif ($tag == 'TEST') {
- $this->_pushNestingTag(new NestingMethodTag($attributes));
- } elseif ($this->_isLeaf($tag)) {
- $this->_in_content_tag = true;
- $this->_content = '';
- }
- }
-
- /**
- * End of element event.
- * @param resource $expat Parser handle.
- * @param string $tag Element name.
- * @access protected
- */
- function _endElement($expat, $tag) {
- $this->_in_content_tag = false;
- if (in_array($tag, array('GROUP', 'CASE', 'TEST'))) {
- $nesting_tag = $this->_popNestingTag();
- $nesting_tag->paintEnd($this->_listener);
- } elseif ($tag == 'NAME') {
- $nesting_tag = $this->_getCurrentNestingTag();
- $nesting_tag->setName($this->_content);
- $nesting_tag->paintStart($this->_listener);
- } elseif ($tag == 'PASS') {
- $this->_listener->paintPass($this->_content);
- } elseif ($tag == 'FAIL') {
- $this->_listener->paintFail($this->_content);
- } elseif ($tag == 'EXCEPTION') {
- $this->_listener->paintError($this->_content);
- } elseif ($tag == 'SIGNAL') {
- $this->_listener->paintSignal(
- $this->_attributes['TYPE'],
- unserialize($this->_content));
- } elseif ($tag == 'MESSAGE') {
- $this->_listener->paintMessage($this->_content);
- } elseif ($tag == 'FORMATTED') {
- $this->_listener->paintFormattedMessage($this->_content);
- }
- }
-
- /**
- * Content between start and end elements.
- * @param resource $expat Parser handle.
- * @param string $text Usually output messages.
- * @access protected
- */
- function _addContent($expat, $text) {
- if ($this->_in_content_tag) {
- $this->_content .= $text;
- }
- return true;
- }
-
- /**
- * XML and Doctype handler. Discards all such content.
- * @param resource $expat Parser handle.
- * @param string $default Text of default content.
- * @access protected
- */
- function _default($expat, $default) {
- }
- }
diff --git a/tests/unit/AllTests.php b/tests/unit/AllTests.php
index eb08a5f7..f802fdc2 100644
--- a/tests/unit/AllTests.php
+++ b/tests/unit/AllTests.php
@@ -15,6 +15,7 @@ require_once 'Security/AllTests.php';
require_once 'Caching/AllTests.php';
require_once 'Util/AllTests.php';
require_once 'Data/DataGateway/AllTests.php';
+require_once 'Data/ActiveRecord/AllTests.php';
require_once 'Data/SqlMap/AllTests.php';
@@ -39,6 +40,7 @@ class AllTests {
$suite->addTest(Caching_AllTests::suite());
$suite->addTest(Util_AllTests::suite());
$suite->addTest(Data_DataGateway_AllTests::suite());
+ $suite->addTest(Data_ActiveRecord_AllTests::suite());
$suite->addTest(Data_SqlMap_AllTests::suite());
$suite->addTestSuite('TComponentTest');
diff --git a/tests/unit/Caching/AllTests.php b/tests/unit/Caching/AllTests.php
deleted file mode 100644
index 179840fc..00000000
--- a/tests/unit/Caching/AllTests.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Caching_AllTests::main');
-}
-
-require_once 'TSqliteCacheTest.php';
-require_once 'TAPCCacheTest.php';
-require_once 'TMemCacheTest.php';
-
-class Caching_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Caching');
-
- $suite->addTestSuite('TSqliteCacheTest');
- $suite->addTestSuite('TAPCCacheTest');
- $suite->addTestSuite('TMemCacheTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Caching_AllTests::main') {
- Caching_AllTests::main();
-}
diff --git a/tests/unit/Collections/AllTests.php b/tests/unit/Collections/AllTests.php
deleted file mode 100644
index 3c286132..00000000
--- a/tests/unit/Collections/AllTests.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Collections_AllTests::main');
-}
-
-require_once 'TListTest.php';
-require_once 'TMapTest.php';
-require_once 'TQueueTest.php';
-require_once 'TStackTest.php';
-require_once 'TAttributeCollectionTest.php';
-require_once 'TPagedListTest.php';
-require_once 'TPagedDataSourceTest.php';
-
-class Collections_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Collections');
-
- $suite->addTestSuite('TListTest');
- $suite->addTestSuite('TMapTest');
- $suite->addTestSuite('TQueueTest');
- $suite->addTestSuite('TStackTest');
- $suite->addTestSuite('TAttributeCollectionTest');
- $suite->addTestSuite('TPagedListTest');
- $suite->addTestSuite('TPagedDataSourceTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Collections_AllTests::main') {
- Collections_AllTests::main();
-}
diff --git a/tests/simple_unit/ActiveRecord/ActiveRecordDynamicCallTestCase.php b/tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php
index 58c9977a..1bf98415 100644
--- a/tests/simple_unit/ActiveRecord/ActiveRecordDynamicCallTestCase.php
+++ b/tests/unit/Data/ActiveRecord/ActiveRecordDynamicCallTest.php
@@ -3,7 +3,10 @@ Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/DepartmentRecord.php');
require_once(dirname(__FILE__).'/records/DepSections.php');
-class ActiveRecordDynamicCallTestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class ActiveRecordDynamicCallTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/ActiveRecordFinderTestCase.php b/tests/unit/Data/ActiveRecord/ActiveRecordFinderTest.php
index d9bd7420..2209fc6a 100644
--- a/tests/simple_unit/ActiveRecord/ActiveRecordFinderTestCase.php
+++ b/tests/unit/Data/ActiveRecord/ActiveRecordFinderTest.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/DepartmentRecord.php');
-class ActiveRecordFinderTestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class ActiveRecordFinderTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/ActiveRecordMySql5TestCase.php b/tests/unit/Data/ActiveRecord/ActiveRecordMySql5Test.php
index 09981f43..31cbed5c 100644
--- a/tests/simple_unit/ActiveRecord/ActiveRecordMySql5TestCase.php
+++ b/tests/unit/Data/ActiveRecord/ActiveRecordMySql5Test.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/Blogs.php');
-class ActiveRecordMySql5TestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class ActiveRecordMySql5Test extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/BaseActiveRecordTestCase.php b/tests/unit/Data/ActiveRecord/BaseActiveRecordTest.php
index 676a0dd0..258fe70c 100644
--- a/tests/simple_unit/ActiveRecord/BaseActiveRecordTestCase.php
+++ b/tests/unit/Data/ActiveRecord/BaseActiveRecordTest.php
@@ -1,12 +1,15 @@
<?php
Prado::using('System.Data.ActiveRecord.TActiveRecord');
+/**
+ * @package System.Data.ActiveRecord
+ */
class BaseRecordTest extends TActiveRecord
{
}
-class BaseActiveRecordTestCase extends UnitTestCase
+class BaseActiveRecordTest extends PHPUnit_Framework_TestCase
{
function test_finder_returns_same_instance()
{
diff --git a/tests/simple_unit/ActiveRecord/CountRecordsTestCase.php b/tests/unit/Data/ActiveRecord/CountRecordsTest.php
index 36a96ab6..b97f83ed 100644
--- a/tests/simple_unit/ActiveRecord/CountRecordsTestCase.php
+++ b/tests/unit/Data/ActiveRecord/CountRecordsTest.php
@@ -3,7 +3,10 @@
Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/DepartmentRecord.php');
-class CountRecordsTestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class CountRecordsTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/CriteriaTestCase.php b/tests/unit/Data/ActiveRecord/CriteriaTest.php
index a320f38c..3c4c15d7 100644
--- a/tests/simple_unit/ActiveRecord/CriteriaTestCase.php
+++ b/tests/unit/Data/ActiveRecord/CriteriaTest.php
@@ -4,7 +4,10 @@ Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/DepartmentRecord.php');
require_once(dirname(__FILE__).'/records/DepSections.php');
-class CriteriaTestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class CriteriaTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/DeleteByPkTestCase.php b/tests/unit/Data/ActiveRecord/DeleteByPkTest.php
index 0c09a9b0..2f2c09c9 100644
--- a/tests/simple_unit/ActiveRecord/DeleteByPkTestCase.php
+++ b/tests/unit/Data/ActiveRecord/DeleteByPkTest.php
@@ -4,7 +4,10 @@ Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/DepartmentRecord.php');
require_once(dirname(__FILE__).'/records/DepSections.php');
-class DeleteByPkTestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class DeleteByPkTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/FindByPksTestCase.php b/tests/unit/Data/ActiveRecord/FindByPksTest.php
index 32a79cea..8235352c 100644
--- a/tests/simple_unit/ActiveRecord/FindByPksTestCase.php
+++ b/tests/unit/Data/ActiveRecord/FindByPksTest.php
@@ -3,7 +3,10 @@ Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/DepartmentRecord.php');
require_once(dirname(__FILE__).'/records/DepSections.php');
-class FindByPksTestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class FindByPksTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/FindBySqlTestCase.php b/tests/unit/Data/ActiveRecord/FindBySqlTest.php
index 14da0833..98113b06 100644
--- a/tests/simple_unit/ActiveRecord/FindBySqlTestCase.php
+++ b/tests/unit/Data/ActiveRecord/FindBySqlTest.php
@@ -3,6 +3,9 @@ Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/DepartmentRecord.php');
require_once(dirname(__FILE__).'/records/UserRecord.php');
+/**
+ * @package System.Data.ActiveRecord
+ */
class UserRecord2 extends UserRecord
{
public $another_value;
@@ -16,7 +19,7 @@ class SqlTest extends TActiveRecord
const TABLE='items';
}
-class FindBySqlTestCase extends UnitTestCase
+class FindBySqlTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/ForeignKeyTestCase.php b/tests/unit/Data/ActiveRecord/ForeignKeyTest.php
index 86462ca6..99c8b527 100644
--- a/tests/simple_unit/ActiveRecord/ForeignKeyTestCase.php
+++ b/tests/unit/Data/ActiveRecord/ForeignKeyTest.php
@@ -3,6 +3,9 @@
Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/ItemRecord.php');
+/**
+ * @package System.Data.ActiveRecord
+ */
abstract class SqliteRecord extends TActiveRecord
{
protected static $conn;
@@ -77,7 +80,7 @@ class Cover extends SqliteRecord
public $content;
}
-class ForeignKeyTestCase extends UnitTestCase
+class ForeignKeyTest extends PHPUnit_Framework_TestCase
{
function test_has_many()
{
diff --git a/tests/simple_unit/ActiveRecord/ForeignObjectUpdateTest.php b/tests/unit/Data/ActiveRecord/ForeignObjectUpdateTest.php
index 29fbff42..8b9d0673 100644
--- a/tests/simple_unit/ActiveRecord/ForeignObjectUpdateTest.php
+++ b/tests/unit/Data/ActiveRecord/ForeignObjectUpdateTest.php
@@ -1,6 +1,9 @@
<?php
Prado::using('System.Data.ActiveRecord.TActiveRecord');
+/**
+ * @package System.Data.ActiveRecord
+ */
class BaseFkRecord extends TActiveRecord
{
public function getDbConnection()
@@ -123,7 +126,7 @@ class SkillRecord extends BaseFkRecord
}
-class ForeignObjectUpdateTest extends UnitTestCase
+class ForeignObjectUpdateTest extends PHPUnit_Framework_TestCase
{
function test_add_has_one()
{
diff --git a/tests/simple_unit/ActiveRecord/MultipleForeignKeyTestCase.php b/tests/unit/Data/ActiveRecord/MultipleForeignKeyTest.php
index 4b149503..d8c54b03 100644
--- a/tests/simple_unit/ActiveRecord/MultipleForeignKeyTestCase.php
+++ b/tests/unit/Data/ActiveRecord/MultipleForeignKeyTest.php
@@ -2,6 +2,9 @@
Prado::using('System.Data.ActiveRecord.TActiveRecord');
+/**
+ * @package System.Data.ActiveRecord
+ */
abstract class MultipleFKSqliteRecord extends TActiveRecord
{
protected static $conn;
@@ -86,7 +89,7 @@ class Table2 extends MultipleFKSqliteRecord
}
-class Category extends MultipleFKSqliteRecord
+class CategoryX extends MultipleFKSqliteRecord
{
public $cat_id;
public $category_name;
@@ -97,8 +100,8 @@ class Category extends MultipleFKSqliteRecord
public static $RELATIONS=array
(
- 'parent_category' => array(self::BELONGS_TO, 'Category'),
- 'child_categories' => array(self::HAS_MANY, 'Category'),
+ 'parent_category' => array(self::BELONGS_TO, 'CategoryX'),
+ 'child_categories' => array(self::HAS_MANY, 'CategoryX'),
);
public static function finder($class=__CLASS__)
@@ -107,7 +110,7 @@ class Category extends MultipleFKSqliteRecord
}
}
-class MultipleForeignKeyTestCase extends UnitTestCase
+class MultipleForeignKeyTest extends PHPUnit_Framework_TestCase
{
function testBelongsTo()
{
@@ -163,7 +166,7 @@ class MultipleForeignKeyTestCase extends UnitTestCase
function testParentChild()
{
- $obj = Category::finder()->withChild_Categories()->withParent_Category()->findByPk(2);
+ $obj = CategoryX::finder()->withChild_Categories()->withParent_Category()->findByPk(2);
$this->assertEqual($obj->cat_id, '2');
$this->assertEqual(count($obj->child_categories), 2);
diff --git a/tests/simple_unit/ActiveRecord/RecordEventTestCase.php b/tests/unit/Data/ActiveRecord/RecordEventTest.php
index 12c57421..0114e0a4 100644
--- a/tests/simple_unit/ActiveRecord/RecordEventTestCase.php
+++ b/tests/unit/Data/ActiveRecord/RecordEventTest.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/UserRecord.php');
-class RecordEventTestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class RecordEventTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/SqliteTestCase.php b/tests/unit/Data/ActiveRecord/SqliteTest.php
index ed0ea496..c7f8f515 100644
--- a/tests/simple_unit/ActiveRecord/SqliteTestCase.php
+++ b/tests/unit/Data/ActiveRecord/SqliteTest.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/SqliteUsers.php');
-class SqliteTestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class SqliteTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/UserRecordTestCase.php b/tests/unit/Data/ActiveRecord/UserRecordTest.php
index 85b12594..c582e95b 100644
--- a/tests/simple_unit/ActiveRecord/UserRecordTestCase.php
+++ b/tests/unit/Data/ActiveRecord/UserRecordTest.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/UserRecord.php');
-class UserRecordTestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class UserRecordTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/ViewRecordTestCase.php b/tests/unit/Data/ActiveRecord/ViewRecordTest.php
index bb13a96f..f319e45f 100644
--- a/tests/simple_unit/ActiveRecord/ViewRecordTestCase.php
+++ b/tests/unit/Data/ActiveRecord/ViewRecordTest.php
@@ -4,7 +4,10 @@
Prado::using('System.Data.ActiveRecord.TActiveRecord');
require_once(dirname(__FILE__).'/records/SimpleUser.php');
-class ViewRecordTestCase extends UnitTestCase
+/**
+ * @package System.Data.ActiveRecord
+ */
+class ViewRecordTest extends PHPUnit_Framework_TestCase
{
function setup()
{
diff --git a/tests/simple_unit/ActiveRecord/ar_test.db b/tests/unit/Data/ActiveRecord/ar_test.db
index 7549bb66..7549bb66 100644
--- a/tests/simple_unit/ActiveRecord/ar_test.db
+++ b/tests/unit/Data/ActiveRecord/ar_test.db
Binary files differ
diff --git a/tests/simple_unit/ActiveRecord/blog.db b/tests/unit/Data/ActiveRecord/blog.db
index 30a9cb7a..30a9cb7a 100644
--- a/tests/simple_unit/ActiveRecord/blog.db
+++ b/tests/unit/Data/ActiveRecord/blog.db
Binary files differ
diff --git a/tests/simple_unit/ActiveRecord/fk_tests.db b/tests/unit/Data/ActiveRecord/fk_tests.db
index 87835c84..87835c84 100644
--- a/tests/simple_unit/ActiveRecord/fk_tests.db
+++ b/tests/unit/Data/ActiveRecord/fk_tests.db
Binary files differ
diff --git a/tests/simple_unit/ActiveRecord/mysql4text.sql b/tests/unit/Data/ActiveRecord/mysql4text.sql
index 4d61bc81..03d2c010 100644
--- a/tests/simple_unit/ActiveRecord/mysql4text.sql
+++ b/tests/unit/Data/ActiveRecord/mysql4text.sql
@@ -1,52 +1,52 @@
-CREATE TABLE album (
- title varchar(100) NOT NULL default '',
- PRIMARY KEY (title)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE artist (
- name varchar(25) NOT NULL default '',
- PRIMARY KEY (name)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE album_artists (
- album_title varchar(100) NOT NULL default '',
- artist_name varchar(25) NOT NULL default '',
- PRIMARY KEY (album_title,artist_name),
- KEY FK_album_artists_2 (artist_name)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE track (
- id int(11) NOT NULL auto_increment,
- song_name varchar(200) NOT NULL default '',
- album_id varchar(100) NOT NULL default '',
- PRIMARY KEY (id),
- KEY album_id (album_id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-ALTER TABLE album_artists
- ADD CONSTRAINT FK_album_artists_2 FOREIGN KEY (artist_name) REFERENCES artist (name),
- ADD CONSTRAINT FK_album_artists_1 FOREIGN KEY (album_title) REFERENCES album (title);
-
-ALTER TABLE track
- ADD CONSTRAINT track_ibfk_1 FOREIGN KEY (album_id) REFERENCES album (title);
-
-
-INSERT INTO album (title) VALUES ('Album 1');
-INSERT INTO album (title) VALUES ('Album 2');
-
-INSERT INTO artist (name) VALUES ('Dan');
-INSERT INTO artist (name) VALUES ('Jenny');
-INSERT INTO artist (name) VALUES ('Karl');
-INSERT INTO artist (name) VALUES ('Tom');
-
-INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 1', 'Dan');
-INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Dan');
-INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 1', 'Jenny');
-INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Karl');
-INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Tom');
-
-INSERT INTO track (id, song_name, album_id) VALUES (1, 'Track 1', 'Album 1');
-INSERT INTO track (id, song_name, album_id) VALUES (2, 'Song 2', 'Album 1');
-INSERT INTO track (id, song_name, album_id) VALUES (3, 'Track A', 'Album 2');
-INSERT INTO track (id, song_name, album_id) VALUES (4, 'Track B', 'Album 2');
+CREATE TABLE album (
+ title varchar(100) NOT NULL default '',
+ PRIMARY KEY (title)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE artist (
+ name varchar(25) NOT NULL default '',
+ PRIMARY KEY (name)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE album_artists (
+ album_title varchar(100) NOT NULL default '',
+ artist_name varchar(25) NOT NULL default '',
+ PRIMARY KEY (album_title,artist_name),
+ KEY FK_album_artists_2 (artist_name)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE track (
+ id int(11) NOT NULL auto_increment,
+ song_name varchar(200) NOT NULL default '',
+ album_id varchar(100) NOT NULL default '',
+ PRIMARY KEY (id),
+ KEY album_id (album_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+ALTER TABLE album_artists
+ ADD CONSTRAINT FK_album_artists_2 FOREIGN KEY (artist_name) REFERENCES artist (name),
+ ADD CONSTRAINT FK_album_artists_1 FOREIGN KEY (album_title) REFERENCES album (title);
+
+ALTER TABLE track
+ ADD CONSTRAINT track_ibfk_1 FOREIGN KEY (album_id) REFERENCES album (title);
+
+
+INSERT INTO album (title) VALUES ('Album 1');
+INSERT INTO album (title) VALUES ('Album 2');
+
+INSERT INTO artist (name) VALUES ('Dan');
+INSERT INTO artist (name) VALUES ('Jenny');
+INSERT INTO artist (name) VALUES ('Karl');
+INSERT INTO artist (name) VALUES ('Tom');
+
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 1', 'Dan');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Dan');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 1', 'Jenny');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Karl');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Tom');
+
+INSERT INTO track (id, song_name, album_id) VALUES (1, 'Track 1', 'Album 1');
+INSERT INTO track (id, song_name, album_id) VALUES (2, 'Song 2', 'Album 1');
+INSERT INTO track (id, song_name, album_id) VALUES (3, 'Track A', 'Album 2');
+INSERT INTO track (id, song_name, album_id) VALUES (4, 'Track B', 'Album 2');
INSERT INTO track (id, song_name, album_id) VALUES (5, 'Song 3', 'Album 1'); \ No newline at end of file
diff --git a/tests/simple_unit/ActiveRecord/records/Blogs.php b/tests/unit/Data/ActiveRecord/records/Blogs.php
index 6523f029..6523f029 100644
--- a/tests/simple_unit/ActiveRecord/records/Blogs.php
+++ b/tests/unit/Data/ActiveRecord/records/Blogs.php
diff --git a/tests/simple_unit/ActiveRecord/records/DepSections.php b/tests/unit/Data/ActiveRecord/records/DepSections.php
index bf01ed12..bf01ed12 100644
--- a/tests/simple_unit/ActiveRecord/records/DepSections.php
+++ b/tests/unit/Data/ActiveRecord/records/DepSections.php
diff --git a/tests/simple_unit/ActiveRecord/records/DepartmentRecord.php b/tests/unit/Data/ActiveRecord/records/DepartmentRecord.php
index b60c7930..b60c7930 100644
--- a/tests/simple_unit/ActiveRecord/records/DepartmentRecord.php
+++ b/tests/unit/Data/ActiveRecord/records/DepartmentRecord.php
diff --git a/tests/simple_unit/ActiveRecord/records/ItemRecord.php b/tests/unit/Data/ActiveRecord/records/ItemRecord.php
index e6707cde..e6707cde 100644
--- a/tests/simple_unit/ActiveRecord/records/ItemRecord.php
+++ b/tests/unit/Data/ActiveRecord/records/ItemRecord.php
diff --git a/tests/simple_unit/ActiveRecord/records/SimpleUser.php b/tests/unit/Data/ActiveRecord/records/SimpleUser.php
index b6748857..b6748857 100644
--- a/tests/simple_unit/ActiveRecord/records/SimpleUser.php
+++ b/tests/unit/Data/ActiveRecord/records/SimpleUser.php
diff --git a/tests/simple_unit/ActiveRecord/records/SqliteUsers.php b/tests/unit/Data/ActiveRecord/records/SqliteUsers.php
index f8fa12c5..f8fa12c5 100644
--- a/tests/simple_unit/ActiveRecord/records/SqliteUsers.php
+++ b/tests/unit/Data/ActiveRecord/records/SqliteUsers.php
diff --git a/tests/simple_unit/ActiveRecord/records/UserRecord.php b/tests/unit/Data/ActiveRecord/records/UserRecord.php
index 4ef98baf..4ef98baf 100644
--- a/tests/simple_unit/ActiveRecord/records/UserRecord.php
+++ b/tests/unit/Data/ActiveRecord/records/UserRecord.php
diff --git a/tests/simple_unit/ActiveRecord/sqlite.sql b/tests/unit/Data/ActiveRecord/sqlite.sql
index 03e4a1ab..7854fc43 100644
--- a/tests/simple_unit/ActiveRecord/sqlite.sql
+++ b/tests/unit/Data/ActiveRecord/sqlite.sql
@@ -1,46 +1,46 @@
-CREATE TABLE album (
- title varchar(100) NOT NULL PRIMARY KEY
-);
-
-CREATE TABLE artist (
- name varchar(25) NOT NULL PRIMARY KEY
-);
-
-CREATE TABLE album_artists (
- album_title varchar(100) NOT NULL CONSTRAINT fk_album REFERENCES album(title) ON DELETE CASCADE,
- artist_name varchar(25) NOT NULL CONSTRAINT fk_artist REFERENCES artist(name) ON DELETE CASCADE
-);
-
-CREATE TABLE track (
- id INTEGER NOT NULL PRIMARY KEY,
- song_name varchar(200) NOT NULL default '',
- album_id varchar(100) NOT NULL CONSTRAINT fk_album_1 REFERENCES album(title) ON DELETE CASCADE
-);
-
-CREATE TABLE cover(
- album varchar(200) NOT NULL CONSTRAINT fk_album_2 REFERENCES album(title) ON DELETE CASCADE,
- content text
-);
-
-INSERT INTO album (title) VALUES ('Album 1');
-INSERT INTO album (title) VALUES ('Album 2');
-
-INSERT INTO cover(album,content) VALUES ('Album 1', 'lalala');
-INSERT INTO cover(album,content) VALUES ('Album 2', 'conver content');
-
-INSERT INTO artist (name) VALUES ('Dan');
-INSERT INTO artist (name) VALUES ('Jenny');
-INSERT INTO artist (name) VALUES ('Karl');
-INSERT INTO artist (name) VALUES ('Tom');
-
-INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 1', 'Dan');
-INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Dan');
-INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 1', 'Jenny');
-INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Karl');
-INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Tom');
-
-INSERT INTO track (id, song_name, album_id) VALUES (1, 'Track 1', 'Album 1');
-INSERT INTO track (id, song_name, album_id) VALUES (2, 'Song 2', 'Album 1');
-INSERT INTO track (id, song_name, album_id) VALUES (3, 'Track A', 'Album 2');
-INSERT INTO track (id, song_name, album_id) VALUES (4, 'Track B', 'Album 2');
+CREATE TABLE album (
+ title varchar(100) NOT NULL PRIMARY KEY
+);
+
+CREATE TABLE artist (
+ name varchar(25) NOT NULL PRIMARY KEY
+);
+
+CREATE TABLE album_artists (
+ album_title varchar(100) NOT NULL CONSTRAINT fk_album REFERENCES album(title) ON DELETE CASCADE,
+ artist_name varchar(25) NOT NULL CONSTRAINT fk_artist REFERENCES artist(name) ON DELETE CASCADE
+);
+
+CREATE TABLE track (
+ id INTEGER NOT NULL PRIMARY KEY,
+ song_name varchar(200) NOT NULL default '',
+ album_id varchar(100) NOT NULL CONSTRAINT fk_album_1 REFERENCES album(title) ON DELETE CASCADE
+);
+
+CREATE TABLE cover(
+ album varchar(200) NOT NULL CONSTRAINT fk_album_2 REFERENCES album(title) ON DELETE CASCADE,
+ content text
+);
+
+INSERT INTO album (title) VALUES ('Album 1');
+INSERT INTO album (title) VALUES ('Album 2');
+
+INSERT INTO cover(album,content) VALUES ('Album 1', 'lalala');
+INSERT INTO cover(album,content) VALUES ('Album 2', 'conver content');
+
+INSERT INTO artist (name) VALUES ('Dan');
+INSERT INTO artist (name) VALUES ('Jenny');
+INSERT INTO artist (name) VALUES ('Karl');
+INSERT INTO artist (name) VALUES ('Tom');
+
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 1', 'Dan');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Dan');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 1', 'Jenny');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Karl');
+INSERT INTO album_artists (album_title, artist_name) VALUES ('Album 2', 'Tom');
+
+INSERT INTO track (id, song_name, album_id) VALUES (1, 'Track 1', 'Album 1');
+INSERT INTO track (id, song_name, album_id) VALUES (2, 'Song 2', 'Album 1');
+INSERT INTO track (id, song_name, album_id) VALUES (3, 'Track A', 'Album 2');
+INSERT INTO track (id, song_name, album_id) VALUES (4, 'Track B', 'Album 2');
INSERT INTO track (id, song_name, album_id) VALUES (5, 'Song 3', 'Album 1'); \ No newline at end of file
diff --git a/tests/simple_unit/ActiveRecord/test1.sqlite b/tests/unit/Data/ActiveRecord/test1.sqlite
index 1e056b52..1e056b52 100644
--- a/tests/simple_unit/ActiveRecord/test1.sqlite
+++ b/tests/unit/Data/ActiveRecord/test1.sqlite
Binary files differ
diff --git a/tests/unit/Data/DataGateway/AllTests.php b/tests/unit/Data/DataGateway/AllTests.php
deleted file mode 100644
index 6007ae70..00000000
--- a/tests/unit/Data/DataGateway/AllTests.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Data_DataGateway_AllTests::main');
-}
-
-require_once 'TSqlCriteriaTest.php';
-
-class Data_DataGateway_AllTests {
-
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Data.DataGateway');
-
- $suite->addTestSuite('TSqlCriteriaTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Data_DataGateway_AllTests::main') {
- Data_DataGateway_AllTests::main();
-}
diff --git a/tests/simple_unit/DbCommon/CommandBuilderMssqlTest.php b/tests/unit/Data/DbCommon/CommandBuilderMssqlTest.php
index d309c1cc..893a8ca6 100644
--- a/tests/simple_unit/DbCommon/CommandBuilderMssqlTest.php
+++ b/tests/unit/Data/DbCommon/CommandBuilderMssqlTest.php
@@ -3,7 +3,10 @@
Prado::using('System.Data.*');
Prado::using('System.Data.Common.Mssql.TMssqlCommandBuilder');
-class CommandBuilderMssqlTest extends UnitTestCase
+/**
+ * @package System.Data.DbCommon
+ */
+class CommandBuilderMssqlTest extends PHPUnit_Framework_TestCase
{
protected static $sql = array(
'simple' => 'SELECT username, age FROM accounts',
diff --git a/tests/simple_unit/DbCommon/CommandBuilderMysqlTest.php b/tests/unit/Data/DbCommon/CommandBuilderMysqlTest.php
index e47914aa..77e58019 100644
--- a/tests/simple_unit/DbCommon/CommandBuilderMysqlTest.php
+++ b/tests/unit/Data/DbCommon/CommandBuilderMysqlTest.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.*');
Prado::using('System.Data.Common.Mysql.TMysqlMetaData');
-class CommandBuilderMysqlTest extends UnitTestCase
+/**
+ * @package System.Data.DbCommon
+ */
+class CommandBuilderMysqlTest extends PHPUnit_Framework_TestCase
{
function mysql_meta_data()
{
diff --git a/tests/simple_unit/DbCommon/CommandBuilderPgsqlTest.php b/tests/unit/Data/DbCommon/CommandBuilderPgsqlTest.php
index 8e339073..389ad0e1 100644
--- a/tests/simple_unit/DbCommon/CommandBuilderPgsqlTest.php
+++ b/tests/unit/Data/DbCommon/CommandBuilderPgsqlTest.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.*');
Prado::using('System.Data.Common.Pgsql.TPgsqlMetaData');
-class CommandBuilderPgsqlTest extends UnitTestCase
+/**
+ * @package System.Data.DbCommon
+ */
+class CommandBuilderPgsqlTest extends PHPUnit_Framework_TestCase
{
function pgsql_meta_data()
{
diff --git a/tests/simple_unit/DbCommon/MssqlColumnTest.php b/tests/unit/Data/DbCommon/MssqlColumnTest.php
index f64615e8..e4196fcf 100644
--- a/tests/simple_unit/DbCommon/MssqlColumnTest.php
+++ b/tests/unit/Data/DbCommon/MssqlColumnTest.php
@@ -4,7 +4,10 @@ Prado::using('System.Data.*');
Prado::using('System.Data.Common.Mssql.TMssqlMetaData');
Prado::using('System.Data.DataGateway.TTableGateway');
-class MssqlColumnTest extends UnitTestCase
+/**
+ * @package System.Data.DbCommon
+ */
+class MssqlColumnTest extends PHPUnit_Framework_TestCase
{
function get_conn()
{
diff --git a/tests/simple_unit/DbCommon/Mysql4ColumnTest.php b/tests/unit/Data/DbCommon/Mysql4ColumnTest.php
index 6216cdd7..74606452 100644
--- a/tests/simple_unit/DbCommon/Mysql4ColumnTest.php
+++ b/tests/unit/Data/DbCommon/Mysql4ColumnTest.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.*');
Prado::using('System.Data.Common.Mysql.TMysqlMetaData');
-class Mysql4ColumnTest extends UnitTestCase
+/**
+ * @package System.Data.DbCommon
+ */
+class Mysql4ColumnTest extends PHPUnit_Framework_TestCase
{
function create_meta_data()
{
diff --git a/tests/simple_unit/DbCommon/MysqlColumnTest.php b/tests/unit/Data/DbCommon/MysqlColumnTest.php
index 57565ca1..3bdfe54f 100644
--- a/tests/simple_unit/DbCommon/MysqlColumnTest.php
+++ b/tests/unit/Data/DbCommon/MysqlColumnTest.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.*');
Prado::using('System.Data.Common.Mysql.TMysqlMetaData');
-class MysqlColumnTest extends UnitTestCase
+/**
+ * @package System.Data.DbCommon
+ */
+class MysqlColumnTest extends PHPUnit_Framework_TestCase
{
function create_meta_data()
{
diff --git a/tests/simple_unit/DbCommon/PgsqlColumnTest.php b/tests/unit/Data/DbCommon/PgsqlColumnTest.php
index 5859c115..7d7f1177 100644
--- a/tests/simple_unit/DbCommon/PgsqlColumnTest.php
+++ b/tests/unit/Data/DbCommon/PgsqlColumnTest.php
@@ -2,7 +2,11 @@
Prado::using('System.Data.*');
Prado::using('System.Data.Common.Pgsql.TPgsqlMetaData');
-class PgsqlColumnTest extends UnitTestCase
+
+/**
+ * @package System.Data.DbCommon
+ */
+class PgsqlColumnTest extends PHPUnit_Framework_TestCase
{
function create_meta_data()
{
diff --git a/tests/simple_unit/DbCommon/SqliteColumnTest.php b/tests/unit/Data/DbCommon/SqliteColumnTest.php
index 712d2977..88117e9e 100644
--- a/tests/simple_unit/DbCommon/SqliteColumnTest.php
+++ b/tests/unit/Data/DbCommon/SqliteColumnTest.php
@@ -2,7 +2,11 @@
Prado::using('System.Data.*');
Prado::using('System.Data.Common.Sqlite.TSqliteMetaData');
Prado::using('System.Data.DataGateway.TTableGateway');
-class SqliteColumnTest extends UnitTestCase
+
+/**
+ * @package System.Data.DbCommon
+ */
+class SqliteColumnTest extends PHPUnit_Framework_TestCase
{
/**
* @return TSqliteMetaData
diff --git a/tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php b/tests/unit/Data/SqlMap/ActiveRecordSqlMapTest.php
index 2ae051e8..c2eef7a1 100644
--- a/tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php
+++ b/tests/unit/Data/SqlMap/ActiveRecordSqlMapTest.php
@@ -4,6 +4,9 @@ require_once(dirname(__FILE__).'/BaseCase.php');
Prado::using('System.Data.ActiveRecord.TActiveRecord');
+/**
+ * @package System.Data.SqlMap
+ */
class ActiveAccount extends TActiveRecord
{
public $Account_Id;
diff --git a/tests/unit/Data/SqlMap/AllTests.php b/tests/unit/Data/SqlMap/AllTests.php
deleted file mode 100644
index 08870eb3..00000000
--- a/tests/unit/Data/SqlMap/AllTests.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Data_SqlMap_AllTests::main');
-}
-
-require_once 'DynamicParameterTest.php';
-require_once 'DataMapper/AllTests.php';
-
-class Data_SqlMap_AllTests {
-
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Data.SqlMap');
-
- $suite->addTestSuite('DynamicParameterTest');
- $suite -> addTest( Data_SqlMap_DataMapper_AllTests::suite() );
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Data_SqlMap_AllTests::main') {
- Data_SqlMap_AllTests::main();
-}
diff --git a/tests/simple_unit/SqlMap/BaseCase.php b/tests/unit/Data/SqlMap/BaseCase.php
index 4f44a5b7..15bb3367 100644
--- a/tests/simple_unit/SqlMap/BaseCase.php
+++ b/tests/unit/Data/SqlMap/BaseCase.php
@@ -4,9 +4,9 @@ require_once(dirname(__FILE__).'/common.php');
Prado::using('System.Data.SqlMap.TSqlMapManager');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
-class BaseCase extends UnitTestCase
+class BaseCase extends PHPUnit_Framework_TestCase
{
protected $sqlmap;
protected $connection;
diff --git a/tests/simple_unit/SqlMap/CacheTest.php b/tests/unit/Data/SqlMap/CacheTest.php
index ff87cd3a..3d2ccd41 100644
--- a/tests/simple_unit/SqlMap/CacheTest.php
+++ b/tests/unit/Data/SqlMap/CacheTest.php
@@ -3,7 +3,7 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
class CacheTest extends BaseCase
{
diff --git a/tests/unit/Data/SqlMap/DataMapper/AllTests.php b/tests/unit/Data/SqlMap/DataMapper/AllTests.php
deleted file mode 100644
index d685d474..00000000
--- a/tests/unit/Data/SqlMap/DataMapper/AllTests.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Data_SqlMap_DataMapper_AllTests::main');
-}
-
-require_once 'TPropertyAccessTest.php';
-
-class Data_SqlMap_DataMapper_AllTests {
-
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Data.SqlMap.DataMapper');
-
- $suite->addTestSuite('TPropertyAccessTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Data_SqlMap_DataMapper_AllTests::main') {
- Data_SqlMap_DataMapper_AllTests::main();
-} \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/DelegateTest.php b/tests/unit/Data/SqlMap/DelegateTest.php
index 80b23332..5bfbe5ce 100644
--- a/tests/simple_unit/SqlMap/DelegateTest.php
+++ b/tests/unit/Data/SqlMap/DelegateTest.php
@@ -2,7 +2,7 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
class DelegateTest extends BaseCase
{
diff --git a/tests/simple_unit/SqlMap/GroupByTest.php b/tests/unit/Data/SqlMap/GroupByTest.php
index a16211c3..3d414922 100644
--- a/tests/simple_unit/SqlMap/GroupByTest.php
+++ b/tests/unit/Data/SqlMap/GroupByTest.php
@@ -1,6 +1,9 @@
<?php
require_once(dirname(__FILE__).'/BaseCase.php');
+/**
+ * @package System.Data.SqlMap
+ */
class AccountWithOrders extends Account
{
private $_orders = array();
@@ -17,9 +20,6 @@ class AccountWithOrders extends Account
}
-/**
- * @package System.DataAccess.SQLMap
- */
class GroupByTest extends BaseCase
{
function __construct()
diff --git a/tests/simple_unit/SqlMap/InheritanceTest.php b/tests/unit/Data/SqlMap/InheritanceTest.php
index 81cad4a5..9c8a805e 100644
--- a/tests/simple_unit/SqlMap/InheritanceTest.php
+++ b/tests/unit/Data/SqlMap/InheritanceTest.php
@@ -3,7 +3,7 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
class InheritanceTest extends BaseCase
{
diff --git a/tests/simple_unit/SqlMap/ParameterMapTest.php b/tests/unit/Data/SqlMap/ParameterMapTest.php
index 557b9f4d..de5c235c 100644
--- a/tests/simple_unit/SqlMap/ParameterMapTest.php
+++ b/tests/unit/Data/SqlMap/ParameterMapTest.php
@@ -3,7 +3,7 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
class ParameterMapTest extends BaseCase
{
diff --git a/tests/simple_unit/SqlMap/PropertyAccessTest.php b/tests/unit/Data/SqlMap/PropertyAccessTest.php
index 80199628..eb8306d5 100644
--- a/tests/simple_unit/SqlMap/PropertyAccessTest.php
+++ b/tests/unit/Data/SqlMap/PropertyAccessTest.php
@@ -3,7 +3,7 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
class PropertyAccessTest extends BaseCase
{
diff --git a/tests/simple_unit/SqlMap/ResultClassTest.php b/tests/unit/Data/SqlMap/ResultClassTest.php
index 773268b9..9b02ca70 100644
--- a/tests/simple_unit/SqlMap/ResultClassTest.php
+++ b/tests/unit/Data/SqlMap/ResultClassTest.php
@@ -2,7 +2,7 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
class ResultClassTest extends BaseCase
{
diff --git a/tests/simple_unit/SqlMap/ResultMapTest.php b/tests/unit/Data/SqlMap/ResultMapTest.php
index b14cee31..c757f874 100644
--- a/tests/simple_unit/SqlMap/ResultMapTest.php
+++ b/tests/unit/Data/SqlMap/ResultMapTest.php
@@ -3,7 +3,7 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
class ResultMapTest extends BaseCase
{
diff --git a/tests/simple_unit/SqlMap/SelectKeyTest.php b/tests/unit/Data/SqlMap/SelectKeyTest.php
index 464b94f1..a0554aef 100644
--- a/tests/simple_unit/SqlMap/SelectKeyTest.php
+++ b/tests/unit/Data/SqlMap/SelectKeyTest.php
@@ -3,7 +3,7 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
class SelectKeyTest extends BaseCase
{
diff --git a/tests/simple_unit/SqlMap/SqlMapCacheTest.php b/tests/unit/Data/SqlMap/SqlMapCacheTest.php
index 7c3495b5..57851217 100644
--- a/tests/simple_unit/SqlMap/SqlMapCacheTest.php
+++ b/tests/unit/Data/SqlMap/SqlMapCacheTest.php
@@ -3,9 +3,9 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
-class SqlMapCacheTest extends UnitTestCase
+class SqlMapCacheTest extends PHPUnit_Framework_TestCase
{
function testFIFOCache()
{
diff --git a/tests/simple_unit/SqlMap/StatementExtendsTest.php b/tests/unit/Data/SqlMap/StatementExtendsTest.php
index 69beaa58..15d00e39 100644
--- a/tests/simple_unit/SqlMap/StatementExtendsTest.php
+++ b/tests/unit/Data/SqlMap/StatementExtendsTest.php
@@ -1,7 +1,11 @@
<?php
Prado::using('System.Data.SqlMap.TSqlMapConfig');
-class StatementExtendsTest extends UnitTestCase
+
+/**
+ * @package System.Data.SqlMap
+ */
+class StatementExtendsTest extends PHPUnit_Framework_TestCase
{
protected $sqlmap;
diff --git a/tests/simple_unit/SqlMap/StatementTest.php b/tests/unit/Data/SqlMap/StatementTest.php
index 3f9f4506..bdcc3ae7 100644
--- a/tests/simple_unit/SqlMap/StatementTest.php
+++ b/tests/unit/Data/SqlMap/StatementTest.php
@@ -2,7 +2,7 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
class StatementTest extends BaseCase
{
diff --git a/tests/simple_unit/SqlMap/TestQueryForMap.php b/tests/unit/Data/SqlMap/TestQueryForMap.php
index 2de020a8..09810489 100644
--- a/tests/simple_unit/SqlMap/TestQueryForMap.php
+++ b/tests/unit/Data/SqlMap/TestQueryForMap.php
@@ -1,6 +1,9 @@
<?php
require_once(dirname(__FILE__).'/BaseCase.php');
+/**
+ * @package System.Data.SqlMap
+ */
class TestQueryForMap extends BaseCase
{
function __construct()
diff --git a/tests/simple_unit/Tickets/Ticket589Test.php b/tests/unit/Data/SqlMap/Ticket589Test.php
index 487181ff..a648e74f 100644
--- a/tests/simple_unit/Tickets/Ticket589Test.php
+++ b/tests/unit/Data/SqlMap/Ticket589Test.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.SqlMap.TSqlMapManager');
-class Ticket589Test extends UnitTestCase
+/**
+ * @package System.Data.SqlMap
+ */
+class Ticket589Test extends PHPUnit_Framework_TestCase
{
function test()
{
diff --git a/tests/simple_unit/SqlMap/common.php b/tests/unit/Data/SqlMap/common.php
index 020a296b..020a296b 100644
--- a/tests/simple_unit/SqlMap/common.php
+++ b/tests/unit/Data/SqlMap/common.php
diff --git a/tests/simple_unit/SqlMap/domain/A.php b/tests/unit/Data/SqlMap/domain/A.php
index a4f204e4..a4f204e4 100644
--- a/tests/simple_unit/SqlMap/domain/A.php
+++ b/tests/unit/Data/SqlMap/domain/A.php
diff --git a/tests/simple_unit/SqlMap/domain/Account.php b/tests/unit/Data/SqlMap/domain/Account.php
index b4bcbcc8..b4bcbcc8 100644
--- a/tests/simple_unit/SqlMap/domain/Account.php
+++ b/tests/unit/Data/SqlMap/domain/Account.php
diff --git a/tests/simple_unit/SqlMap/domain/AccountBis.php b/tests/unit/Data/SqlMap/domain/AccountBis.php
index e48184b6..e48184b6 100644
--- a/tests/simple_unit/SqlMap/domain/AccountBis.php
+++ b/tests/unit/Data/SqlMap/domain/AccountBis.php
diff --git a/tests/simple_unit/SqlMap/domain/AccountCollection.php b/tests/unit/Data/SqlMap/domain/AccountCollection.php
index 06e30dc8..06e30dc8 100644
--- a/tests/simple_unit/SqlMap/domain/AccountCollection.php
+++ b/tests/unit/Data/SqlMap/domain/AccountCollection.php
diff --git a/tests/simple_unit/SqlMap/domain/B.php b/tests/unit/Data/SqlMap/domain/B.php
index ab42e6b6..ab42e6b6 100644
--- a/tests/simple_unit/SqlMap/domain/B.php
+++ b/tests/unit/Data/SqlMap/domain/B.php
diff --git a/tests/simple_unit/SqlMap/domain/Book.php b/tests/unit/Data/SqlMap/domain/Book.php
index 4c0670e8..4c0670e8 100644
--- a/tests/simple_unit/SqlMap/domain/Book.php
+++ b/tests/unit/Data/SqlMap/domain/Book.php
diff --git a/tests/simple_unit/SqlMap/domain/C.php b/tests/unit/Data/SqlMap/domain/C.php
index 642f97e9..642f97e9 100644
--- a/tests/simple_unit/SqlMap/domain/C.php
+++ b/tests/unit/Data/SqlMap/domain/C.php
diff --git a/tests/simple_unit/SqlMap/domain/Category.php b/tests/unit/Data/SqlMap/domain/Category.php
index 895819e9..895819e9 100644
--- a/tests/simple_unit/SqlMap/domain/Category.php
+++ b/tests/unit/Data/SqlMap/domain/Category.php
diff --git a/tests/simple_unit/SqlMap/domain/Complex.php b/tests/unit/Data/SqlMap/domain/Complex.php
index 01082343..01082343 100644
--- a/tests/simple_unit/SqlMap/domain/Complex.php
+++ b/tests/unit/Data/SqlMap/domain/Complex.php
diff --git a/tests/simple_unit/SqlMap/domain/D.php b/tests/unit/Data/SqlMap/domain/D.php
index f120e2d1..f120e2d1 100644
--- a/tests/simple_unit/SqlMap/domain/D.php
+++ b/tests/unit/Data/SqlMap/domain/D.php
diff --git a/tests/simple_unit/SqlMap/domain/Document.php b/tests/unit/Data/SqlMap/domain/Document.php
index 518851e6..518851e6 100644
--- a/tests/simple_unit/SqlMap/domain/Document.php
+++ b/tests/unit/Data/SqlMap/domain/Document.php
diff --git a/tests/simple_unit/SqlMap/domain/DocumentCollection.php b/tests/unit/Data/SqlMap/domain/DocumentCollection.php
index a2d5d89d..a2d5d89d 100644
--- a/tests/simple_unit/SqlMap/domain/DocumentCollection.php
+++ b/tests/unit/Data/SqlMap/domain/DocumentCollection.php
diff --git a/tests/simple_unit/SqlMap/domain/E.php b/tests/unit/Data/SqlMap/domain/E.php
index c69c8027..c69c8027 100644
--- a/tests/simple_unit/SqlMap/domain/E.php
+++ b/tests/unit/Data/SqlMap/domain/E.php
diff --git a/tests/simple_unit/SqlMap/domain/F.php b/tests/unit/Data/SqlMap/domain/F.php
index 159d8d63..159d8d63 100644
--- a/tests/simple_unit/SqlMap/domain/F.php
+++ b/tests/unit/Data/SqlMap/domain/F.php
diff --git a/tests/simple_unit/SqlMap/domain/LineItem.php b/tests/unit/Data/SqlMap/domain/LineItem.php
index a989ab8b..a989ab8b 100644
--- a/tests/simple_unit/SqlMap/domain/LineItem.php
+++ b/tests/unit/Data/SqlMap/domain/LineItem.php
diff --git a/tests/simple_unit/SqlMap/domain/LineItemCollection.php b/tests/unit/Data/SqlMap/domain/LineItemCollection.php
index 1c31dca3..1c31dca3 100644
--- a/tests/simple_unit/SqlMap/domain/LineItemCollection.php
+++ b/tests/unit/Data/SqlMap/domain/LineItemCollection.php
diff --git a/tests/simple_unit/SqlMap/domain/Newspaper.php b/tests/unit/Data/SqlMap/domain/Newspaper.php
index 12ebce5b..12ebce5b 100644
--- a/tests/simple_unit/SqlMap/domain/Newspaper.php
+++ b/tests/unit/Data/SqlMap/domain/Newspaper.php
diff --git a/tests/simple_unit/SqlMap/domain/Order.php b/tests/unit/Data/SqlMap/domain/Order.php
index 2b907ac6..2b907ac6 100644
--- a/tests/simple_unit/SqlMap/domain/Order.php
+++ b/tests/unit/Data/SqlMap/domain/Order.php
diff --git a/tests/simple_unit/SqlMap/domain/Other.php b/tests/unit/Data/SqlMap/domain/Other.php
index 89f9d490..89f9d490 100644
--- a/tests/simple_unit/SqlMap/domain/Other.php
+++ b/tests/unit/Data/SqlMap/domain/Other.php
diff --git a/tests/simple_unit/SqlMap/domain/Sample.php b/tests/unit/Data/SqlMap/domain/Sample.php
index f2a8951f..f2a8951f 100644
--- a/tests/simple_unit/SqlMap/domain/Sample.php
+++ b/tests/unit/Data/SqlMap/domain/Sample.php
diff --git a/tests/simple_unit/SqlMap/domain/Search.php b/tests/unit/Data/SqlMap/domain/Search.php
index d2170044..d2170044 100644
--- a/tests/simple_unit/SqlMap/domain/Search.php
+++ b/tests/unit/Data/SqlMap/domain/Search.php
diff --git a/tests/simple_unit/SqlMap/domain/User.php b/tests/unit/Data/SqlMap/domain/User.php
index 1106d1e9..1106d1e9 100644
--- a/tests/simple_unit/SqlMap/domain/User.php
+++ b/tests/unit/Data/SqlMap/domain/User.php
diff --git a/tests/simple_unit/SqlMap/gen.php b/tests/unit/Data/SqlMap/gen.php
index 40ddc297..40ddc297 100644
--- a/tests/simple_unit/SqlMap/gen.php
+++ b/tests/unit/Data/SqlMap/gen.php
diff --git a/tests/simple_unit/SqlMap/maps/MySql/Account.xml b/tests/unit/Data/SqlMap/maps/MySql/Account.xml
index 77a1d433..d6dd1c1d 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/Account.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/Account.xml
@@ -1,624 +1,624 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<sqlMap namespace="Account" >
-
- <!-- =============================================
- <resultMap
- name="name"
- class="name"
- extend="resultMapId"
- >
- <result
- property="name"
- column="name"
- columnIndex="name"
- nullValue="value"
- select="name"
- resultMap="name"
- lazyLoad="true/false"
- dbType=""
- />
- <procedure
- name="name"
- parameterMap="name"
- >
- <statement
- name="name"
- parameterClass="name"
- parameterMap="name"
- resultClass="name"
- resultMap="name"
- listClass="name"
- >
- <parameterMap
- name="name"
- class=""
- >
- <parameter
- property="name"
- dbType=""
- output="true/false"
- type=""
- nullValue=""
- extend="parameterMapId"
- />
-
- ============================================= -->
-
- <cacheModel id="account-cache" implementation="LRU" >
- <flushInterval hours="24"/>
- <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
- <flushOnExecute statement="UpdateAccountViaParameterMap"/>
- <property name="size" value="10"/>
- </cacheModel>
-
- <!--
- <cacheModel name="account-cache" implementation="LRU" >
- <flushInterval hours="24"/>
- <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
- <flushOnExecute statement="UpdateAccountViaParameterMap"/>
- <property name="CacheSize" value="50"/>
- </cacheModel>
- -->
-
-
- <alias>
- <typeAlias alias="HundredsBool" type="IBatisNet.DataMapper.Test.Domain.HundredsTypeHandlerCallback, IBatisNet.DataMapper.Test"/>
- </alias>
-
- <resultMap id="account-result" class="Account" >
- <result property="Id" column="Account_Id"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email" nullValue="no_email@provided.com"/>
- <result property="BannerOptions" column="Account_Banner_Option" typeHandler="OuiNonBool"/>
- <result property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
- </resultMap>
- <resultMap id="indexed-account-result" class="Account">
- <result property="Id" column="Account_Id" columnIndex="0"/>
- <result property="FirstName" column="Account_FirstName" columnIndex="1"/>
- <result property="LastName" column="Account_LastName" columnIndex="2"/>
- <result property="EmailAddress" column="Account_Email" columnIndex="3" nullValue="no_email@provided.com"/>
- </resultMap>
- <resultMap id="account-result-nullable-email" class="Account">
- <result property="Id" column="Account_Id"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email"/>
- </resultMap>
-
- <resultMap id="email-result" class="string">
- <result property="value" column="Account_Email"/>
- </resultMap>
-
- <resultMap id="account-hashtable-result" class="array">
- <result property="Id" column="Account_Id"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email"/>
- </resultMap>
-
-
- <!-- =============================================
- MAPPED STATEMENTS - w/Inline Parameters
- =============================================
- -->
-
- <select id="GetAllAccountsAsArrayListViaResultClass"
- resultClass="TList">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetAccountsDynamic" resultMap="account-result" parameterClass="Hashtable" >
- select * from Accounts
- <dynamic prepend="where">
- <isParameterPresent>
- <isNotEmpty prepend="and" property="FirstName" >
- Account_FirstName LIKE '%$FirstName$%'
- </isNotEmpty>
- <isNotEmpty prepend="and" property="LastName" >
- Account_LastName LIKE '%$LastName$%'
- </isNotEmpty>
- <isNotEmpty prepend="and" property="EmailAddress" >
- Account_Email LIKE '%$EmailAddress$%'
- </isNotEmpty>
- </isParameterPresent>
- </dynamic>
- order by Account_LastName
- limit 0, $MaximumAllowed$
- </select>
-
- <select id="SelectWithProperty"
- resultMap="account-result">
- select *
- from Accounts
- where Account_FirstName = ${accountName}
- </select>
-
- <select id="GetCachedAccountsViaResultMap"
- resultMap="account-result"
- cacheModel="account-cache" >
- select *
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetNoAccountWithCache"
- parameterClass="Integer"
- resultMap="account-hashtable-result"
- cacheModel="account-cache">
- select *
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAccountAsHashtable"
- parameterClass="Integer"
- resultMap="account-hashtable-result">
- select *
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAllAccountsAsHashMapViaResultMap"
- resultMap="account-hashtable-result">
- select *
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetAccountAsHashtableResultClass"
- parameterClass="int"
- resultClass="array">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAllAccountsAsHashtableViaResultClass"
- resultClass="array">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetAccountViaColumnName"
- parameterClass="int"
- resultMap="account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email,
- Account_Banner_Option,
- Account_Cart_Option
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAccountViaColumnIndex"
- parameterClass="int"
- resultMap="indexed-account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAllAccountsViaResultMap"
- resultMap="account-result">
- select * from Accounts
- order by Account_Id
- </select>
-
- <select id="GetAllAccountsViaResultClass"
- resultClass="Account">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetFewAccountsViaResultMap"
- resultMap="account-result">
- <![CDATA[
- select * from Accounts
- where Account_Id < 2
- order by Account_Id
- ]]>
- </select>
-
- <select id="GetNoAccountsViaResultMap"
- resultMap="account-result">
- select * from Accounts
- where Account_Id > 1000
- order by Account_Id
- </select>
-
-
- <select id="GetAccountNullableEmail"
- resultMap="account-result-nullable-email">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAccountViaResultClass"
- resultClass="Account">
- <![CDATA[
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where Account_Id = #value#
- ]]>
- </select>
-
- <select id="GetAccountViaInlineParameters"
- resultMap="indexed-account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_Id = #Id# and Account_Id = #Id#
- </select>
-
- <select id="GetEmailAddressViaResultClass" resultClass="string">
- select Account_Email as value
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetEmailAddressViaResultMap"
- parameterClass="int"
- resultMap="email-result">
- select Account_Email
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAllEmailAddressesViaResultClass"
- resultClass="string">
- select Account_Email
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetAllEmailAddressesViaResultMap"
- resultMap="email-result">
- select Account_Email
- from Accounts
- order by Account_Id
- </select>
-
- <insert id="InsertAccountViaParameterMap"
- parameterMap="account-insert-params">
- insert into Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option)
- values
- (?, ?, ?, ?, ?, ?)
- </insert>
-
- <update id="UpdateAccountViaParameterMap"
- parameterMap="update-params">
- update Accounts set
- Account_FirstName = ?,
- Account_LastName = ?,
- Account_Email = ?
- where
- Account_Id = ?
- </update>
-
- <update id="UpdateAccountViaParameterMap2"
- parameterMap="update-params2">
- update Accounts set
- Account_Id = ?,
- Account_FirstName = ?,
- Account_LastName = ?,
- Account_Email = ?
- where
- Account_Id = ?
- </update>
-
- <delete id="DeleteAccountViaInlineParameters">
- delete from Accounts
- where
- Account_Id = #Id#
- </delete>
-
- <select id="GetAccountComplexMapping"
- resultMap="indexed-account-result"
- parameterClass="array">
- select *
- from Accounts
- where
- Account_FirstName = #Account.FirstName#
- And Account_LastName = #Order.City#
- </select>
-
- <select id="GetDynamicOrderedEmailAddressesViaResultMap"
- resultMap="email-result">
- select Account_Email
- from Accounts
- order by $value$
- </select>
-
- <!-- Dynamic statements -->
- <select id="GetAllAccountsViaResultMapWithDynamicElement"
- resultMap="account-result">
- select * from Accounts
- where Account_Email $value$ '%@%'
- order by Account_Id
- </select>
-
- <select id="SimpleDynamicSubstitution"
- parameterClass="Hashtable"
- resultClass="Account">
- $statement$
- </select>
-
- <!-- Public Fields -->
- <insert id="InsertAccountViaPublicFields">
- insert into Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email)
- values
- (#Id#, #FirstName#, #LastName#, #EmailAddress#
- )
- </insert>
-
-
- <!-- Inline Parameters -->
- <update id="UpdateAccountViaInlineParameters"
- parameterClass="Account">
- update Accounts set
- Account_FirstName = #FirstName#,
- Account_LastName = #LastName#,
- Account_Email = #EmailAddress, dbType=VarChar, nullValue=no_email@provided.com#
- where
- Account_Id = #Id#
- </update>
-
- <insert id="InsertAccountViaInlineParameters"
- parameterClass="Account" >
- insert into Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email)
- values
- (#Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar, nullValue=no_email@provided.com#
- )
- </insert>
-
- <insert id="InsertAccountNullableEmail"
- parameterClass="Account" >
- insert into Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email)
- values
- ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
- </insert>
-
- <insert id="InsertAccountUknownParameterClass">
- insert into Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email)
- values
- ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
- </insert>
-
- <delete id="DeleteAccount"
- parameterClass="Account">
- delete from Accounts
- where Account_Id = #Id#
- and Account_Id = #Id#
- </delete>
-
- <!-- Extends statement -->
- <select id="GetAllAccounts"
- resultMap="indexed-account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- </select>
-
- <select id="GetAllAccountsOrderByName"
- extends="GetAllAccounts"
- resultMap="indexed-account-result">
- order by Account_FirstName
- </select>
-
- <select id="GetOneAccount"
- extends="GetAllAccounts"
- resultMap="indexed-account-result">
- where Account_Id = #value#
- </select>
-
- <select id="GetSomeAccount"
- extends="GetAllAccounts"
- parameterClass="Hashtable"
- resultMap="indexed-account-result">
- where Account_Id between #lowID# and #hightID#
- </select>
-
- <select id="SelectAccountJIRA29" parameterClass="map" resultClass="Account">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where Account_FirstName = '##$AccountName$##'
- </select>
-
- <select id="SelectAccountJIRA29-2"
- parameterClass="Hashtable"
- resultClass="Account">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where 1=1
- <isNotEmpty prepend="AND" property="Foo">
- (Account_FirstName = '##$Foo$##')
- </isNotEmpty>
- </select>
-
- <select id="GetAccountWithRepeatingProperty"
- parameterClass="Account"
- resultMap="indexed-account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_Id = #Id# and
- Account_Id = #Id# and
- Account_FirstName = #FirstName# and
- Account_LastName = #LastName# and
- Account_Id = #Id#
- </select>
-
- <select id="GetAllAccountsViaCustomTypeHandler"
- resultMap="account-result">
- select * from Accounts
- order by Account_Id
- </select>
-
- <!-- JIRA-110 -->
- <select id="GetManyAccound" resultClass="Account">
- SELECT
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- FROM Accounts
- </select>
-
- <select id="Get1Account" extends="GetManyAccound" resultClass="Account">WHERE Account_Id=1</select>
-
- <statement id="GetAccounts" resultMap="account-result">
- SELECT *
- FROM
- Accounts
- </statement>
- <!-- JIRA-110 -->
-
- <insert id="InsertAccountDynamic" parameterClass="Account">
- INSERT INTO Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email)
- VALUES(#Id#, #FirstName#, #LastName#
- <dynamic prepend=",">
- <isNotNull prepend="," property="EmailAddress">
- #EmailAddress#
- </isNotNull>
- <isNull prepend="," property="EmailAddress">
- null
- </isNull>
- </dynamic>
- )
- </insert>
-
-
- <!-- accounts and orders -->
-
- <select id="getAccountWithOrders" resultMap="Account-with-Orders">
- SELECT * FROM Accounts
- LEFT JOIN Orders ON
- Accounts.account_id = Orders.account_id
- </select>
-
- <resultMap id="Account-with-Orders" class="AccountWithOrders" groupBy="Account_Id">
- <result property="Id" column="Account_Id"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email" />
- <result property="Orders" resultMapping="account-orders" />
- </resultMap>
-
- <resultMap id="account-orders" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- </resultMap>
-
-
- <!-- For procedure, the parameters of the parameterMap must in the same order
- as for the procedure paramaters-->
- <procedure id="InsertAccountViaStoreProcedure" parameterMap="account-insert-params">
- ps_InsertAccount
- </procedure>
-
- <procedure id="SwapEmailAddresses" parameterMap="swap-params">
- ps_swap_email_address
- </procedure>
-
- <!-- =============================================
- OPTIONAL EXPLICIT PARAMETER MAP
- ============================================= -->
-
- <parameterMap id="swap-params">
- <parameter property="email1" column="First_Email" />
- <parameter property="email2" column="Second_Email" />
- </parameterMap>
-
- <parameterMap id="account-insert-params">
- <parameter property="Id" />
- <parameter property="FirstName" />
- <parameter property="LastName" />
- <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
- <parameter property="BannerOptions" dbType="Varchar" type="bool"/>
- <parameter property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
- </parameterMap>
-
- <parameterMap id="update-params">
- <parameter property="FirstName" />
- <parameter property="LastName" />
- <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
- <parameter property="Id" />
- </parameterMap>
-
- <parameterMap id="update-params2">
- <parameter property="Id" />
- <parameter property="FirstName" />
- <parameter property="LastName" />
- <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
- <parameter property="Id" />
- </parameterMap>
-
-
+<?xml version="1.0" encoding="UTF-8" ?>
+<sqlMap namespace="Account" >
+
+ <!-- =============================================
+ <resultMap
+ name="name"
+ class="name"
+ extend="resultMapId"
+ >
+ <result
+ property="name"
+ column="name"
+ columnIndex="name"
+ nullValue="value"
+ select="name"
+ resultMap="name"
+ lazyLoad="true/false"
+ dbType=""
+ />
+ <procedure
+ name="name"
+ parameterMap="name"
+ >
+ <statement
+ name="name"
+ parameterClass="name"
+ parameterMap="name"
+ resultClass="name"
+ resultMap="name"
+ listClass="name"
+ >
+ <parameterMap
+ name="name"
+ class=""
+ >
+ <parameter
+ property="name"
+ dbType=""
+ output="true/false"
+ type=""
+ nullValue=""
+ extend="parameterMapId"
+ />
+
+ ============================================= -->
+
+ <cacheModel id="account-cache" implementation="LRU" >
+ <flushInterval hours="24"/>
+ <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
+ <flushOnExecute statement="UpdateAccountViaParameterMap"/>
+ <property name="size" value="10"/>
+ </cacheModel>
+
+ <!--
+ <cacheModel name="account-cache" implementation="LRU" >
+ <flushInterval hours="24"/>
+ <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
+ <flushOnExecute statement="UpdateAccountViaParameterMap"/>
+ <property name="CacheSize" value="50"/>
+ </cacheModel>
+ -->
+
+
+ <alias>
+ <typeAlias alias="HundredsBool" type="IBatisNet.DataMapper.Test.Domain.HundredsTypeHandlerCallback, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+ <resultMap id="account-result" class="Account" >
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email" nullValue="no_email@provided.com"/>
+ <result property="BannerOptions" column="Account_Banner_Option" typeHandler="OuiNonBool"/>
+ <result property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
+ </resultMap>
+ <resultMap id="indexed-account-result" class="Account">
+ <result property="Id" column="Account_Id" columnIndex="0"/>
+ <result property="FirstName" column="Account_FirstName" columnIndex="1"/>
+ <result property="LastName" column="Account_LastName" columnIndex="2"/>
+ <result property="EmailAddress" column="Account_Email" columnIndex="3" nullValue="no_email@provided.com"/>
+ </resultMap>
+ <resultMap id="account-result-nullable-email" class="Account">
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email"/>
+ </resultMap>
+
+ <resultMap id="email-result" class="string">
+ <result property="value" column="Account_Email"/>
+ </resultMap>
+
+ <resultMap id="account-hashtable-result" class="array">
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email"/>
+ </resultMap>
+
+
+ <!-- =============================================
+ MAPPED STATEMENTS - w/Inline Parameters
+ =============================================
+ -->
+
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="TList">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAccountsDynamic" resultMap="account-result" parameterClass="Hashtable" >
+ select * from Accounts
+ <dynamic prepend="where">
+ <isParameterPresent>
+ <isNotEmpty prepend="and" property="FirstName" >
+ Account_FirstName LIKE '%$FirstName$%'
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName LIKE '%$LastName$%'
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="EmailAddress" >
+ Account_Email LIKE '%$EmailAddress$%'
+ </isNotEmpty>
+ </isParameterPresent>
+ </dynamic>
+ order by Account_LastName
+ limit 0, $MaximumAllowed$
+ </select>
+
+ <select id="SelectWithProperty"
+ resultMap="account-result">
+ select *
+ from Accounts
+ where Account_FirstName = ${accountName}
+ </select>
+
+ <select id="GetCachedAccountsViaResultMap"
+ resultMap="account-result"
+ cacheModel="account-cache" >
+ select *
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetNoAccountWithCache"
+ parameterClass="Integer"
+ resultMap="account-hashtable-result"
+ cacheModel="account-cache">
+ select *
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAccountAsHashtable"
+ parameterClass="Integer"
+ resultMap="account-hashtable-result">
+ select *
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllAccountsAsHashMapViaResultMap"
+ resultMap="account-hashtable-result">
+ select *
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAccountAsHashtableResultClass"
+ parameterClass="int"
+ resultClass="array">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllAccountsAsHashtableViaResultClass"
+ resultClass="array">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAccountViaColumnName"
+ parameterClass="int"
+ resultMap="account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email,
+ Account_Banner_Option,
+ Account_Cart_Option
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAccountViaColumnIndex"
+ parameterClass="int"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllAccountsViaResultMap"
+ resultMap="account-result">
+ select * from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAllAccountsViaResultClass"
+ resultClass="Account">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetFewAccountsViaResultMap"
+ resultMap="account-result">
+ <![CDATA[
+ select * from Accounts
+ where Account_Id < 2
+ order by Account_Id
+ ]]>
+ </select>
+
+ <select id="GetNoAccountsViaResultMap"
+ resultMap="account-result">
+ select * from Accounts
+ where Account_Id > 1000
+ order by Account_Id
+ </select>
+
+
+ <select id="GetAccountNullableEmail"
+ resultMap="account-result-nullable-email">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAccountViaResultClass"
+ resultClass="Account">
+ <![CDATA[
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_Id = #value#
+ ]]>
+ </select>
+
+ <select id="GetAccountViaInlineParameters"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #Id# and Account_Id = #Id#
+ </select>
+
+ <select id="GetEmailAddressViaResultClass" resultClass="string">
+ select Account_Email as value
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetEmailAddressViaResultMap"
+ parameterClass="int"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllEmailAddressesViaResultClass"
+ resultClass="string">
+ select Account_Email
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAllEmailAddressesViaResultMap"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <insert id="InsertAccountViaParameterMap"
+ parameterMap="account-insert-params">
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option)
+ values
+ (?, ?, ?, ?, ?, ?)
+ </insert>
+
+ <update id="UpdateAccountViaParameterMap"
+ parameterMap="update-params">
+ update Accounts set
+ Account_FirstName = ?,
+ Account_LastName = ?,
+ Account_Email = ?
+ where
+ Account_Id = ?
+ </update>
+
+ <update id="UpdateAccountViaParameterMap2"
+ parameterMap="update-params2">
+ update Accounts set
+ Account_Id = ?,
+ Account_FirstName = ?,
+ Account_LastName = ?,
+ Account_Email = ?
+ where
+ Account_Id = ?
+ </update>
+
+ <delete id="DeleteAccountViaInlineParameters">
+ delete from Accounts
+ where
+ Account_Id = #Id#
+ </delete>
+
+ <select id="GetAccountComplexMapping"
+ resultMap="indexed-account-result"
+ parameterClass="array">
+ select *
+ from Accounts
+ where
+ Account_FirstName = #Account.FirstName#
+ And Account_LastName = #Order.City#
+ </select>
+
+ <select id="GetDynamicOrderedEmailAddressesViaResultMap"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ order by $value$
+ </select>
+
+ <!-- Dynamic statements -->
+ <select id="GetAllAccountsViaResultMapWithDynamicElement"
+ resultMap="account-result">
+ select * from Accounts
+ where Account_Email $value$ '%@%'
+ order by Account_Id
+ </select>
+
+ <select id="SimpleDynamicSubstitution"
+ parameterClass="Hashtable"
+ resultClass="Account">
+ $statement$
+ </select>
+
+ <!-- Public Fields -->
+ <insert id="InsertAccountViaPublicFields">
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#Id#, #FirstName#, #LastName#, #EmailAddress#
+ )
+ </insert>
+
+
+ <!-- Inline Parameters -->
+ <update id="UpdateAccountViaInlineParameters"
+ parameterClass="Account">
+ update Accounts set
+ Account_FirstName = #FirstName#,
+ Account_LastName = #LastName#,
+ Account_Email = #EmailAddress, dbType=VarChar, nullValue=no_email@provided.com#
+ where
+ Account_Id = #Id#
+ </update>
+
+ <insert id="InsertAccountViaInlineParameters"
+ parameterClass="Account" >
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar, nullValue=no_email@provided.com#
+ )
+ </insert>
+
+ <insert id="InsertAccountNullableEmail"
+ parameterClass="Account" >
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
+ </insert>
+
+ <insert id="InsertAccountUknownParameterClass">
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
+ </insert>
+
+ <delete id="DeleteAccount"
+ parameterClass="Account">
+ delete from Accounts
+ where Account_Id = #Id#
+ and Account_Id = #Id#
+ </delete>
+
+ <!-- Extends statement -->
+ <select id="GetAllAccounts"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ </select>
+
+ <select id="GetAllAccountsOrderByName"
+ extends="GetAllAccounts"
+ resultMap="indexed-account-result">
+ order by Account_FirstName
+ </select>
+
+ <select id="GetOneAccount"
+ extends="GetAllAccounts"
+ resultMap="indexed-account-result">
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetSomeAccount"
+ extends="GetAllAccounts"
+ parameterClass="Hashtable"
+ resultMap="indexed-account-result">
+ where Account_Id between #lowID# and #hightID#
+ </select>
+
+ <select id="SelectAccountJIRA29" parameterClass="map" resultClass="Account">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_FirstName = '##$AccountName$##'
+ </select>
+
+ <select id="SelectAccountJIRA29-2"
+ parameterClass="Hashtable"
+ resultClass="Account">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where 1=1
+ <isNotEmpty prepend="AND" property="Foo">
+ (Account_FirstName = '##$Foo$##')
+ </isNotEmpty>
+ </select>
+
+ <select id="GetAccountWithRepeatingProperty"
+ parameterClass="Account"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #Id# and
+ Account_Id = #Id# and
+ Account_FirstName = #FirstName# and
+ Account_LastName = #LastName# and
+ Account_Id = #Id#
+ </select>
+
+ <select id="GetAllAccountsViaCustomTypeHandler"
+ resultMap="account-result">
+ select * from Accounts
+ order by Account_Id
+ </select>
+
+ <!-- JIRA-110 -->
+ <select id="GetManyAccound" resultClass="Account">
+ SELECT
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ FROM Accounts
+ </select>
+
+ <select id="Get1Account" extends="GetManyAccound" resultClass="Account">WHERE Account_Id=1</select>
+
+ <statement id="GetAccounts" resultMap="account-result">
+ SELECT *
+ FROM
+ Accounts
+ </statement>
+ <!-- JIRA-110 -->
+
+ <insert id="InsertAccountDynamic" parameterClass="Account">
+ INSERT INTO Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ VALUES(#Id#, #FirstName#, #LastName#
+ <dynamic prepend=",">
+ <isNotNull prepend="," property="EmailAddress">
+ #EmailAddress#
+ </isNotNull>
+ <isNull prepend="," property="EmailAddress">
+ null
+ </isNull>
+ </dynamic>
+ )
+ </insert>
+
+
+ <!-- accounts and orders -->
+
+ <select id="getAccountWithOrders" resultMap="Account-with-Orders">
+ SELECT * FROM Accounts
+ LEFT JOIN Orders ON
+ Accounts.account_id = Orders.account_id
+ </select>
+
+ <resultMap id="Account-with-Orders" class="AccountWithOrders" groupBy="Account_Id">
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email" />
+ <result property="Orders" resultMapping="account-orders" />
+ </resultMap>
+
+ <resultMap id="account-orders" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ </resultMap>
+
+
+ <!-- For procedure, the parameters of the parameterMap must in the same order
+ as for the procedure paramaters-->
+ <procedure id="InsertAccountViaStoreProcedure" parameterMap="account-insert-params">
+ ps_InsertAccount
+ </procedure>
+
+ <procedure id="SwapEmailAddresses" parameterMap="swap-params">
+ ps_swap_email_address
+ </procedure>
+
+ <!-- =============================================
+ OPTIONAL EXPLICIT PARAMETER MAP
+ ============================================= -->
+
+ <parameterMap id="swap-params">
+ <parameter property="email1" column="First_Email" />
+ <parameter property="email2" column="Second_Email" />
+ </parameterMap>
+
+ <parameterMap id="account-insert-params">
+ <parameter property="Id" />
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="BannerOptions" dbType="Varchar" type="bool"/>
+ <parameter property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
+ </parameterMap>
+
+ <parameterMap id="update-params">
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="Id" />
+ </parameterMap>
+
+ <parameterMap id="update-params2">
+ <parameter property="Id" />
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="Id" />
+ </parameterMap>
+
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/MySql/ActiveRecord.xml b/tests/unit/Data/SqlMap/maps/MySql/ActiveRecord.xml
index 1c48010f..1c48010f 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/ActiveRecord.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/ActiveRecord.xml
diff --git a/tests/simple_unit/SqlMap/maps/MySql/Category.xml b/tests/unit/Data/SqlMap/maps/MySql/Category.xml
index ec81449b..05c51fb5 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/Category.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/Category.xml
@@ -1,162 +1,162 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMap namespace="Category" >
-
- <alias>
- <typeAlias alias="Category" type="IBatisNet.DataMapper.Test.Domain.Category, IBatisNet.DataMapper.Test"/>
- </alias>
-
-
- <select id="GetCategory" parameterClass="Integer" resultClass="Category">
- select
- Category_ID as Id,
- Category_Name as Name,
- Category_Guid as GuidString
- from Categories
- where Category_ID = #value#
- </select>
-
- <select id="GetCategoryGuid" parameterClass="Integer" resultClass="guid">
- select
- Category_Guid as value
- from Categories
- where Category_ID = #value#
- </select>
-
- <!-- Test for statement as insert -->
- <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
- <insert id="InsertCategory" parameterClass="Category">
- <selectKey property="Id" type="post" resultClass="int">
- select LAST_INSERT_ID() as value
- </selectKey>
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (#Name#, #GuidString:Varchar#);
- </insert>
-
- <!-- -->
- <insert id="InsertCategoryViaInsertStatement" parameterClass="Category" >
- <selectKey property="Id" type="post" resultClass="int">
- select LAST_INSERT_ID() as value
- </selectKey>
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (#Name#, #GuidString:Varchar#)
- </insert>
-
- <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
- <insert id="InsertCategoryViaParameterMap" parameterMap="InsertParam">
- <selectKey property="Id" type="post" resultClass="int">
- select LAST_INSERT_ID() as value
- </selectKey>
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (?,?);
- </insert>
-
- <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
- <insert id="InsertCategoryNull" parameterMap="insert-null-params">
- <selectKey property="Id" type="post" resultClass="int">
- select LAST_INSERT_ID() as value
- </selectKey>
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (?,?);
- </insert>
-
- <update id="UpdateCategoryViaParameterMap" parameterMap="UpdateParam">
- update Categories set
- Category_Name =?,
- Category_Guid = ?
- where
- Category_Id = ?
- </update>
-
- <procedure id="InsertCategoryViaStoreProcedure" parameterMap="category-insert-params">
- ps_InsertCategorie
- </procedure>
-
- <insert id="InsertCategoryGenerate" parameterMap="insert-generate-params">
- <selectKey property="Id" type="post" resultClass="int">
- select LAST_INSERT_ID() as value
- </selectKey>
- <generate table="Categories" />
- </insert>
-
- <update id="UpdateCategoryGenerate" parameterMap="update-generate-params">
- <generate table="Categories" by="Category_Id"/>
- </update>
-
- <delete id="DeleteCategoryGenerate" parameterMap="delete-generate-params">
- <generate table="Categories" by="Category_Id, Category_Name"/>
- </delete>
-
- <select id="SelectByPKCategoryGenerate" resultClass="Category" parameterClass="Category" parameterMap="select-generate-params">
- <generate table="Categories" by="Category_Id"/>
- </select>
-
- <select id="SelectAllCategoryGenerate" resultClass="Category" parameterMap="select-generate-params">
- <generate table="Categories" />
- </select>
-
- <statement id="DynamicGuid"
- resultClass="Category"
- parameterClass="Category">
- select
- Category_ID as Id,
- Category_Name as Name,
- Category_Guid as Guid
- from Categories
- <dynamic prepend="where">
- <isNotEqual prepend="and" property="Guid" compareProperty="EmptyGuid">
- Category_Guid=#GuidString:Varchar#
- </isNotEqual>
- </dynamic>
- </statement>
- <parameterMap id="category-insert-params">
- <parameter property="Id" column="Category_Id" dbType="Int32" />
- <parameter property="Name" column="Category_Name"/>
- <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
- </parameterMap>
-
- <parameterMap id="InsertParam">
- <parameter property="Name" column="Category_Name"/>
- <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
- </parameterMap>
-
- <parameterMap id="insert-null-params">
- <parameter property="Name" column="Category_Name"/>
- <parameter property="GuidString" column="Category_Guid" nullValue="00000000-0000-0000-0000-000000000000" dbType="Varchar"/>
- </parameterMap>
-
- <parameterMap id="UpdateParam" extends="InsertParam">
- <parameter property="Id" column="Category_Id" />
- </parameterMap>
-
- <!-- Used by generated statement -->
-
- <parameterMap id="insert-generate-params">
- <parameter property="Name" column="Category_Name"/>
- <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
- </parameterMap>
-
- <parameterMap id="update-generate-params" extends="insert-generate-params">
- <parameter property="Id" column="Category_Id" />
- </parameterMap>
-
- <parameterMap id="delete-generate-params">
- <parameter property="Id" column="Category_Id" />
- <parameter property="Name" column="Category_Name"/>
- </parameterMap>
-
- <parameterMap id="select-generate-params">
- <parameter property="Id" column="Category_Id" />
- <parameter property="Name" column="Category_Name"/>
- <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
- </parameterMap>
-
-
-</sqlMap>
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Category" >
+
+ <alias>
+ <typeAlias alias="Category" type="IBatisNet.DataMapper.Test.Domain.Category, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+
+ <select id="GetCategory" parameterClass="Integer" resultClass="Category">
+ select
+ Category_ID as Id,
+ Category_Name as Name,
+ Category_Guid as GuidString
+ from Categories
+ where Category_ID = #value#
+ </select>
+
+ <select id="GetCategoryGuid" parameterClass="Integer" resultClass="guid">
+ select
+ Category_Guid as value
+ from Categories
+ where Category_ID = #value#
+ </select>
+
+ <!-- Test for statement as insert -->
+ <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
+ <insert id="InsertCategory" parameterClass="Category">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (#Name#, #GuidString:Varchar#);
+ </insert>
+
+ <!-- -->
+ <insert id="InsertCategoryViaInsertStatement" parameterClass="Category" >
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (#Name#, #GuidString:Varchar#)
+ </insert>
+
+ <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
+ <insert id="InsertCategoryViaParameterMap" parameterMap="InsertParam">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (?,?);
+ </insert>
+
+ <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
+ <insert id="InsertCategoryNull" parameterMap="insert-null-params">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (?,?);
+ </insert>
+
+ <update id="UpdateCategoryViaParameterMap" parameterMap="UpdateParam">
+ update Categories set
+ Category_Name =?,
+ Category_Guid = ?
+ where
+ Category_Id = ?
+ </update>
+
+ <procedure id="InsertCategoryViaStoreProcedure" parameterMap="category-insert-params">
+ ps_InsertCategorie
+ </procedure>
+
+ <insert id="InsertCategoryGenerate" parameterMap="insert-generate-params">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ <generate table="Categories" />
+ </insert>
+
+ <update id="UpdateCategoryGenerate" parameterMap="update-generate-params">
+ <generate table="Categories" by="Category_Id"/>
+ </update>
+
+ <delete id="DeleteCategoryGenerate" parameterMap="delete-generate-params">
+ <generate table="Categories" by="Category_Id, Category_Name"/>
+ </delete>
+
+ <select id="SelectByPKCategoryGenerate" resultClass="Category" parameterClass="Category" parameterMap="select-generate-params">
+ <generate table="Categories" by="Category_Id"/>
+ </select>
+
+ <select id="SelectAllCategoryGenerate" resultClass="Category" parameterMap="select-generate-params">
+ <generate table="Categories" />
+ </select>
+
+ <statement id="DynamicGuid"
+ resultClass="Category"
+ parameterClass="Category">
+ select
+ Category_ID as Id,
+ Category_Name as Name,
+ Category_Guid as Guid
+ from Categories
+ <dynamic prepend="where">
+ <isNotEqual prepend="and" property="Guid" compareProperty="EmptyGuid">
+ Category_Guid=#GuidString:Varchar#
+ </isNotEqual>
+ </dynamic>
+ </statement>
+ <parameterMap id="category-insert-params">
+ <parameter property="Id" column="Category_Id" dbType="Int32" />
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="InsertParam">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="insert-null-params">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" nullValue="00000000-0000-0000-0000-000000000000" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="UpdateParam" extends="InsertParam">
+ <parameter property="Id" column="Category_Id" />
+ </parameterMap>
+
+ <!-- Used by generated statement -->
+
+ <parameterMap id="insert-generate-params">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="update-generate-params" extends="insert-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ </parameterMap>
+
+ <parameterMap id="delete-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ <parameter property="Name" column="Category_Name"/>
+ </parameterMap>
+
+ <parameterMap id="select-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/Complex.xml b/tests/unit/Data/SqlMap/maps/MySql/Complex.xml
index f6da811d..c596e555 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/Complex.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/Complex.xml
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Complex" >
-
- <statements>
-
- <statement id="ComplexMap"
- resultClass="int" >
- select Account_ID from Accounts where Account_ID = #obj.Map.Id#
- </statement>
-
- <insert id="InsertComplexAccountViaInlineDefaultNull"
- parameterClass="Hashtable" >
- insert into Accounts
- (Account_ID, Account_FirstName, Account_LastName, Account_Email)
- values
- (#obj.Map.acct.Id#, #obj.Map.acct.FirstName#, #obj.Map.acct.LastName#, #obj.Map.acct.EmailAddress:Varchar:no_email@provided.com#
- )
- </insert>
-
- </statements>
-
-
-</sqlMap>
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Complex" >
+
+ <statements>
+
+ <statement id="ComplexMap"
+ resultClass="int" >
+ select Account_ID from Accounts where Account_ID = #obj.Map.Id#
+ </statement>
+
+ <insert id="InsertComplexAccountViaInlineDefaultNull"
+ parameterClass="Hashtable" >
+ insert into Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#obj.Map.acct.Id#, #obj.Map.acct.FirstName#, #obj.Map.acct.LastName#, #obj.Map.acct.EmailAddress:Varchar:no_email@provided.com#
+ )
+ </insert>
+
+ </statements>
+
+
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/MySql/Document.xml b/tests/unit/Data/SqlMap/maps/MySql/Document.xml
index 40608c97..805ad9d4 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/Document.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/Document.xml
@@ -1,53 +1,53 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Document" >
- <resultMap id="document" class="Document">
- <result property="Id" column="Document_Id"/>
- <result property="Title" column="Document_Title"/>
- <discriminator column="Document_Type" type="string"/>
- <subMap value="Book" resultMapping="book" />
- <subMap value="Newspaper" resultMapping="newspaper" />
- </resultMap>
-
- <resultMap id="document-custom-handler" class="Document">
- <result property="Id" column="Document_Id"/>
- <result property="Title" column="Document_Title"/>
- <discriminator column="Document_Type" typeHandler="CustomInheritance"/>
- <subMap value="Book" resultMapping="book" />
- <subMap value="Newspaper" resultMapping="newspaper" />
- </resultMap>
-
- <resultMap id="book" class="Book" extends="document">
- <result property="PageNumber" column="Document_PageNumber"/>
- </resultMap>
-
- <resultMap id="newspaper" class="Newspaper" extends="document">
- <result property="City" column="Document_City"/>
- </resultMap>
-
-
- <statement id="GetAllDocument"
- resultMap="document">
- select
- *
- from Documents
- order by Document_Type, Document_Id
- </statement>
-
- <select id="GetTypedCollection"
- listClass="DocumentCollection"
- resultMap="document">
- select
- *
- from Documents
- order by Document_Type, Document_Id
- </select>
-
- <select id="GetAllDocumentWithCustomTypeHandler"
- resultMap="document-custom-handler">
- select
- *
- from Documents
- order by Document_Type, Document_Id
- </select>
-
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Document" >
+ <resultMap id="document" class="Document">
+ <result property="Id" column="Document_Id"/>
+ <result property="Title" column="Document_Title"/>
+ <discriminator column="Document_Type" type="string"/>
+ <subMap value="Book" resultMapping="book" />
+ <subMap value="Newspaper" resultMapping="newspaper" />
+ </resultMap>
+
+ <resultMap id="document-custom-handler" class="Document">
+ <result property="Id" column="Document_Id"/>
+ <result property="Title" column="Document_Title"/>
+ <discriminator column="Document_Type" typeHandler="CustomInheritance"/>
+ <subMap value="Book" resultMapping="book" />
+ <subMap value="Newspaper" resultMapping="newspaper" />
+ </resultMap>
+
+ <resultMap id="book" class="Book" extends="document">
+ <result property="PageNumber" column="Document_PageNumber"/>
+ </resultMap>
+
+ <resultMap id="newspaper" class="Newspaper" extends="document">
+ <result property="City" column="Document_City"/>
+ </resultMap>
+
+
+ <statement id="GetAllDocument"
+ resultMap="document">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_Id
+ </statement>
+
+ <select id="GetTypedCollection"
+ listClass="DocumentCollection"
+ resultMap="document">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_Id
+ </select>
+
+ <select id="GetAllDocumentWithCustomTypeHandler"
+ resultMap="document-custom-handler">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_Id
+ </select>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/MySql/DynamicAccount.xml b/tests/unit/Data/SqlMap/maps/MySql/DynamicAccount.xml
index ee565158..5696ac65 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/DynamicAccount.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/DynamicAccount.xml
@@ -1,449 +1,449 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Account" >
-
- <alias>
- <typeAlias alias="Search" type="IBatisNet.DataMapper.Test.Domain.Search, IBatisNet.DataMapper.Test"/>
- </alias>
-
- <statements>
-
- <select id="DynamicAll"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- </select>
-
- <select id="DynamicWithExtend"
- extends="DynamicAll"
- parameterClass="Account"
- resultClass="Account">
- <dynamic prepend="WHERE" >
- <isGreaterThan prepend="AND" property="Id" compareValue="0" >
- Account_ID = #Id#
- </isGreaterThan>
- <isNotNull prepend="AND" property="Ids" >
- Account_ID in
- <iterate property="Ids" open="(" close=")" conjunction="," >
- #Ids[]#
- </iterate>
- </isNotNull>
- <isNotEmpty prepend="AND" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="EmailAddress" >
- <isEqual property="EmailAddress" compareValue="Joe">
- Account_Email = 'clinton.begin@ibatis.com'
- </isEqual>
- <isNotEqual property="EmailAddress" compareValue="Joe">
- Account_Email = #EmailAddress#
- </isNotEqual>
- </isNotEmpty>
- </dynamic>
- </select>
-
- <!-- IBATISNET-114: remapResults
- <statement id="DynamicSqlOnColumnSelection"
- parameterClass="Account"
- resultClass="Account"
- remapResults="true">
- SELECT
- Account_ID as Id,
- <dynamic>
- <isEqual property="LastName" compareValue="Dalton" >
- Account_FirstName as FirstName,
- </isEqual>
- <isEqual property="LastName" compareValue="Dalton" >
- Account_LastName as LastName,
- </isEqual>
- </dynamic>
-
- Account_Email as EmailAddress
- FROM
- Accounts
- </statement>
- -->
-
- <statement id="DynamicIsEqual"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isEqual compareValue="Joe" >
- where Account_FirstName = 'Joe'
- </isEqual>
- </statement>
-
- <statement id="DynamicIsParameterPresent"
- parameterClass="integer"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isParameterPresent >
- where Account_ID = #value#
- </isParameterPresent>
- </statement>
-
- <statement id="DynamicIsNotEmpty"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isNotEmpty>
- where Account_FirstName = #value#
- </isNotEmpty>
- </statement>
-
- <statement id="DynamicIsGreater"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isGreaterThan compareValue="3" >
- where Account_ID = 1
- </isGreaterThan>
- </statement>
-
- <statement id="DynamicIsGreaterEqual"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isGreaterEqual compareValue="3" >
- where Account_ID = 1
- </isGreaterEqual>
- </statement>
-
- <statement id="DynamicIsLess"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isLessThan compareValue="3" >
- where Account_ID = 1
- </isLessThan>
- </statement>
-
- <statement id="DynamicIsLessEqual"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isLessEqual compareValue="3" >
- where Account_ID = 1
- </isLessEqual>
- </statement>
-
- <statement id="DynamicIsNotNull"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isNotNull>
- where Account_ID = 1
- </isNotNull>
- </statement>
-
- <statement id="DynamicIsPropertyAvailable"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isPropertyAvailable property="Id" >
- where Account_ID = 1
- </isPropertyAvailable>
- </statement>
-
-
- <statement id="DynamicSubst"
- parameterClass="map"
- resultClass="Account">
- <dynamic>
- $statement$
- </dynamic>
- </statement>
-
- <statement id="DynamicIterate"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- WHERE Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- </statement>
-
- <statement id="DynamicIterate2"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- WHERE Account_ID IN
- <iterate property="Ids" open="(" close=")" conjunction="," >
- #Ids[]#
- </iterate>
- </statement>
-
- <statement id="MultiDynamicIterate"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- WHERE Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- and Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- </statement>
-
-
- <statement id="DynamicQueryByExample"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="WHERE" >
- <isGreaterThan prepend="AND" property="Id" compareValue="0" >
- Account_ID = #Id#
- </isGreaterThan>
- <isNotNull prepend="AND" property="Ids" >
- Account_ID in
- <iterate property="Ids" open="(" close=")" conjunction="," >
- #Ids[]#
- </iterate>
- </isNotNull>
- <isNotEmpty prepend="AND" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="EmailAddress" >
- <isEqual property="EmailAddress" compareValue="Joe">
- Account_Email = 'clinton.begin@ibatis.com'
- </isEqual>
- <isNotEqual property="EmailAddress" compareValue="Joe">
- Account_Email = #EmailAddress#
- </isNotEqual>
- </isNotEmpty>
- </dynamic>
- </statement>
-
- <statement id="DynamicIterateWithPrepend1"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where" >
- Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- </dynamic>
- </statement>
-
- <statement id="DynamicIterateWithPrepend2"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where" >
- <iterate open="(" close=")" conjunction="OR">
- Account_ID = #[]#
- </iterate>
- </dynamic>
- </statement>
-
- <statement id="DynamicIterateWithPrepend3"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where" >
- <isParameterPresent prepend="BLAH!" >
- <iterate open="(" close=")" conjunction="OR">
- Account_ID = #[]#
- </iterate>
- </isParameterPresent>
- </dynamic>
- </statement>
-
- <statement id="DynamicWithPrepend"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where">
- <isParameterPresent>
- <isNotEmpty prepend="and" property="Id" >
- Account_ID = #Id#
- </isNotEmpty>
- <isNotEmpty prepend="and" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="and" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- </isParameterPresent>
- </dynamic>
- </statement>
-
- <statement id="DynamicWithTwoDynamicElements"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where">
- <isNotEmpty prepend="BLAH!" property="Id" >
- Account_ID = #Id#
- </isNotEmpty>
- </dynamic>
- <dynamic prepend="and">
- <isNotEmpty prepend="BLAH!" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="and" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- </dynamic>
- </statement>
-
- <statement id="ComplexDynamicStatement"
- cacheModel="account-cache"
- resultClass="Account"
- parameterClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="WHERE">
- <isNotNull prepend="AND" property="FirstName">
- (Account_FirstName = #FirstName#
- <isNotNull prepend="OR" property="LastName">
- Account_LastName = #LastName#
- </isNotNull>
- )
- </isNotNull>
- <isNotNull prepend="AND" property="EmailAddress">
- Account_Email like #EmailAddress#
- </isNotNull>
- <isGreaterThan prepend="AND" property="Id" compareValue="0">
- Account_ID = #Id#
- </isGreaterThan>
- </dynamic>
- order by Account_LastName
- </statement>
-
- <statement id="Jira-IBATISNET-11"
- resultClass="Account"
- parameterClass="Search">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where">
- <isNotNull prepend="and" property="NumberSearch">
- ((Account_ID $Operande$ #NumberSearch#) or
- (Account_ID $Operande$ #NumberSearch#))
- </isNotNull>
- <isEqual prepend="and" property="StartDate" compareValue="25/12/2004">
- <![CDATA[Account_FirstName >= #StartDate# ]]>
- </isEqual>
- <isEqual prepend="and" property="StartDateAnd" compareValue="true">
- <![CDATA[Account_LastName >= #StartDate# ]]>
- </isEqual>
- </dynamic>
-
- order by Account_LastName
- </statement>
- </statements>
-
-
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Account" >
+
+ <alias>
+ <typeAlias alias="Search" type="IBatisNet.DataMapper.Test.Domain.Search, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+ <statements>
+
+ <select id="DynamicAll"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ </select>
+
+ <select id="DynamicWithExtend"
+ extends="DynamicAll"
+ parameterClass="Account"
+ resultClass="Account">
+ <dynamic prepend="WHERE" >
+ <isGreaterThan prepend="AND" property="Id" compareValue="0" >
+ Account_ID = #Id#
+ </isGreaterThan>
+ <isNotNull prepend="AND" property="Ids" >
+ Account_ID in
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </isNotNull>
+ <isNotEmpty prepend="AND" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="EmailAddress" >
+ <isEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = 'clinton.begin@ibatis.com'
+ </isEqual>
+ <isNotEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = #EmailAddress#
+ </isNotEqual>
+ </isNotEmpty>
+ </dynamic>
+ </select>
+
+ <!-- IBATISNET-114: remapResults
+ <statement id="DynamicSqlOnColumnSelection"
+ parameterClass="Account"
+ resultClass="Account"
+ remapResults="true">
+ SELECT
+ Account_ID as Id,
+ <dynamic>
+ <isEqual property="LastName" compareValue="Dalton" >
+ Account_FirstName as FirstName,
+ </isEqual>
+ <isEqual property="LastName" compareValue="Dalton" >
+ Account_LastName as LastName,
+ </isEqual>
+ </dynamic>
+
+ Account_Email as EmailAddress
+ FROM
+ Accounts
+ </statement>
+ -->
+
+ <statement id="DynamicIsEqual"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isEqual compareValue="Joe" >
+ where Account_FirstName = 'Joe'
+ </isEqual>
+ </statement>
+
+ <statement id="DynamicIsParameterPresent"
+ parameterClass="integer"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isParameterPresent >
+ where Account_ID = #value#
+ </isParameterPresent>
+ </statement>
+
+ <statement id="DynamicIsNotEmpty"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isNotEmpty>
+ where Account_FirstName = #value#
+ </isNotEmpty>
+ </statement>
+
+ <statement id="DynamicIsGreater"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isGreaterThan compareValue="3" >
+ where Account_ID = 1
+ </isGreaterThan>
+ </statement>
+
+ <statement id="DynamicIsGreaterEqual"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isGreaterEqual compareValue="3" >
+ where Account_ID = 1
+ </isGreaterEqual>
+ </statement>
+
+ <statement id="DynamicIsLess"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isLessThan compareValue="3" >
+ where Account_ID = 1
+ </isLessThan>
+ </statement>
+
+ <statement id="DynamicIsLessEqual"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isLessEqual compareValue="3" >
+ where Account_ID = 1
+ </isLessEqual>
+ </statement>
+
+ <statement id="DynamicIsNotNull"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isNotNull>
+ where Account_ID = 1
+ </isNotNull>
+ </statement>
+
+ <statement id="DynamicIsPropertyAvailable"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isPropertyAvailable property="Id" >
+ where Account_ID = 1
+ </isPropertyAvailable>
+ </statement>
+
+
+ <statement id="DynamicSubst"
+ parameterClass="map"
+ resultClass="Account">
+ <dynamic>
+ $statement$
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterate"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </statement>
+
+ <statement id="DynamicIterate2"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </statement>
+
+ <statement id="MultiDynamicIterate"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ and Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </statement>
+
+
+ <statement id="DynamicQueryByExample"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="WHERE" >
+ <isGreaterThan prepend="AND" property="Id" compareValue="0" >
+ Account_ID = #Id#
+ </isGreaterThan>
+ <isNotNull prepend="AND" property="Ids" >
+ Account_ID in
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </isNotNull>
+ <isNotEmpty prepend="AND" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="EmailAddress" >
+ <isEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = 'clinton.begin@ibatis.com'
+ </isEqual>
+ <isNotEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = #EmailAddress#
+ </isNotEqual>
+ </isNotEmpty>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend1"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend2"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ <iterate open="(" close=")" conjunction="OR">
+ Account_ID = #[]#
+ </iterate>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend3"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ <isParameterPresent prepend="BLAH!" >
+ <iterate open="(" close=")" conjunction="OR">
+ Account_ID = #[]#
+ </iterate>
+ </isParameterPresent>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicWithPrepend"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isParameterPresent>
+ <isNotEmpty prepend="and" property="Id" >
+ Account_ID = #Id#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ </isParameterPresent>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicWithTwoDynamicElements"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isNotEmpty prepend="BLAH!" property="Id" >
+ Account_ID = #Id#
+ </isNotEmpty>
+ </dynamic>
+ <dynamic prepend="and">
+ <isNotEmpty prepend="BLAH!" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ </dynamic>
+ </statement>
+
+ <statement id="ComplexDynamicStatement"
+ cacheModel="account-cache"
+ resultClass="Account"
+ parameterClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="WHERE">
+ <isNotNull prepend="AND" property="FirstName">
+ (Account_FirstName = #FirstName#
+ <isNotNull prepend="OR" property="LastName">
+ Account_LastName = #LastName#
+ </isNotNull>
+ )
+ </isNotNull>
+ <isNotNull prepend="AND" property="EmailAddress">
+ Account_Email like #EmailAddress#
+ </isNotNull>
+ <isGreaterThan prepend="AND" property="Id" compareValue="0">
+ Account_ID = #Id#
+ </isGreaterThan>
+ </dynamic>
+ order by Account_LastName
+ </statement>
+
+ <statement id="Jira-IBATISNET-11"
+ resultClass="Account"
+ parameterClass="Search">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isNotNull prepend="and" property="NumberSearch">
+ ((Account_ID $Operande$ #NumberSearch#) or
+ (Account_ID $Operande$ #NumberSearch#))
+ </isNotNull>
+ <isEqual prepend="and" property="StartDate" compareValue="25/12/2004">
+ <![CDATA[Account_FirstName >= #StartDate# ]]>
+ </isEqual>
+ <isEqual prepend="and" property="StartDateAnd" compareValue="true">
+ <![CDATA[Account_LastName >= #StartDate# ]]>
+ </isEqual>
+ </dynamic>
+
+ order by Account_LastName
+ </statement>
+ </statements>
+
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/MySql/Enumeration.xml b/tests/unit/Data/SqlMap/maps/MySql/Enumeration.xml
index b321259e..930f2e5e 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/Enumeration.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/Enumeration.xml
@@ -1,59 +1,59 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMap namespace="Enumeration" >
-
- <alias>
- <typeAlias alias="Enumeration" type="IBatisNet.DataMapper.Test.Domain.Enumeration, IBatisNet.DataMapper.Test"/>
- </alias>
-
- <resultMaps>
- <resultMap id="enumeration-result" class="Enumeration" >
- <result property="Id" column="Enum_ID"/>
- <result property="Day" column="Enum_Day"/>
- <result property="Color" column="Enum_Color"/>
- <result property="Month" column="Enum_Month" nullValue="All"/>
- </resultMap>
- </resultMaps>
-
- <statements>
-
- <select id="GetEnumerationNullValue"
- parameterClass="Integer"
- resultMap="enumeration-result">
- select
- Enum_ID,
- Enum_Day,
- Enum_Color,
- Enum_Month
- from Enumerations
- where Enum_ID = #value#
- </select>
-
- <select id="GetEnumeration" parameterClass="Integer" resultClass="Enumeration">
- select
- Enum_ID as Id,
- Enum_Day as Day,
- Enum_Color as Color,
- Enum_Month as Month
- from Enumerations
- where Enum_ID = #value#
- </select>
-
- <insert id="InsertEnumViaParameterMap" parameterMap="insert-params" >
- insert into Enumerations
- (Enum_ID, Enum_Day, Enum_Color, Enum_Month)
- values
- (?, ?, ?, ?)
- </insert>
-
- </statements>
-
- <parameterMaps>
- <parameterMap id="insert-params">
- <parameter property="Id" column="Enum_ID" />
- <parameter property="Day" column="Enum_Day"/>
- <parameter property="Color" column="Enum_Color" />
- <parameter property="Month" column="Enum_Month" nullValue="All"/>
- </parameterMap>
- </parameterMaps>
-
-</sqlMap>
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Enumeration" >
+
+ <alias>
+ <typeAlias alias="Enumeration" type="IBatisNet.DataMapper.Test.Domain.Enumeration, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+ <resultMaps>
+ <resultMap id="enumeration-result" class="Enumeration" >
+ <result property="Id" column="Enum_ID"/>
+ <result property="Day" column="Enum_Day"/>
+ <result property="Color" column="Enum_Color"/>
+ <result property="Month" column="Enum_Month" nullValue="All"/>
+ </resultMap>
+ </resultMaps>
+
+ <statements>
+
+ <select id="GetEnumerationNullValue"
+ parameterClass="Integer"
+ resultMap="enumeration-result">
+ select
+ Enum_ID,
+ Enum_Day,
+ Enum_Color,
+ Enum_Month
+ from Enumerations
+ where Enum_ID = #value#
+ </select>
+
+ <select id="GetEnumeration" parameterClass="Integer" resultClass="Enumeration">
+ select
+ Enum_ID as Id,
+ Enum_Day as Day,
+ Enum_Color as Color,
+ Enum_Month as Month
+ from Enumerations
+ where Enum_ID = #value#
+ </select>
+
+ <insert id="InsertEnumViaParameterMap" parameterMap="insert-params" >
+ insert into Enumerations
+ (Enum_ID, Enum_Day, Enum_Color, Enum_Month)
+ values
+ (?, ?, ?, ?)
+ </insert>
+
+ </statements>
+
+ <parameterMaps>
+ <parameterMap id="insert-params">
+ <parameter property="Id" column="Enum_ID" />
+ <parameter property="Day" column="Enum_Day"/>
+ <parameter property="Color" column="Enum_Color" />
+ <parameter property="Month" column="Enum_Month" nullValue="All"/>
+ </parameterMap>
+ </parameterMaps>
+
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/MySql/LineItem.xml b/tests/unit/Data/SqlMap/maps/MySql/LineItem.xml
index c9778d9d..c29524c2 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/LineItem.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/LineItem.xml
@@ -1,188 +1,188 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sqlMap namespace="LineItem" >
-
- <alias>
- <typeAlias alias="LineItem" type="IBatisNet.DataMapper.Test.Domain.LineItem, IBatisNet.DataMapper.Test" />
- <typeAlias alias="LineItemCollection" type="IBatisNet.DataMapper.Test.Domain.LineItemCollection, IBatisNet.DataMapper.Test" />
- </alias>
-
- <resultMap id="LineItem-Price" class="float">
- <result property="value" column="LineItem_Price"/>
- </resultMap>
-
- <resultMap id="LineItem" class="LineItem">
- <result property="Id" column="LineItem_Id"/>
- <result property="Code" column="LineItem_Code"/>
- <result property="Quantity" column="LineItem_Quantity"/>
- <result property="Price" column="LineItem_Price"/>
- </resultMap>
-
- <resultMap id="LineItemWithNullReplacement" class="LineItem">
- <result property="Id" column="LineItem_Id"/>
- <result property="Code" column="LineItem_Code"/>
- <result property="Quantity" column="LineItem_Quantity"/>
- <result property="Price" column="LineItem_Price" nullValue="-77.77"/>
- </resultMap>
-
-
- <statement id="GetLineItemPrice"
- parameterClass="array"
- resultMap="LineItem-Price" >
- select
- LineItem_Price
- from LineItems
- where Order_ID = #Order_ID#
- and LineItem_ID = #LineItem_ID#
- </statement>
-
- <statement id="GetLineItemsForOrder"
- parameterClass="int"
- listClass="TList"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems where Order_ID = #value#
- </statement>
-
-
- <statement id="GetLineItemsForOrderWithListClass"
- parameterClass="int"
- listClass="LineItemCollection"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems where Order_ID = #value#
- order by LineItem_Code
- </statement>
-
- <statement id="GetSpecificLineItem"
- parameterClass="array"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems
- where Order_ID = #Order_ID#
- and LineItem_ID = #LineItem_ID#
- </statement>
-
- <statement id="GetSpecificLineItemWithPicture"
- parameterClass="array"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price,
- LineItem_Picture as PictureData
- from LineItems
- where Order_ID = #Order_ID#
- and LineItem_ID = #LineItem_ID#
- </statement>
-
- <select id="GetDynSpecificLineItem"
- parameterClass="array"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems
- where Order_ID = #Order_ID#
- <dynamic>
- <isNotNull property="LineItem_ID">
- and LineItem_ID = #LineItem_ID#
- </isNotNull>
- </dynamic>
- </select>
-
- <statement id="GetSpecificLineItemWithNullReplacement"
- parameterClass="int"
- resultMap="LineItemWithNullReplacement">
- select
- LineItem_ID,
- LineItem_Code,
- LineItem_Quantity,
- LineItem_Price
- from LineItems
- where LineItem_ID = #value#
- </statement>
-
- <statement id="InsertLineItem"
- parameterMap="line-item-insert-params" >
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (?, ?, ?, ?, ?);
- </statement>
-
- <statement id="InsertLineItemWithPicture"
- parameterMap="line-item-insert-params-picture" >
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price, LineItem_Picture)
- values
- (?, ?, ?, ?, ?, ?);
- </statement>
-
- <insert id="InsertLineItemPostKey" parameterClass="LineItem">
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
- <selectKey property="Id" type="post" resultClass="int" >
- select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
- </selectKey>
- </insert>
-
- <insert id="InsertLineItemPreKey" parameterClass="LineItem">
- <selectKey property="Id" type="pre" resultClass="int" >
- select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
- </selectKey>
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
- </insert>
-
- <insert id="InsertLineItemNoKey" parameterClass="LineItem">
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
- </insert>
-
- <!-- JIRA 23 -->
- <delete id="DeleteWithComments" >
- <!-- Delete LineItems -->
- delete from LineItems where Order_ID = 10;
- <!-- Delete LineItems -->
- </delete>
-
- <parameterMap id="line-item-insert-params">
- <parameter property="Id" />
- <parameter property="Order.Id" />
- <parameter property="Code" />
- <parameter property="Quantity" />
- <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
- </parameterMap>
-
- <parameterMap id="line-item-insert-params-picture">
- <parameter property="Id" />
- <parameter property="Order.Id" />
- <parameter property="Code" />
- <parameter property="Quantity" />
- <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
- <parameter property="PictureData" dbType="Blob" />
- </parameterMap>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="LineItem" >
+
+ <alias>
+ <typeAlias alias="LineItem" type="IBatisNet.DataMapper.Test.Domain.LineItem, IBatisNet.DataMapper.Test" />
+ <typeAlias alias="LineItemCollection" type="IBatisNet.DataMapper.Test.Domain.LineItemCollection, IBatisNet.DataMapper.Test" />
+ </alias>
+
+ <resultMap id="LineItem-Price" class="float">
+ <result property="value" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="LineItem" class="LineItem">
+ <result property="Id" column="LineItem_Id"/>
+ <result property="Code" column="LineItem_Code"/>
+ <result property="Quantity" column="LineItem_Quantity"/>
+ <result property="Price" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="LineItemWithNullReplacement" class="LineItem">
+ <result property="Id" column="LineItem_Id"/>
+ <result property="Code" column="LineItem_Code"/>
+ <result property="Quantity" column="LineItem_Quantity"/>
+ <result property="Price" column="LineItem_Price" nullValue="-77.77"/>
+ </resultMap>
+
+
+ <statement id="GetLineItemPrice"
+ parameterClass="array"
+ resultMap="LineItem-Price" >
+ select
+ LineItem_Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <statement id="GetLineItemsForOrder"
+ parameterClass="int"
+ listClass="TList"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems where Order_ID = #value#
+ </statement>
+
+
+ <statement id="GetLineItemsForOrderWithListClass"
+ parameterClass="int"
+ listClass="LineItemCollection"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems where Order_ID = #value#
+ order by LineItem_Code
+ </statement>
+
+ <statement id="GetSpecificLineItem"
+ parameterClass="array"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <statement id="GetSpecificLineItemWithPicture"
+ parameterClass="array"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price,
+ LineItem_Picture as PictureData
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <select id="GetDynSpecificLineItem"
+ parameterClass="array"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ <dynamic>
+ <isNotNull property="LineItem_ID">
+ and LineItem_ID = #LineItem_ID#
+ </isNotNull>
+ </dynamic>
+ </select>
+
+ <statement id="GetSpecificLineItemWithNullReplacement"
+ parameterClass="int"
+ resultMap="LineItemWithNullReplacement">
+ select
+ LineItem_ID,
+ LineItem_Code,
+ LineItem_Quantity,
+ LineItem_Price
+ from LineItems
+ where LineItem_ID = #value#
+ </statement>
+
+ <statement id="InsertLineItem"
+ parameterMap="line-item-insert-params" >
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (?, ?, ?, ?, ?);
+ </statement>
+
+ <statement id="InsertLineItemWithPicture"
+ parameterMap="line-item-insert-params-picture" >
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price, LineItem_Picture)
+ values
+ (?, ?, ?, ?, ?, ?);
+ </statement>
+
+ <insert id="InsertLineItemPostKey" parameterClass="LineItem">
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
+ <selectKey property="Id" type="post" resultClass="int" >
+ select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
+ </selectKey>
+ </insert>
+
+ <insert id="InsertLineItemPreKey" parameterClass="LineItem">
+ <selectKey property="Id" type="pre" resultClass="int" >
+ select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
+ </selectKey>
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
+ </insert>
+
+ <insert id="InsertLineItemNoKey" parameterClass="LineItem">
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
+ </insert>
+
+ <!-- JIRA 23 -->
+ <delete id="DeleteWithComments" >
+ <!-- Delete LineItems -->
+ delete from LineItems where Order_ID = 10;
+ <!-- Delete LineItems -->
+ </delete>
+
+ <parameterMap id="line-item-insert-params">
+ <parameter property="Id" />
+ <parameter property="Order.Id" />
+ <parameter property="Code" />
+ <parameter property="Quantity" />
+ <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
+ </parameterMap>
+
+ <parameterMap id="line-item-insert-params-picture">
+ <parameter property="Id" />
+ <parameter property="Order.Id" />
+ <parameter property="Code" />
+ <parameter property="Quantity" />
+ <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
+ <parameter property="PictureData" dbType="Blob" />
+ </parameterMap>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/MySql/Order.xml b/tests/unit/Data/SqlMap/maps/MySql/Order.xml
index ac3b7b84..a62df9e1 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/Order.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/Order.xml
@@ -1,468 +1,468 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sqlMap namespace="Order">
-
- <alias>
- <typeAlias alias="Order" type="IBatisNet.DataMapper.Test.Domain.Order, IBatisNet.DataMapper.Test" />
- </alias>
-
- <!-- If the type is not specified, ADO.NET infers the
- data provider Type of the Parameter from the Value property
- of the Parameter object. -->
-
-
- <resultMap id="credit-card-result" class="string">
- <result property="value" column="Order_CardNumber"/>
- </resultMap>
- <!-- -->
- <resultMap id="order-with-lines-result" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItemsList" lazyLoad="true" type="TList" column="Order_Id" select="GetLineItemsForOrder" />
- </resultMap>
-
- <resultMap id="order-with-lines-result-no-lazy-load" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItemsList" type="TList" column="Order_Id" select="GetLineItemsForOrder" />
- </resultMap>
-
- <resultMap id="order-with-lines-result-statement-namespaces" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItemsList" lazyLoad="true" type="TList" column="Order_Id" select="LineItem.GetLineItemsForOrder" />
- </resultMap>
-
- <resultMap id="order-with-lines-collection" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItems" column="Order_Id" lazyLoad="true"
- select="GetLineItemsForOrderWithListClass" />
- </resultMap>
-
- <resultMap id="order-with-lines-collection-no-lazy-load" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItems" column="Order_Id"
- select="GetLineItemsForOrderWithListClass" />
- </resultMap>
-
- <resultMap id="order-with-lines-array" class="Order"
- extends="lite-order-result-by-name">
- <result property="LineItemsArray" column="Order_Id" select="GetLineItemsForOrder"/>
- </resultMap>
-
- <resultMap id="lite-order-map-result" class="array">
- <result property="Id" type="Int" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" type="string" column="Order_CardExpiry"/>
- <result property="CardType" type="string" column="Order_CardType"/>
- <result property="CardNumber" type="string" column="Order_CardNumber"/>
- <result property="Street" type="string" column="Order_Street"/>
- <result property="City" type="string" column="Order_City"/>
- <result property="Province" type="string" column="Order_Province"/>
- <result property="PostalCode" type="string" column="Order_PostalCode"/>
- </resultMap>
-
- <resultMap id="lite-order-result-by-name" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- </resultMap>
-
- <resultMap id="order-hash" class="array">
- <result property="Date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- </resultMap>
-
- <resultMap id="order-with-types-result" class="Order">
- <result property="Id" column="Order_Id" />
- <result property="Date" column="Order_Date" type="date" />
- <result property="CardExpiry" column="Order_CardExpiry" />
- <result property="CardType" column="Order_CardType" />
- <result property="CardNumber" column="Order_CardNumber" />
- <result property="Street" column="Order_Street" />
- <result property="City" column="Order_City" />
- <result property="Province" column="Order_Province" />
- <result property="PostalCode" column="Order_PostalCode" />
- </resultMap>
-
- <resultMap id="lite-order-result-by-index" class="Order">
- <result property="Id" column="Order_Id" columnIndex="0"/>
- <result property="Date" column="Order_Date" type="date" columnIndex="1" />
- <result property="CardExpiry" column="Order_CardExpiry" columnIndex="2"/>
- <result property="CardType" column="Order_CardType" columnIndex="3" />
- <result property="CardNumber" column="Order_CardNumber" columnIndex="4" />
- <result property="Street" column="Order_Street" columnIndex="5" />
- <result property="City" column="Order_City" columnIndex="6" />
- <result property="Province" column="Order_Province" columnIndex="7"/>
- <result property="PostalCode" column="Order_PostalCode" columnIndex="8" />
- </resultMap>
-
- <resultMap id="order-with-account-result" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="Account" column="Account_Id" select="GetAccountViaColumnName" />
- </resultMap>
-
- <resultMap id="order-with-collection-result" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="LineItemsList" column="Order_Id" select="GetLineItemsForOrder" />
- <result property="LineItems" column="Order_Id" select="GetLineItemsForOrder" lazyLoad="false" />
- </resultMap>
-
- <resultMap id="order-with-favourite-line-item" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem"
- column="Order_ID=Order_Id,LineItem_ID=Order_FavouriteLineItem"
- select="GetSpecificLineItem" />
- </resultMap>
-
- <resultMap id="order-with-dyn-favourite-line-item" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem"
- column="Order_ID=Order_Id,LineItem_ID=Order_FavouriteLineItem"
- select="GetDynSpecificLineItem" />
- </resultMap>
-
- <resultMap id="order-joined-favourite" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem" resultMapping="LineItem" />
- </resultMap>
-
- <resultMap id="order-joined-favourite2" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem.Id" column="LineItem_Id"/>
- <result property="FavouriteLineItem.Code" column="LineItem_Code"/>
- <result property="FavouriteLineItem.Quantity" column="LineItem_Quantity"/>
- <result property="FavouriteLineItem.Price" column="LineItem_Price"/>
- </resultMap>
-
- <resultMap id="order-joined-with-account" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="Account" resultMapping="account-result-nullable-email" />
- </resultMap>
-
- <statement id="GetOrderLiteByColumnName"
- parameterClass="integer"
- resultMap="lite-order-result-by-name" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderByHashTable"
- parameterClass="Int"
- resultMap="order-hash" >
- select Order_Date from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderLiteByColumnIndex"
- parameterClass="Int"
- resultMap="lite-order-result-by-index" >
- select
- Order_Id,
- Order_Date,
- Order_CardExpiry,
- Order_CardType,
- Order_CardNumber,
- Order_Street,
- Order_City,
- Order_Province,
- Order_PostalCode
- from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithTypes"
- parameterClass="Int"
- resultMap="order-with-types-result" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItems"
- parameterClass="Integer"
- ListClass="TList"
- resultMap="order-with-lines-result" >
- select * from Orders where Order_Id = #value#
- </statement>
-
-
- <statement id="GetOrderWithLineItemsNoLazyLoad"
- parameterClass="Integer"
- resultMap="order-with-lines-result-no-lazy-load" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemsUsingStatementNamespaces"
- parameterClass="Integer"
- resultMap="order-with-lines-result-statement-namespaces" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetAllOrderWithLineItems"
- resultMap="order-with-lines-result" >
- select * from Orders
- </statement>
-
- <statement id="GetOrderCardExpiryViaResultClass"
- parameterClass="int"
- resultClass="date">
- select
- Order_Date as 'datetime'
- from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithAccount"
- parameterClass="int"
- resultMap="order-with-account-result" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemsCollection"
- parameterClass="Integer"
- resultMap="order-with-collection-result" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderJoinedFavourite"
- parameterClass="Integer"
- resultMap="order-joined-favourite" >
- select * from Orders, LineItems
- where Orders.Order_Id = LineItems.Order_Id
- and Order_FavouriteLineItem = LineItems.LineItem_ID
- and Orders.Order_Id = #value#
- </statement>
-
- <statement id="GetOrderJoinedFavourite2"
- parameterClass="Integer"
- resultMap="order-joined-favourite2" >
- select * from Orders, LineItems
- where Orders.Order_Id = LineItems.Order_Id
- and Order_FavouriteLineItem = LineItems.LineItem_ID
- and Orders.Order_Id = #value#
- </statement>
-
- <statement id="GetOrderJoinedFavourite3"
- parameterClass="Integer"
- resultClass="Order" >
- select
- Orders.Order_Id as Id,
- Order_Date as Date,
- Order_CardExpiry as CardExpiry,
- Order_CardType as CardType,
- Order_CardNumber as CardNumber,
- Order_Street as Street,
- Order_City as City,
- Order_Province as Province,
- Order_PostalCode as PostalCode,
- LineItem_ID as "FavouriteLineItem.Id",
- LineItem_Code as "FavouriteLineItem.Code",
- LineItem_Quantity as "FavouriteLineItem.Quantity",
- LineItem_Price as "FavouriteLineItem.Price"
- from Orders, LineItems
- where Orders.Order_Id = LineItems.Order_Id
- and Order_FavouriteLineItem = LineItems.LineItem_ID
- and Orders.Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithFavouriteLineItem"
- parameterClass="int"
- resultMap="order-with-favourite-line-item" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemCollection"
- parameterClass="int"
- resultMap="order-with-lines-collection" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemCollectionNoLazy"
- parameterClass="int"
- resultMap="order-with-lines-collection-no-lazy-load" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderAsHastable"
- parameterClass="Integer"
- resultMap="lite-order-map-result" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemArray"
- parameterClass="int"
- resultMap="order-with-lines-array">
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetAllCreditCardNumbersFromOrders"
- resultMap="credit-card-result" >
- select distinct Order_CardNumber from Orders
- order by Order_CardNumber
- </statement>
-
- <statement id="InsertOrderViaParameterMap"
- parameterMap="order-insert-params-full" >
- insert into Orders
- (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
- Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
- values
- (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- </statement>
-
- <statement id="InsertOrderViaExtendParameterMap"
- parameterMap="insert-extend" >
- insert into Orders
- (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
- Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
- values
- (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- </statement>
-
- <statement id="InsertOrderViaPublicFields">
- insert into Orders
- (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
- Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
- values
- (#Id#, #Account.Id#, #Date#, #CardExpiry#, #CardType#, #CardNumber#, #Street#, #City#, #Province#, #PostalCode#)
- </statement>
-
- <select id="GetOrderWithDynFavouriteLineItem"
- parameterClass="Integer"
- resultMap="order-with-dyn-favourite-line-item">
- select * from Orders where Order_Id = #value#
- </select>
-
- <select id="SelectOrderByDate"
- parameterClass="array"
- resultMap="lite-order-result-by-name">
- select * from Orders where Order_Date = #Foo#
- </select>
-
- <select id="SelectOrderByDateDynamic"
- parameterClass="array"
- resultMap="lite-order-result-by-name">
- select * from Orders
- where 1=1
- <isNotEmpty prepend="AND" property="Foo">
- (Order_Date = '$Foo$')
- </isNotEmpty>
- </select>
-
- <select id="GetAccountJIRA45"
- parameterClass="int"
- resultMap="indexed-account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetOrderJoinWithAccount"
- parameterClass="Integer"
- resultMap="order-joined-with-account">
- select
- Order_Id,
- Order_Date,
- Order_CardExpiry,
- Order_CardType,
- Order_CardNumber,
- Order_Street,
- Order_City,
- Order_Province,
- Order_PostalCode,
- acc.Account_ID,
- acc.Account_FirstName,
- acc.Account_LastName,
- acc.Account_Email
- from Orders as ord
- LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
- where Order_Id = #value#
- </select>
-
- <parameterMap id="order-insert-params-full">
- <parameter property="Id" dbType="Int32"/>
- <parameter property="Account.Id"/>
- <parameter property="Date" nullValue="0001-01-01 00:00:00" />
- <parameter property="CardExpiry" />
- <parameter property="CardType" />
- <parameter property="CardNumber" />
- <parameter property="Street" />
- <parameter property="City" />
- <parameter property="Province" />
- <parameter property="PostalCode" />
- </parameterMap>
-
- <parameterMap id="params-parent"> <!-- 1043181 support request -->
- <parameter property="Id" dbType="Int32"/>
- <parameter property="Account.Id"/>
- <parameter property="Date" nullValue="0001-01-01 00:00:00" />
- <parameter property="CardExpiry" />
- <parameter property="CardType" />
- <parameter property="CardNumber" />
- <parameter property="Street" />
- <parameter property="City" />
- <parameter property="Province" />
- <parameter property="PostalCode" />
- </parameterMap>
-
- <parameterMap id="insert-extend" extends="params-parent">
- </parameterMap>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="Order">
+
+ <alias>
+ <typeAlias alias="Order" type="IBatisNet.DataMapper.Test.Domain.Order, IBatisNet.DataMapper.Test" />
+ </alias>
+
+ <!-- If the type is not specified, ADO.NET infers the
+ data provider Type of the Parameter from the Value property
+ of the Parameter object. -->
+
+
+ <resultMap id="credit-card-result" class="string">
+ <result property="value" column="Order_CardNumber"/>
+ </resultMap>
+ <!-- -->
+ <resultMap id="order-with-lines-result" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" lazyLoad="true" type="TList" column="Order_Id" select="GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-result-no-lazy-load" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" type="TList" column="Order_Id" select="GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-result-statement-namespaces" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" lazyLoad="true" type="TList" column="Order_Id" select="LineItem.GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-collection" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItems" column="Order_Id" lazyLoad="true"
+ select="GetLineItemsForOrderWithListClass" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-collection-no-lazy-load" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItems" column="Order_Id"
+ select="GetLineItemsForOrderWithListClass" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-array" class="Order"
+ extends="lite-order-result-by-name">
+ <result property="LineItemsArray" column="Order_Id" select="GetLineItemsForOrder"/>
+ </resultMap>
+
+ <resultMap id="lite-order-map-result" class="array">
+ <result property="Id" type="Int" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" type="string" column="Order_CardExpiry"/>
+ <result property="CardType" type="string" column="Order_CardType"/>
+ <result property="CardNumber" type="string" column="Order_CardNumber"/>
+ <result property="Street" type="string" column="Order_Street"/>
+ <result property="City" type="string" column="Order_City"/>
+ <result property="Province" type="string" column="Order_Province"/>
+ <result property="PostalCode" type="string" column="Order_PostalCode"/>
+ </resultMap>
+
+ <resultMap id="lite-order-result-by-name" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ </resultMap>
+
+ <resultMap id="order-hash" class="array">
+ <result property="Date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ </resultMap>
+
+ <resultMap id="order-with-types-result" class="Order">
+ <result property="Id" column="Order_Id" />
+ <result property="Date" column="Order_Date" type="date" />
+ <result property="CardExpiry" column="Order_CardExpiry" />
+ <result property="CardType" column="Order_CardType" />
+ <result property="CardNumber" column="Order_CardNumber" />
+ <result property="Street" column="Order_Street" />
+ <result property="City" column="Order_City" />
+ <result property="Province" column="Order_Province" />
+ <result property="PostalCode" column="Order_PostalCode" />
+ </resultMap>
+
+ <resultMap id="lite-order-result-by-index" class="Order">
+ <result property="Id" column="Order_Id" columnIndex="0"/>
+ <result property="Date" column="Order_Date" type="date" columnIndex="1" />
+ <result property="CardExpiry" column="Order_CardExpiry" columnIndex="2"/>
+ <result property="CardType" column="Order_CardType" columnIndex="3" />
+ <result property="CardNumber" column="Order_CardNumber" columnIndex="4" />
+ <result property="Street" column="Order_Street" columnIndex="5" />
+ <result property="City" column="Order_City" columnIndex="6" />
+ <result property="Province" column="Order_Province" columnIndex="7"/>
+ <result property="PostalCode" column="Order_PostalCode" columnIndex="8" />
+ </resultMap>
+
+ <resultMap id="order-with-account-result" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="Account" column="Account_Id" select="GetAccountViaColumnName" />
+ </resultMap>
+
+ <resultMap id="order-with-collection-result" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="LineItemsList" column="Order_Id" select="GetLineItemsForOrder" />
+ <result property="LineItems" column="Order_Id" select="GetLineItemsForOrder" lazyLoad="false" />
+ </resultMap>
+
+ <resultMap id="order-with-favourite-line-item" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem"
+ column="Order_ID=Order_Id,LineItem_ID=Order_FavouriteLineItem"
+ select="GetSpecificLineItem" />
+ </resultMap>
+
+ <resultMap id="order-with-dyn-favourite-line-item" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem"
+ column="Order_ID=Order_Id,LineItem_ID=Order_FavouriteLineItem"
+ select="GetDynSpecificLineItem" />
+ </resultMap>
+
+ <resultMap id="order-joined-favourite" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem" resultMapping="LineItem" />
+ </resultMap>
+
+ <resultMap id="order-joined-favourite2" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem.Id" column="LineItem_Id"/>
+ <result property="FavouriteLineItem.Code" column="LineItem_Code"/>
+ <result property="FavouriteLineItem.Quantity" column="LineItem_Quantity"/>
+ <result property="FavouriteLineItem.Price" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="order-joined-with-account" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="Account" resultMapping="account-result-nullable-email" />
+ </resultMap>
+
+ <statement id="GetOrderLiteByColumnName"
+ parameterClass="integer"
+ resultMap="lite-order-result-by-name" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderByHashTable"
+ parameterClass="Int"
+ resultMap="order-hash" >
+ select Order_Date from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderLiteByColumnIndex"
+ parameterClass="Int"
+ resultMap="lite-order-result-by-index" >
+ select
+ Order_Id,
+ Order_Date,
+ Order_CardExpiry,
+ Order_CardType,
+ Order_CardNumber,
+ Order_Street,
+ Order_City,
+ Order_Province,
+ Order_PostalCode
+ from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithTypes"
+ parameterClass="Int"
+ resultMap="order-with-types-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItems"
+ parameterClass="Integer"
+ ListClass="TList"
+ resultMap="order-with-lines-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+
+ <statement id="GetOrderWithLineItemsNoLazyLoad"
+ parameterClass="Integer"
+ resultMap="order-with-lines-result-no-lazy-load" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemsUsingStatementNamespaces"
+ parameterClass="Integer"
+ resultMap="order-with-lines-result-statement-namespaces" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetAllOrderWithLineItems"
+ resultMap="order-with-lines-result" >
+ select * from Orders
+ </statement>
+
+ <statement id="GetOrderCardExpiryViaResultClass"
+ parameterClass="int"
+ resultClass="date">
+ select
+ Order_Date as 'datetime'
+ from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithAccount"
+ parameterClass="int"
+ resultMap="order-with-account-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemsCollection"
+ parameterClass="Integer"
+ resultMap="order-with-collection-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite"
+ parameterClass="Integer"
+ resultMap="order-joined-favourite" >
+ select * from Orders, LineItems
+ where Orders.Order_Id = LineItems.Order_Id
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite2"
+ parameterClass="Integer"
+ resultMap="order-joined-favourite2" >
+ select * from Orders, LineItems
+ where Orders.Order_Id = LineItems.Order_Id
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite3"
+ parameterClass="Integer"
+ resultClass="Order" >
+ select
+ Orders.Order_Id as Id,
+ Order_Date as Date,
+ Order_CardExpiry as CardExpiry,
+ Order_CardType as CardType,
+ Order_CardNumber as CardNumber,
+ Order_Street as Street,
+ Order_City as City,
+ Order_Province as Province,
+ Order_PostalCode as PostalCode,
+ LineItem_ID as "FavouriteLineItem.Id",
+ LineItem_Code as "FavouriteLineItem.Code",
+ LineItem_Quantity as "FavouriteLineItem.Quantity",
+ LineItem_Price as "FavouriteLineItem.Price"
+ from Orders, LineItems
+ where Orders.Order_Id = LineItems.Order_Id
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithFavouriteLineItem"
+ parameterClass="int"
+ resultMap="order-with-favourite-line-item" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemCollection"
+ parameterClass="int"
+ resultMap="order-with-lines-collection" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemCollectionNoLazy"
+ parameterClass="int"
+ resultMap="order-with-lines-collection-no-lazy-load" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderAsHastable"
+ parameterClass="Integer"
+ resultMap="lite-order-map-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemArray"
+ parameterClass="int"
+ resultMap="order-with-lines-array">
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetAllCreditCardNumbersFromOrders"
+ resultMap="credit-card-result" >
+ select distinct Order_CardNumber from Orders
+ order by Order_CardNumber
+ </statement>
+
+ <statement id="InsertOrderViaParameterMap"
+ parameterMap="order-insert-params-full" >
+ insert into Orders
+ (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ </statement>
+
+ <statement id="InsertOrderViaExtendParameterMap"
+ parameterMap="insert-extend" >
+ insert into Orders
+ (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ </statement>
+
+ <statement id="InsertOrderViaPublicFields">
+ insert into Orders
+ (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (#Id#, #Account.Id#, #Date#, #CardExpiry#, #CardType#, #CardNumber#, #Street#, #City#, #Province#, #PostalCode#)
+ </statement>
+
+ <select id="GetOrderWithDynFavouriteLineItem"
+ parameterClass="Integer"
+ resultMap="order-with-dyn-favourite-line-item">
+ select * from Orders where Order_Id = #value#
+ </select>
+
+ <select id="SelectOrderByDate"
+ parameterClass="array"
+ resultMap="lite-order-result-by-name">
+ select * from Orders where Order_Date = #Foo#
+ </select>
+
+ <select id="SelectOrderByDateDynamic"
+ parameterClass="array"
+ resultMap="lite-order-result-by-name">
+ select * from Orders
+ where 1=1
+ <isNotEmpty prepend="AND" property="Foo">
+ (Order_Date = '$Foo$')
+ </isNotEmpty>
+ </select>
+
+ <select id="GetAccountJIRA45"
+ parameterClass="int"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetOrderJoinWithAccount"
+ parameterClass="Integer"
+ resultMap="order-joined-with-account">
+ select
+ Order_Id,
+ Order_Date,
+ Order_CardExpiry,
+ Order_CardType,
+ Order_CardNumber,
+ Order_Street,
+ Order_City,
+ Order_Province,
+ Order_PostalCode,
+ acc.Account_ID,
+ acc.Account_FirstName,
+ acc.Account_LastName,
+ acc.Account_Email
+ from Orders as ord
+ LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
+ where Order_Id = #value#
+ </select>
+
+ <parameterMap id="order-insert-params-full">
+ <parameter property="Id" dbType="Int32"/>
+ <parameter property="Account.Id"/>
+ <parameter property="Date" nullValue="0001-01-01 00:00:00" />
+ <parameter property="CardExpiry" />
+ <parameter property="CardType" />
+ <parameter property="CardNumber" />
+ <parameter property="Street" />
+ <parameter property="City" />
+ <parameter property="Province" />
+ <parameter property="PostalCode" />
+ </parameterMap>
+
+ <parameterMap id="params-parent"> <!-- 1043181 support request -->
+ <parameter property="Id" dbType="Int32"/>
+ <parameter property="Account.Id"/>
+ <parameter property="Date" nullValue="0001-01-01 00:00:00" />
+ <parameter property="CardExpiry" />
+ <parameter property="CardType" />
+ <parameter property="CardNumber" />
+ <parameter property="Street" />
+ <parameter property="City" />
+ <parameter property="Province" />
+ <parameter property="PostalCode" />
+ </parameterMap>
+
+ <parameterMap id="insert-extend" extends="params-parent">
+ </parameterMap>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/MySql/Other.xml b/tests/unit/Data/SqlMap/maps/MySql/Other.xml
index ca9b7a33..67862029 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/Other.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/Other.xml
@@ -1,170 +1,170 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMap namespace="Other" >
-
- <resultMap id="other-result" class="Other" >
- <result property="Int" column="Other_Int"/>
- <result property="Long" column="Other_Long"/>
- <result property="Bool" column="Other_Bit"/>
- <result property="Bool2" column="Other_String" typeHandler="OuiNonBool"/>
- </resultMap>
-
- <resultMap id="other-result-V1" class="Other" >
- <result property="Int" column="Other_Int"/>
- <result property="Long" column="Other_Long"/>
- <result property="Bool" column="Other_Bit"/>
- <result property="Bool2" column="Other_String" />
- </resultMap>
-
- <resultMap id="A-result" class="A" >
- <result property="Id" column="A_ID"/>
- <result property="Libelle" column="A_Libelle"/>
- <result property="B" resultMapping="B-result"/>
- <result property="E" resultMapping="E-result"/>
- <result property="F" resultMapping="F-result"/>
- </resultMap>
-
- <resultMap id="B-result" class="B" >
- <result property="Id" column="B_ID"/>
- <result property="Libelle" column="B_Libelle"/>
- <result property="C" resultMapping="C-result"/>
- <result property="D" resultMapping="D-result"/>
- </resultMap>
-
- <resultMap id="C-result" class="C" >
- <result property="Id" column="C_ID"/>
- <result property="Libelle" column="C_Libelle"/>
- </resultMap>
-
- <resultMap id="D-result" class="D" >
- <result property="Id" column="D_ID"/>
- <result property="Libelle" column="D_Libelle"/>
- </resultMap>
-
- <resultMap id="E-result" class="E" >
- <result property="Id" column="E_ID"/>
- <result property="Libelle" column="E_Libelle"/>
- </resultMap>
-
- <resultMap id="F-result" class="F" >
- <result property="Id" column="F_ID"/>
- <result property="Libelle" column="F_Libelle"/>
- </resultMap>
-
- <select id="SelectComplexJoined" resultMap="A-result">
- SELECT
- A.Id AS A_ID,
- A.A_Libelle AS A_Libelle,
- B.ID AS B_ID,
- B.B_Libelle AS B_Libelle,
- C.ID AS C_ID,
- C.C_Libelle AS C_Libelle,
- D.ID AS D_ID,
- D.D_Libelle AS D_Libelle,
- E.ID AS E_ID,
- E.E_Libelle AS E_Libelle,
- F.ID AS F_ID,
- F.F_Libelle AS F_Libelle
- FROM A
- LEFT OUTER JOIN B ON A.B_ID = B.ID
- LEFT OUTER JOIN C ON B.C_ID = C.ID
- LEFT OUTER JOIN D ON B.D_ID = D.ID
- LEFT OUTER JOIN E ON A.E_ID = E.ID
- LEFT OUTER JOIN F ON A.F_ID = F.ID
- </select>
-
-
- <statement id="DynamicSelectByIntLong"
- parameterClass="Hashtable"
- resultMap="other-result">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- <dynamic prepend="WHERE">
- <isNotEqual prepend="AND" property="year" compareValue="0">
- Other_Int = #year#
- </isNotEqual>
-
- <isNotEqual prepend="AND" property="areaid" compareValue="0">
- Other_Long = #areaid#
- </isNotEqual>
- </dynamic>
- </statement>
-
- <statement id="DynamicSelectByBool"
- parameterClass="Other"
- resultMap="other-result">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- Where Other_Bit = #Bool#
- </statement>
-
- <statement id="InsertBool"
- parameterClass="Other">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( #Int#, #Long#, #Bool#, 'Yes')
- </statement>
-
- <statement id="InsertCustomTypeHandler"
- parameterMap="other-insert-params">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( ?, ?, ?, ?)
- </statement>
-
- <statement id="SelectByInt"
- parameterClass="int"
- resultMap="other-result">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- Where Other_Int = #value#
- </statement>
-
- <statement id="SelectByIntV1"
- parameterClass="int"
- resultMap="other-result-V1">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- Where Other_Int = #value#
- </statement>
-
- <statement id="InsertInlineCustomTypeHandlerV1"
- parameterClass="Other">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( #Int#, #Long#, #Bool#, #Bool2,type=bool,dbType=Varchar#)
- </statement>
-
- <statement id="InsertInlineCustomTypeHandlerV2"
- parameterClass="Other">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( #Int#, #Long#, #Bool#, #Bool2,typeHandler=OuiNonBool#)
- </statement>
-
- <parameterMap id="other-insert-params">
- <parameter property="Int" />
- <parameter property="Long" />
- <parameter property="Bool" />
- <parameter property="Bool2" typeHandler="OuiNonBool"/>
- </parameterMap>
-</sqlMap>
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Other" >
+
+ <resultMap id="other-result" class="Other" >
+ <result property="Int" column="Other_Int"/>
+ <result property="Long" column="Other_Long"/>
+ <result property="Bool" column="Other_Bit"/>
+ <result property="Bool2" column="Other_String" typeHandler="OuiNonBool"/>
+ </resultMap>
+
+ <resultMap id="other-result-V1" class="Other" >
+ <result property="Int" column="Other_Int"/>
+ <result property="Long" column="Other_Long"/>
+ <result property="Bool" column="Other_Bit"/>
+ <result property="Bool2" column="Other_String" />
+ </resultMap>
+
+ <resultMap id="A-result" class="A" >
+ <result property="Id" column="A_ID"/>
+ <result property="Libelle" column="A_Libelle"/>
+ <result property="B" resultMapping="B-result"/>
+ <result property="E" resultMapping="E-result"/>
+ <result property="F" resultMapping="F-result"/>
+ </resultMap>
+
+ <resultMap id="B-result" class="B" >
+ <result property="Id" column="B_ID"/>
+ <result property="Libelle" column="B_Libelle"/>
+ <result property="C" resultMapping="C-result"/>
+ <result property="D" resultMapping="D-result"/>
+ </resultMap>
+
+ <resultMap id="C-result" class="C" >
+ <result property="Id" column="C_ID"/>
+ <result property="Libelle" column="C_Libelle"/>
+ </resultMap>
+
+ <resultMap id="D-result" class="D" >
+ <result property="Id" column="D_ID"/>
+ <result property="Libelle" column="D_Libelle"/>
+ </resultMap>
+
+ <resultMap id="E-result" class="E" >
+ <result property="Id" column="E_ID"/>
+ <result property="Libelle" column="E_Libelle"/>
+ </resultMap>
+
+ <resultMap id="F-result" class="F" >
+ <result property="Id" column="F_ID"/>
+ <result property="Libelle" column="F_Libelle"/>
+ </resultMap>
+
+ <select id="SelectComplexJoined" resultMap="A-result">
+ SELECT
+ A.Id AS A_ID,
+ A.A_Libelle AS A_Libelle,
+ B.ID AS B_ID,
+ B.B_Libelle AS B_Libelle,
+ C.ID AS C_ID,
+ C.C_Libelle AS C_Libelle,
+ D.ID AS D_ID,
+ D.D_Libelle AS D_Libelle,
+ E.ID AS E_ID,
+ E.E_Libelle AS E_Libelle,
+ F.ID AS F_ID,
+ F.F_Libelle AS F_Libelle
+ FROM A
+ LEFT OUTER JOIN B ON A.B_ID = B.ID
+ LEFT OUTER JOIN C ON B.C_ID = C.ID
+ LEFT OUTER JOIN D ON B.D_ID = D.ID
+ LEFT OUTER JOIN E ON A.E_ID = E.ID
+ LEFT OUTER JOIN F ON A.F_ID = F.ID
+ </select>
+
+
+ <statement id="DynamicSelectByIntLong"
+ parameterClass="Hashtable"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ <dynamic prepend="WHERE">
+ <isNotEqual prepend="AND" property="year" compareValue="0">
+ Other_Int = #year#
+ </isNotEqual>
+
+ <isNotEqual prepend="AND" property="areaid" compareValue="0">
+ Other_Long = #areaid#
+ </isNotEqual>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicSelectByBool"
+ parameterClass="Other"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Bit = #Bool#
+ </statement>
+
+ <statement id="InsertBool"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, 'Yes')
+ </statement>
+
+ <statement id="InsertCustomTypeHandler"
+ parameterMap="other-insert-params">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( ?, ?, ?, ?)
+ </statement>
+
+ <statement id="SelectByInt"
+ parameterClass="int"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Int = #value#
+ </statement>
+
+ <statement id="SelectByIntV1"
+ parameterClass="int"
+ resultMap="other-result-V1">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Int = #value#
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,type=bool,dbType=Varchar#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,typeHandler=OuiNonBool#)
+ </statement>
+
+ <parameterMap id="other-insert-params">
+ <parameter property="Int" />
+ <parameter property="Long" />
+ <parameter property="Bool" />
+ <parameter property="Bool2" typeHandler="OuiNonBool"/>
+ </parameterMap>
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/MySql/ResultClass.xml b/tests/unit/Data/SqlMap/maps/MySql/ResultClass.xml
index 3d44ec98..3f82ac5f 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/ResultClass.xml
+++ b/tests/unit/Data/SqlMap/maps/MySql/ResultClass.xml
@@ -1,130 +1,130 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sqlMap namespace="ResultClass" >
-
- <statement id="GetBoolean"
- parameterClass="Int"
- resultClass="bool" >
- select 1 from Orders where Order_ID = #dummy#
- </statement>
- <statement id="GetBooleanWithoutResultClass"
- parameterClass="Int"
- extends="GetBoolean">
- </statement>
-
- <statement id="GetByte"
- parameterClass="Int"
- resultClass="string" >
- select 155 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetByteWithoutResultClass"
- parameterClass="Int"
- extends="GetByte">
- </statement>
-
- <!--
- NOTE: Use MySql 4.0.2 or higher for "cast"
- -->
- <statement id="GetChar"
- parameterClass="Int"
- resultClass="string" >
- select cast('a' as char) from Orders where Order_ID = #value#
- </statement>
- <statement id="GetCharWithoutResultClass"
- parameterClass="Int"
- extends="GetChar">
- </statement>
-
- <statement id="GetDate"
- parameterClass="Int"
- resultClass="TDateTime" >
- select '2003-02-15 8:15:00' as datetime from Orders where Order_ID = #value#
- </statement>
- <statement id="GetDateWithoutResultClass"
- parameterClass="Int"
- extends="GetDate">
- </statement>
-
- <statement id="GetDecimal"
- parameterClass="Int"
- resultClass="float" >
- select 1.56 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetDecimalWithoutResultClass"
- parameterClass="Int"
- extends="GetDecimal">
- </statement>
-
- <statement id="GetDouble"
- parameterClass="Int"
- resultClass="float" >
- select 99.5 from Orders where Order_ID= #value#
- </statement>
- <statement id="GetDoubleWithoutResultClass"
- parameterClass="Int"
- extends="GetDouble">
- </statement>
-
- <!--
- Use binary for cast for MySql
- -->
- <statement id="GetGuid"
- parameterClass="Int"
- resultClass="guid" >
- select cast('CD5ABF17-4BBC-4C86-92F1-257735414CF4' as binary) from Orders where Order_ID = #value#
- </statement>
- <statement id="GetGuidWithoutResultClass" parameterClass="Int" extends="GetGuid">
- </statement>
-
- <statement id="GetInt16"
- parameterClass="Int"
- resultClass="int" >
- select 32111 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetInt16WithoutResultClass"
- parameterClass="Int"
- extends="GetInt16">
- </statement>
-
- <statement id="GetInt32"
- parameterClass="Int"
- resultClass="int" >
- select 999999 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetInt32WithoutResultClass"
- parameterClass="Int"
- extends="GetInt32">
- </statement>
-
- <statement id="GetInt64"
- parameterClass="Int"
- resultClass="double" >
- select 9223372036854775800 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetInt64WithoutResultClass"
- parameterClass="Int"
- extends="GetInt64">
- </statement>
-
- <statement id="GetSingle"
- parameterClass="Int"
- resultClass="float" >
- select 92233.5 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetSingleWithoutResultClass"
- parameterClass="Int"
- extends="GetSingle">
- </statement>
-
- <statement id="GetString"
- parameterClass="Int"
- resultClass="string" >
- select 'VISA'
- from Orders where Order_ID = #value#
- </statement>
- <statement id="GetStringWithoutResultClass"
- parameterClass="Int"
- extends="GetString">
- </statement>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="ResultClass" >
+
+ <statement id="GetBoolean"
+ parameterClass="Int"
+ resultClass="bool" >
+ select 1 from Orders where Order_ID = #dummy#
+ </statement>
+ <statement id="GetBooleanWithoutResultClass"
+ parameterClass="Int"
+ extends="GetBoolean">
+ </statement>
+
+ <statement id="GetByte"
+ parameterClass="Int"
+ resultClass="string" >
+ select 155 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetByteWithoutResultClass"
+ parameterClass="Int"
+ extends="GetByte">
+ </statement>
+
+ <!--
+ NOTE: Use MySql 4.0.2 or higher for "cast"
+ -->
+ <statement id="GetChar"
+ parameterClass="Int"
+ resultClass="string" >
+ select cast('a' as char) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetCharWithoutResultClass"
+ parameterClass="Int"
+ extends="GetChar">
+ </statement>
+
+ <statement id="GetDate"
+ parameterClass="Int"
+ resultClass="TDateTime" >
+ select '2003-02-15 8:15:00' as datetime from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetDateWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDate">
+ </statement>
+
+ <statement id="GetDecimal"
+ parameterClass="Int"
+ resultClass="float" >
+ select 1.56 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetDecimalWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDecimal">
+ </statement>
+
+ <statement id="GetDouble"
+ parameterClass="Int"
+ resultClass="float" >
+ select 99.5 from Orders where Order_ID= #value#
+ </statement>
+ <statement id="GetDoubleWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDouble">
+ </statement>
+
+ <!--
+ Use binary for cast for MySql
+ -->
+ <statement id="GetGuid"
+ parameterClass="Int"
+ resultClass="guid" >
+ select cast('CD5ABF17-4BBC-4C86-92F1-257735414CF4' as binary) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetGuidWithoutResultClass" parameterClass="Int" extends="GetGuid">
+ </statement>
+
+ <statement id="GetInt16"
+ parameterClass="Int"
+ resultClass="int" >
+ select 32111 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt16WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt16">
+ </statement>
+
+ <statement id="GetInt32"
+ parameterClass="Int"
+ resultClass="int" >
+ select 999999 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt32WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt32">
+ </statement>
+
+ <statement id="GetInt64"
+ parameterClass="Int"
+ resultClass="double" >
+ select 9223372036854775800 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt64WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt64">
+ </statement>
+
+ <statement id="GetSingle"
+ parameterClass="Int"
+ resultClass="float" >
+ select 92233.5 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetSingleWithoutResultClass"
+ parameterClass="Int"
+ extends="GetSingle">
+ </statement>
+
+ <statement id="GetString"
+ parameterClass="Int"
+ resultClass="string" >
+ select 'VISA'
+ from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetStringWithoutResultClass"
+ parameterClass="Int"
+ extends="GetString">
+ </statement>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/mssql/Account.xml b/tests/unit/Data/SqlMap/maps/mssql/Account.xml
index 2e8dc1ce..8149d228 100644
--- a/tests/simple_unit/SqlMap/maps/mssql/Account.xml
+++ b/tests/unit/Data/SqlMap/maps/mssql/Account.xml
@@ -1,606 +1,606 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sqlMap namespace="Account">
-
-
- <cacheModel id="account-cache" implementation="LRU" >
- <flushInterval hours="24"/>
- <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
- <flushOnExecute statement="UpdateAccountViaParameterMap"/>
- <property id="CacheSize" value="50"/>
- </cacheModel>
-
-
- <resultMap id="account-result" class="Account" >
- <result property="Id" column="Account_ID"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email" nullValue="no_email@provided.com"/>
- <result property="BannerOptions" column="Account_Banner_Option" dbType="Varchar" typeHandler="OuiNonBool"/>
- <result property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
- </resultMap>
- <resultMap id="indexed-account-result" class="Account">
- <result property="Id" column="Account_ID" columnIndex="0"/>
- <result property="FirstName" column="Account_FirstName" columnIndex="1"/>
- <result property="LastName" column="Account_LastName" columnIndex="2"/>
- <result property="EmailAddress" column="Account_Email" columnIndex="3" nullValue="no_email@provided.com"/>
- </resultMap>
- <resultMap id="account-result-nullable-email" class="Account">
- <result property="Id" column="Account_ID"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email"/>
- </resultMap>
-
- <resultMap id="email-result" class="string">
- <result property="value" column="Account_Email"/>
- </resultMap>
-
- <resultMap id="account-hashtable-result" class="array">
- <result property="Id" column="Account_ID"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email"/>
- </resultMap>
-
-
-<!-- =============================================
- MAPPED STATEMENTS - w/Inline Parameters
-=============================================
--->
-
- <select id="GetAllAccountsAsArrayListViaResultClass" resultClass="TList">
- select
- Account_ID as ID,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- order by Account_ID
- </select>
-
- <select id="GetAccountsDynamic" resultMap="account-result" parameterClass="array" >
- select top $MaximumAllowed$ * from Accounts
- <dynamic prepend="where">
- <isParameterPresent>
- <isNotEmpty prepend="and" property="FirstName" >
- Account_FirstName LIKE '%$FirstName$%'
- </isNotEmpty>
- <isNotEmpty prepend="and" property="LastName" >
- Account_LastName LIKE '%$LastName$%'
- </isNotEmpty>
- <isNotEmpty prepend="and" property="EmailAddress" >
- Account_Email LIKE '%$EmailAddress$%'
- </isNotEmpty>
- </isParameterPresent>
- </dynamic>
- order by Account_LastName
- </select>
-
- <select id="SelectWithProperty"
- resultMap="account-result">
- select *
- from Accounts
- where Account_FirstName = ${accountName}
- </select>
-
- <select id="GetCachedAccountsViaResultMap"
- resultMap="account-result"
- cacheModel="account-cache" >
- select *
- from Accounts
- order by Account_ID
- </select>
-
- <select id="GetNoAccountWithCache"
- parameterClass="Integer"
- resultMap="account-hashtable-result"
- cacheModel="account-cache">
- select *
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetAccountAsarray"
- parameterClass="Integer"
- resultMap="account-hashtable-result">
- select *
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetAllAccountsAsHashMapViaResultMap"
- resultMap="account-hashtable-result">
- select *
- from Accounts
- order by Account_ID
- </select>
-
- <select id="GetAccountAsarrayResultClass"
- parameterClass="int"
- resultClass="HashMap">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetAllAccountsAsarrayViaResultClass"
- resultClass="array">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- order by Account_ID
- </select>
-
- <select id="GetAccountViaColumnName"
- parameterClass="int"
- resultMap="account-result">
- select
- Account_ID,
- Account_FirstName,
- Account_LastName,
- Account_Email,
- Account_Banner_Option,
- Account_Cart_Option
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetAccountViaColumnIndex"
- parameterClass="int"
- resultMap="indexed-account-result">
- select
- Account_ID,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetAllAccountsViaResultMap"
- resultMap="account-result">
- select * from Accounts
- order by Account_ID
- </select>
-
- <select id="GetAllAccountsViaResultClass"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- order by Account_ID
- </select>
-
- <select id="GetFewAccountsViaResultMap"
- resultMap="account-result">
- <![CDATA[
- select * from Accounts
- where Account_ID < 2
- order by Account_ID
- ]]>
- </select>
-
- <select id="GetNoAccountsViaResultMap"
- resultMap="account-result">
- select * from Accounts
- where Account_ID > 1000
- order by Account_ID
- </select>
-
-
- <select id="GetAccountNullableEmail"
- resultMap="account-result-nullable-email">
- select
- Account_ID,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetAccountViaResultClass"
- resultClass="Account">
- <![CDATA[
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where Account_ID = #value#
- ]]>
- </select>
-
- <select id="GetAccountViaInlineParameters"
- resultMap="indexed-account-result">
- select
- Account_ID,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_ID = #Id# and Account_ID = #Id#
- </select>
-
- <select id="GetEmailAddressViaResultClass" resultClass="string">
- select Account_Email as value
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetEmailAddressViaResultMap"
- parameterClass="int"
- resultMap="email-result">
- select Account_Email
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetAllEmailAddressesViaResultClass"
- resultClass="string">
- select Account_Email
- from Accounts
- order by Account_ID
- </select>
-
- <select id="GetAllEmailAddressesViaResultMap"
- resultMap="email-result">
- select Account_Email
- from Accounts
- order by Account_ID
- </select>
-
- <insert id="InsertAccountViaParameterMap"
- parameterMap="account-insert-params">
- insert into Accounts
- (Account_ID, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option)
- values
- (?, ?, ?, ?, ?, ?)
- </insert>
-
- <update id="UpdateAccountViaParameterMap"
- parameterMap="update-params">
- update Accounts set
- Account_FirstName = ?,
- Account_LastName = ?,
- Account_Email = ?
- where
- Account_ID = ?
- </update>
-
- <update id="UpdateAccountViaParameterMap2"
- parameterMap="update-params2">
- update Accounts set
- Account_ID = ?,
- Account_FirstName = ?,
- Account_LastName = ?,
- Account_Email = ?
- where
- Account_ID = ?
- </update>
-
- <delete id="DeleteAccountViaInlineParameters">
- delete from Accounts
- where
- Account_ID = #Id#
- </delete>
-
- <select id="GetAccountComplexMapping"
- resultMap="indexed-account-result"
- parameterClass="array">
- select *
- from Accounts
- where
- Account_FirstName = #Account.FirstName#
- And Account_LastName = #Order.City#
- </select>
-
- <select id="GetDynamicOrderedEmailAddressesViaResultMap"
- resultMap="email-result">
- select Account_Email
- from Accounts
- order by $value$
- </select>
-
- <!-- Dynamic statements -->
- <select id="GetAllAccountsViaResultMapWithDynamicElement"
- resultMap="indexed-account-result">
- select * from Accounts
- where Account_Email $value$ '%@%'
- order by Account_ID
- </select>
-
- <select id="SimpleDynamicSubstitution"
- parameterClass="array"
- resultClass="Account">
- $statement$
- </select>
-
- <!-- Public Fields -->
- <insert id="InsertAccountViaPublicFields">
- insert into Accounts
- (Account_ID, Account_FirstName, Account_LastName, Account_Email)
- values
- (#Id#, #FirstName#, #LastName#, #EmailAddress#
- )
- </insert>
-
- <!-- Inline Parameters -->
- <update id="UpdateAccountViaInlineParameters"
- parameterClass="Account">
- update Accounts set
- Account_FirstName = #FirstName#,
- Account_LastName = #LastName#,
- Account_Email = #EmailAddress, nullValue=no_email@provided.com#
- where
- Account_ID = #Id#
- </update>
-
- <insert id="InsertAccountViaInlineParameters"
- parameterClass="Account" >
- insert into Accounts
- (Account_ID, Account_FirstName, Account_LastName, Account_Email)
- values
- (#Id#, #FirstName#, #LastName#, #EmailAddress, nullValue=no_email@provided.com#
- )
- </insert>
-
- <insert id="InsertAccountNullableEmail"
- parameterClass="Account" >
- insert into Accounts
- (Account_ID, Account_FirstName, Account_LastName, Account_Email)
- values
- ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
- </insert>
-
- <insert id="InsertAccountUknownParameterClass">
- insert into Accounts
- (Account_ID, Account_FirstName, Account_LastName, Account_Email)
- values
- ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
- </insert>
-
- <delete id="DeleteAccount" parameterClass="Account">
- delete from Accounts
- where Account_ID = #Id, type=integer#
- and Account_ID = #Id, type=integer#
- </delete>
-
- <!-- Extends statement -->
- <select id="GetAllAccounts"
- resultMap="indexed-account-result">
- select
- Account_ID,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- </select>
-
- <select id="GetAllAccountsOrderByName"
- extends="GetAllAccounts"
- resultMap="indexed-account-result">
- order by Account_FirstName
- </select>
-
- <select id="GetOneAccount"
- extends="GetAllAccounts"
- resultMap="indexed-account-result">
- where Account_ID = #value#
- </select>
-
- <select id="GetSomeAccount"
- extends="GetAllAccounts"
- parameterClass="array"
- resultMap="indexed-account-result">
- where Account_ID between #lowID# and #hightID#
- </select>
-
- <select id="SelectAccountJIRA29" parameterClass="map" resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where Account_FirstName = '##$AccountName$##'
- </select>
-
- <select id="SelectAccountJIRA29-2"
- parameterClass="array"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where 1=1
- <isNotEmpty prepend="AND" property="Foo">
- (Account_FirstName = '##$Foo$##')
- </isNotEmpty>
- </select>
-
- <select id="GetAccountWithRepeatingProperty"
- parameterClass="Account"
- resultMap="indexed-account-result">
- select
- Account_ID,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_ID = #Id# and
- Account_ID = #Id# and
- Account_FirstName = #FirstName# and
- Account_LastName = #LastName# and
- Account_ID = #Id#
- </select>
-
- <select id="GetAllAccountsViaCustomTypeHandler"
- resultMap="account-result">
- select * from Accounts
- order by Account_ID
- </select>
-
- <!-- JIRA-110 -->
- <select id="GetManyAccound" resultClass="Account">
- <![CDATA[
- SELECT
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- FROM Accounts
- ]]>
- </select>
-
- <select id="Get1Account" extends="GetManyAccound" resultClass="Account">WHERE Account_ID=1</select>
-
- <statement id="GetAccounts" resultMap="account-result">
- <![CDATA[SELECT * ]]>
- <![CDATA[FROM ]]>
- Accounts
- </statement>
- <!-- JIRA-110 -->
-
- <insert id="InsertAccountDynamic" parameterClass="Account">
- INSERT INTO Accounts
- (Account_ID, Account_FirstName, Account_LastName, Account_Email)
- VALUES(#Id#, #FirstName#, #LastName#
- <dynamic prepend=",">
- <isNotNull prepend="," property="EmailAddress">
- #EmailAddress#
- </isNotNull>
- <isNull prepend="," property="EmailAddress">
- null
- </isNull>
- </dynamic>
- )
- </insert>
-
- <!-- For procedure, the parameters of the parameterMap must in the same order
- as for the procedure paramaters-->
- <procedure id="InsertAccountViaStoreProcedure" parameterMap="account-insert-params">
- ps_InsertAccount
- </procedure>
-
- <procedure id="SwapEmailAddresses" parameterMap="swap-params">
- ps_swap_email_address
- </procedure>
-
- <procedure id="GetAccountViaSP" parameterMap="select-params" resultClass="Account">
- ps_SelectAccount
- </procedure>
-
-<!-- =============================================
- OPTIONAL EXPLICIT PARAMETER MAP
-============================================= -->
-
- <parameterMap id="swap-params">
- <parameter property="email1" column="First_Email" />
- <parameter property="email2" column="Second_Email" />
- </parameterMap>
-
- <parameterMap id="select-params">
- <parameter property="Account_ID" />
- </parameterMap>
-
- <parameterMap id="account-insert-params">
- <parameter property="Id" />
- <parameter property="FirstName" />
- <parameter property="LastName" />
- <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
- <parameter property="BannerOptions" dbType="Varchar" type="bool"/>
- <parameter property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
- </parameterMap>
-
- <parameterMap id="update-params">
- <parameter property="FirstName" />
- <parameter property="LastName" />
- <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
- <parameter property="Id" />
- </parameterMap>
-
- <parameterMap id="update-params2">
- <parameter property="Id" />
- <parameter property="FirstName" />
- <parameter property="LastName" />
- <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
- <parameter property="Id" />
- </parameterMap>
-
-
- <!-- accounts and orders -->
-
- <select id="getAccountWithOrders" resultMap="Account-with-Orders">
- SELECT * FROM accounts
- LEFT JOIN orders ON
- accounts.account_id = orders.account_id
- </select>
-
- <resultMap id="Account-with-Orders" class="AccountWithOrders" groupBy="Account_ID">
- <result property="Id" column="Account_ID"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email" />
- <result property="Orders" resultMapping="account-orders" />
- </resultMap>
-
- <resultMap id="account-orders" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- </resultMap>
-
- <select id="GetAccountAsHashtable"
- parameterClass="Integer"
- resultMap="account-hashtable-result">
- select *
- from Accounts
- where Account_Id = #value#
- </select>
-
-
- <select id="GetAccountAsHashtableResultClass"
- parameterClass="int"
- resultClass="array">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAllAccountsAsHashtableViaResultClass"
- resultClass="array">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- order by Account_Id
- </select>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="Account">
+
+
+ <cacheModel id="account-cache" implementation="LRU" >
+ <flushInterval hours="24"/>
+ <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
+ <flushOnExecute statement="UpdateAccountViaParameterMap"/>
+ <property id="CacheSize" value="50"/>
+ </cacheModel>
+
+
+ <resultMap id="account-result" class="Account" >
+ <result property="Id" column="Account_ID"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email" nullValue="no_email@provided.com"/>
+ <result property="BannerOptions" column="Account_Banner_Option" dbType="Varchar" typeHandler="OuiNonBool"/>
+ <result property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
+ </resultMap>
+ <resultMap id="indexed-account-result" class="Account">
+ <result property="Id" column="Account_ID" columnIndex="0"/>
+ <result property="FirstName" column="Account_FirstName" columnIndex="1"/>
+ <result property="LastName" column="Account_LastName" columnIndex="2"/>
+ <result property="EmailAddress" column="Account_Email" columnIndex="3" nullValue="no_email@provided.com"/>
+ </resultMap>
+ <resultMap id="account-result-nullable-email" class="Account">
+ <result property="Id" column="Account_ID"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email"/>
+ </resultMap>
+
+ <resultMap id="email-result" class="string">
+ <result property="value" column="Account_Email"/>
+ </resultMap>
+
+ <resultMap id="account-hashtable-result" class="array">
+ <result property="Id" column="Account_ID"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email"/>
+ </resultMap>
+
+
+<!-- =============================================
+ MAPPED STATEMENTS - w/Inline Parameters
+=============================================
+-->
+
+ <select id="GetAllAccountsAsArrayListViaResultClass" resultClass="TList">
+ select
+ Account_ID as ID,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
+ <select id="GetAccountsDynamic" resultMap="account-result" parameterClass="array" >
+ select top $MaximumAllowed$ * from Accounts
+ <dynamic prepend="where">
+ <isParameterPresent>
+ <isNotEmpty prepend="and" property="FirstName" >
+ Account_FirstName LIKE '%$FirstName$%'
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName LIKE '%$LastName$%'
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="EmailAddress" >
+ Account_Email LIKE '%$EmailAddress$%'
+ </isNotEmpty>
+ </isParameterPresent>
+ </dynamic>
+ order by Account_LastName
+ </select>
+
+ <select id="SelectWithProperty"
+ resultMap="account-result">
+ select *
+ from Accounts
+ where Account_FirstName = ${accountName}
+ </select>
+
+ <select id="GetCachedAccountsViaResultMap"
+ resultMap="account-result"
+ cacheModel="account-cache" >
+ select *
+ from Accounts
+ order by Account_ID
+ </select>
+
+ <select id="GetNoAccountWithCache"
+ parameterClass="Integer"
+ resultMap="account-hashtable-result"
+ cacheModel="account-cache">
+ select *
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetAccountAsarray"
+ parameterClass="Integer"
+ resultMap="account-hashtable-result">
+ select *
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetAllAccountsAsHashMapViaResultMap"
+ resultMap="account-hashtable-result">
+ select *
+ from Accounts
+ order by Account_ID
+ </select>
+
+ <select id="GetAccountAsarrayResultClass"
+ parameterClass="int"
+ resultClass="HashMap">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetAllAccountsAsarrayViaResultClass"
+ resultClass="array">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
+ <select id="GetAccountViaColumnName"
+ parameterClass="int"
+ resultMap="account-result">
+ select
+ Account_ID,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email,
+ Account_Banner_Option,
+ Account_Cart_Option
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetAccountViaColumnIndex"
+ parameterClass="int"
+ resultMap="indexed-account-result">
+ select
+ Account_ID,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetAllAccountsViaResultMap"
+ resultMap="account-result">
+ select * from Accounts
+ order by Account_ID
+ </select>
+
+ <select id="GetAllAccountsViaResultClass"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
+ <select id="GetFewAccountsViaResultMap"
+ resultMap="account-result">
+ <![CDATA[
+ select * from Accounts
+ where Account_ID < 2
+ order by Account_ID
+ ]]>
+ </select>
+
+ <select id="GetNoAccountsViaResultMap"
+ resultMap="account-result">
+ select * from Accounts
+ where Account_ID > 1000
+ order by Account_ID
+ </select>
+
+
+ <select id="GetAccountNullableEmail"
+ resultMap="account-result-nullable-email">
+ select
+ Account_ID,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetAccountViaResultClass"
+ resultClass="Account">
+ <![CDATA[
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_ID = #value#
+ ]]>
+ </select>
+
+ <select id="GetAccountViaInlineParameters"
+ resultMap="indexed-account-result">
+ select
+ Account_ID,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_ID = #Id# and Account_ID = #Id#
+ </select>
+
+ <select id="GetEmailAddressViaResultClass" resultClass="string">
+ select Account_Email as value
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetEmailAddressViaResultMap"
+ parameterClass="int"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetAllEmailAddressesViaResultClass"
+ resultClass="string">
+ select Account_Email
+ from Accounts
+ order by Account_ID
+ </select>
+
+ <select id="GetAllEmailAddressesViaResultMap"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ order by Account_ID
+ </select>
+
+ <insert id="InsertAccountViaParameterMap"
+ parameterMap="account-insert-params">
+ insert into Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option)
+ values
+ (?, ?, ?, ?, ?, ?)
+ </insert>
+
+ <update id="UpdateAccountViaParameterMap"
+ parameterMap="update-params">
+ update Accounts set
+ Account_FirstName = ?,
+ Account_LastName = ?,
+ Account_Email = ?
+ where
+ Account_ID = ?
+ </update>
+
+ <update id="UpdateAccountViaParameterMap2"
+ parameterMap="update-params2">
+ update Accounts set
+ Account_ID = ?,
+ Account_FirstName = ?,
+ Account_LastName = ?,
+ Account_Email = ?
+ where
+ Account_ID = ?
+ </update>
+
+ <delete id="DeleteAccountViaInlineParameters">
+ delete from Accounts
+ where
+ Account_ID = #Id#
+ </delete>
+
+ <select id="GetAccountComplexMapping"
+ resultMap="indexed-account-result"
+ parameterClass="array">
+ select *
+ from Accounts
+ where
+ Account_FirstName = #Account.FirstName#
+ And Account_LastName = #Order.City#
+ </select>
+
+ <select id="GetDynamicOrderedEmailAddressesViaResultMap"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ order by $value$
+ </select>
+
+ <!-- Dynamic statements -->
+ <select id="GetAllAccountsViaResultMapWithDynamicElement"
+ resultMap="indexed-account-result">
+ select * from Accounts
+ where Account_Email $value$ '%@%'
+ order by Account_ID
+ </select>
+
+ <select id="SimpleDynamicSubstitution"
+ parameterClass="array"
+ resultClass="Account">
+ $statement$
+ </select>
+
+ <!-- Public Fields -->
+ <insert id="InsertAccountViaPublicFields">
+ insert into Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#Id#, #FirstName#, #LastName#, #EmailAddress#
+ )
+ </insert>
+
+ <!-- Inline Parameters -->
+ <update id="UpdateAccountViaInlineParameters"
+ parameterClass="Account">
+ update Accounts set
+ Account_FirstName = #FirstName#,
+ Account_LastName = #LastName#,
+ Account_Email = #EmailAddress, nullValue=no_email@provided.com#
+ where
+ Account_ID = #Id#
+ </update>
+
+ <insert id="InsertAccountViaInlineParameters"
+ parameterClass="Account" >
+ insert into Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#Id#, #FirstName#, #LastName#, #EmailAddress, nullValue=no_email@provided.com#
+ )
+ </insert>
+
+ <insert id="InsertAccountNullableEmail"
+ parameterClass="Account" >
+ insert into Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email)
+ values
+ ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
+ </insert>
+
+ <insert id="InsertAccountUknownParameterClass">
+ insert into Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email)
+ values
+ ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
+ </insert>
+
+ <delete id="DeleteAccount" parameterClass="Account">
+ delete from Accounts
+ where Account_ID = #Id, type=integer#
+ and Account_ID = #Id, type=integer#
+ </delete>
+
+ <!-- Extends statement -->
+ <select id="GetAllAccounts"
+ resultMap="indexed-account-result">
+ select
+ Account_ID,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ </select>
+
+ <select id="GetAllAccountsOrderByName"
+ extends="GetAllAccounts"
+ resultMap="indexed-account-result">
+ order by Account_FirstName
+ </select>
+
+ <select id="GetOneAccount"
+ extends="GetAllAccounts"
+ resultMap="indexed-account-result">
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetSomeAccount"
+ extends="GetAllAccounts"
+ parameterClass="array"
+ resultMap="indexed-account-result">
+ where Account_ID between #lowID# and #hightID#
+ </select>
+
+ <select id="SelectAccountJIRA29" parameterClass="map" resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_FirstName = '##$AccountName$##'
+ </select>
+
+ <select id="SelectAccountJIRA29-2"
+ parameterClass="array"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where 1=1
+ <isNotEmpty prepend="AND" property="Foo">
+ (Account_FirstName = '##$Foo$##')
+ </isNotEmpty>
+ </select>
+
+ <select id="GetAccountWithRepeatingProperty"
+ parameterClass="Account"
+ resultMap="indexed-account-result">
+ select
+ Account_ID,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_ID = #Id# and
+ Account_ID = #Id# and
+ Account_FirstName = #FirstName# and
+ Account_LastName = #LastName# and
+ Account_ID = #Id#
+ </select>
+
+ <select id="GetAllAccountsViaCustomTypeHandler"
+ resultMap="account-result">
+ select * from Accounts
+ order by Account_ID
+ </select>
+
+ <!-- JIRA-110 -->
+ <select id="GetManyAccound" resultClass="Account">
+ <![CDATA[
+ SELECT
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ FROM Accounts
+ ]]>
+ </select>
+
+ <select id="Get1Account" extends="GetManyAccound" resultClass="Account">WHERE Account_ID=1</select>
+
+ <statement id="GetAccounts" resultMap="account-result">
+ <![CDATA[SELECT * ]]>
+ <![CDATA[FROM ]]>
+ Accounts
+ </statement>
+ <!-- JIRA-110 -->
+
+ <insert id="InsertAccountDynamic" parameterClass="Account">
+ INSERT INTO Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email)
+ VALUES(#Id#, #FirstName#, #LastName#
+ <dynamic prepend=",">
+ <isNotNull prepend="," property="EmailAddress">
+ #EmailAddress#
+ </isNotNull>
+ <isNull prepend="," property="EmailAddress">
+ null
+ </isNull>
+ </dynamic>
+ )
+ </insert>
+
+ <!-- For procedure, the parameters of the parameterMap must in the same order
+ as for the procedure paramaters-->
+ <procedure id="InsertAccountViaStoreProcedure" parameterMap="account-insert-params">
+ ps_InsertAccount
+ </procedure>
+
+ <procedure id="SwapEmailAddresses" parameterMap="swap-params">
+ ps_swap_email_address
+ </procedure>
+
+ <procedure id="GetAccountViaSP" parameterMap="select-params" resultClass="Account">
+ ps_SelectAccount
+ </procedure>
+
+<!-- =============================================
+ OPTIONAL EXPLICIT PARAMETER MAP
+============================================= -->
+
+ <parameterMap id="swap-params">
+ <parameter property="email1" column="First_Email" />
+ <parameter property="email2" column="Second_Email" />
+ </parameterMap>
+
+ <parameterMap id="select-params">
+ <parameter property="Account_ID" />
+ </parameterMap>
+
+ <parameterMap id="account-insert-params">
+ <parameter property="Id" />
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="BannerOptions" dbType="Varchar" type="bool"/>
+ <parameter property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
+ </parameterMap>
+
+ <parameterMap id="update-params">
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="Id" />
+ </parameterMap>
+
+ <parameterMap id="update-params2">
+ <parameter property="Id" />
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="Id" />
+ </parameterMap>
+
+
+ <!-- accounts and orders -->
+
+ <select id="getAccountWithOrders" resultMap="Account-with-Orders">
+ SELECT * FROM accounts
+ LEFT JOIN orders ON
+ accounts.account_id = orders.account_id
+ </select>
+
+ <resultMap id="Account-with-Orders" class="AccountWithOrders" groupBy="Account_ID">
+ <result property="Id" column="Account_ID"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email" />
+ <result property="Orders" resultMapping="account-orders" />
+ </resultMap>
+
+ <resultMap id="account-orders" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ </resultMap>
+
+ <select id="GetAccountAsHashtable"
+ parameterClass="Integer"
+ resultMap="account-hashtable-result">
+ select *
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+
+ <select id="GetAccountAsHashtableResultClass"
+ parameterClass="int"
+ resultClass="array">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllAccountsAsHashtableViaResultClass"
+ resultClass="array">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_Id
+ </select>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/mssql/Category.xml b/tests/unit/Data/SqlMap/maps/mssql/Category.xml
index b0e004a5..6756f1fa 100644
--- a/tests/simple_unit/SqlMap/maps/mssql/Category.xml
+++ b/tests/unit/Data/SqlMap/maps/mssql/Category.xml
@@ -1,171 +1,171 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMap namespace="Category" >
-
-
- <select id="GetCategory" parameterClass="Integer" resultClass="Category">
- select
- Category_ID as Id,
- Category_Name as Name,
- Category_Guid as Guid
- from Categories
- where Category_ID = #value#
- </select>
-
-
- <!-- Test for statement as insert -->
- <statement id="InsertCategory" parameterClass="Category" resultClass="int">
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (#Name#, #Guid:UniqueIdentifier#);
- select SCOPE_IDENTITY() as value
- </statement><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
-
- <!-- Test for Guid Parameter Class-->
- <statement id="InsertCategoryGuidParameterClass" parameterClass="Guid" resultClass="int">
- insert into Categories
- (Category_Name, Category_Guid)
- values
- ('toto', #value:UniqueIdentifier#);
- select SCOPE_IDENTITY() as value
- </statement><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
-
- <!-- JIRA 20 Test without specifying the dbtype-->
- <statement id="InsertCategoryGuidParameterClassJIRA20" parameterClass="Guid" resultClass="int">
- insert into Categories
- (Category_Name, Category_Guid)
- values
- ('toto', #value#);
- select SCOPE_IDENTITY() as value
- </statement>
-
- <insert id="InsertCategoryViaInsertStatement" parameterClass="Category" >
- <selectKey property="Id" type="post" resultClass="int">
- ${selectKey}
- </selectKey>
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (#Name#, #Guid:UniqueIdentifier#)
- </insert><!--Guid for Oledb, UniqueIdentifier for SqlClient, Odbc -->
-
- <insert id="InsertCategoryWithProperties" parameterClass="Category" >
- <selectKey property="Id" type="post" resultClass="int">
- ${selectKey}
- </selectKey>
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (${MyCategoryName}, #Guid:UniqueIdentifier#)
- </insert>
-
- <statement id="InsertCategoryViaParameterMap" parameterMap="InsertParam" resultClass="int">
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (?,?);
- select SCOPE_IDENTITY() as value
- </statement>
-
- <statement id="InsertCategoryNull" parameterMap="insert-null-params" resultClass="int">
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (?,?);
- select SCOPE_IDENTITY() as value
- </statement>
-
- <update id="UpdateCategoryViaParameterMap" parameterMap="UpdateParam">
- update Categories set
- Category_Name =?,
- Category_Guid = ?
- where
- Category_Id = ?
- </update>
-
- <procedure id="InsertCategoryViaStoreProcedure" parameterMap="category-insert-params">
- ps_InsertCategorie
- </procedure>
-
- <insert id="InsertCategoryGenerate" parameterMap="insert-generate-params">
- <selectKey property="Id" type="post" resultClass="int">
- select @@IDENTITY as value
- </selectKey>
- <generate table="Categories" />
- </insert>
-
- <update id="UpdateCategoryGenerate" parameterMap="update-generate-params">
- <generate table="Categories" by="Category_Id"/>
- </update>
-
- <delete id="DeleteCategoryGenerate" parameterMap="delete-generate-params">
- <generate table="Categories" by="Category_Id, Category_Name"/>
- </delete>
-
- <select id="SelectByPKCategoryGenerate" resultClass="Category" parameterClass="Category" parameterMap="select-generate-params">
- <generate table="Categories" by="Category_Id"/>
- </select>
-
- <select id="SelectAllCategoryGenerate" resultClass="Category" parameterMap="select-generate-params">
- <generate table="Categories" />
- </select>
-
- <statement id="DynamicGuid"
- resultClass="Category"
- parameterClass="Category">
- select
- Category_ID as Id,
- Category_Name as Name,
- Category_Guid as Guid
- from Categories
- <dynamic prepend="where">
- <isNotEqual prepend="and" property="Guid" compareProperty="EmptyGuid">
- Category_Guid=#Guid:UniqueIdentifier#
- </isNotEqual>
- </dynamic>
- </statement>
-
- <parameterMap id="category-insert-params">
- <parameter property="Id" column="Category_Id" dbType="Int" /><!-- Int for SqlClient, Obdc; Integer for Oledb -->
- <parameter property="Name" column="Category_Name"/>
- <parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
- </parameterMap>
-
- <parameterMap id="InsertParam">
- <parameter property="Name" column="Category_Name"/>
- <parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
- </parameterMap>
-
- <parameterMap id="insert-null-params">
- <parameter property="Name" column="Category_Name"/>
- <parameter property="Guid" column="Category_Guid" nullValue="00000000-0000-0000-0000-000000000000" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
- </parameterMap>
-
- <parameterMap id="UpdateParam" extends="InsertParam">
- <parameter property="Id" column="Category_Id" />
- </parameterMap>
-
- <!-- Used by generated statement -->
-
- <parameterMap id="insert-generate-params">
- <parameter property="Name" column="Category_Name"/>
- <parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
- </parameterMap>
-
- <parameterMap id="update-generate-params" extends="insert-generate-params">
- <parameter property="Id" column="Category_Id" />
- </parameterMap>
-
- <parameterMap id="delete-generate-params">
- <parameter property="Id" column="Category_Id" />
- <parameter property="Name" column="Category_Name"/>
- </parameterMap>
-
- <parameterMap id="select-generate-params">
- <parameter property="Id" column="Category_Id" />
- <parameter property="Name" column="Category_Name"/>
- <parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"/>
- </parameterMap>
-
-
-</sqlMap>
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Category" >
+
+
+ <select id="GetCategory" parameterClass="Integer" resultClass="Category">
+ select
+ Category_ID as Id,
+ Category_Name as Name,
+ Category_Guid as Guid
+ from Categories
+ where Category_ID = #value#
+ </select>
+
+
+ <!-- Test for statement as insert -->
+ <statement id="InsertCategory" parameterClass="Category" resultClass="int">
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (#Name#, #Guid:UniqueIdentifier#);
+ select SCOPE_IDENTITY() as value
+ </statement><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
+
+ <!-- Test for Guid Parameter Class-->
+ <statement id="InsertCategoryGuidParameterClass" parameterClass="Guid" resultClass="int">
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ ('toto', #value:UniqueIdentifier#);
+ select SCOPE_IDENTITY() as value
+ </statement><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
+
+ <!-- JIRA 20 Test without specifying the dbtype-->
+ <statement id="InsertCategoryGuidParameterClassJIRA20" parameterClass="Guid" resultClass="int">
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ ('toto', #value#);
+ select SCOPE_IDENTITY() as value
+ </statement>
+
+ <insert id="InsertCategoryViaInsertStatement" parameterClass="Category" >
+ <selectKey property="Id" type="post" resultClass="int">
+ ${selectKey}
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (#Name#, #Guid:UniqueIdentifier#)
+ </insert><!--Guid for Oledb, UniqueIdentifier for SqlClient, Odbc -->
+
+ <insert id="InsertCategoryWithProperties" parameterClass="Category" >
+ <selectKey property="Id" type="post" resultClass="int">
+ ${selectKey}
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (${MyCategoryName}, #Guid:UniqueIdentifier#)
+ </insert>
+
+ <statement id="InsertCategoryViaParameterMap" parameterMap="InsertParam" resultClass="int">
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (?,?);
+ select SCOPE_IDENTITY() as value
+ </statement>
+
+ <statement id="InsertCategoryNull" parameterMap="insert-null-params" resultClass="int">
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (?,?);
+ select SCOPE_IDENTITY() as value
+ </statement>
+
+ <update id="UpdateCategoryViaParameterMap" parameterMap="UpdateParam">
+ update Categories set
+ Category_Name =?,
+ Category_Guid = ?
+ where
+ Category_Id = ?
+ </update>
+
+ <procedure id="InsertCategoryViaStoreProcedure" parameterMap="category-insert-params">
+ ps_InsertCategorie
+ </procedure>
+
+ <insert id="InsertCategoryGenerate" parameterMap="insert-generate-params">
+ <selectKey property="Id" type="post" resultClass="int">
+ select @@IDENTITY as value
+ </selectKey>
+ <generate table="Categories" />
+ </insert>
+
+ <update id="UpdateCategoryGenerate" parameterMap="update-generate-params">
+ <generate table="Categories" by="Category_Id"/>
+ </update>
+
+ <delete id="DeleteCategoryGenerate" parameterMap="delete-generate-params">
+ <generate table="Categories" by="Category_Id, Category_Name"/>
+ </delete>
+
+ <select id="SelectByPKCategoryGenerate" resultClass="Category" parameterClass="Category" parameterMap="select-generate-params">
+ <generate table="Categories" by="Category_Id"/>
+ </select>
+
+ <select id="SelectAllCategoryGenerate" resultClass="Category" parameterMap="select-generate-params">
+ <generate table="Categories" />
+ </select>
+
+ <statement id="DynamicGuid"
+ resultClass="Category"
+ parameterClass="Category">
+ select
+ Category_ID as Id,
+ Category_Name as Name,
+ Category_Guid as Guid
+ from Categories
+ <dynamic prepend="where">
+ <isNotEqual prepend="and" property="Guid" compareProperty="EmptyGuid">
+ Category_Guid=#Guid:UniqueIdentifier#
+ </isNotEqual>
+ </dynamic>
+ </statement>
+
+ <parameterMap id="category-insert-params">
+ <parameter property="Id" column="Category_Id" dbType="Int" /><!-- Int for SqlClient, Obdc; Integer for Oledb -->
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
+ </parameterMap>
+
+ <parameterMap id="InsertParam">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
+ </parameterMap>
+
+ <parameterMap id="insert-null-params">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="Guid" column="Category_Guid" nullValue="00000000-0000-0000-0000-000000000000" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
+ </parameterMap>
+
+ <parameterMap id="UpdateParam" extends="InsertParam">
+ <parameter property="Id" column="Category_Id" />
+ </parameterMap>
+
+ <!-- Used by generated statement -->
+
+ <parameterMap id="insert-generate-params">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"/><!--Guid for Oledb, UniqueIdentifier for SqlClient,Odbc -->
+ </parameterMap>
+
+ <parameterMap id="update-generate-params" extends="insert-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ </parameterMap>
+
+ <parameterMap id="delete-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ <parameter property="Name" column="Category_Name"/>
+ </parameterMap>
+
+ <parameterMap id="select-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"/>
+ </parameterMap>
+
+
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/mssql/Complex.xml b/tests/unit/Data/SqlMap/maps/mssql/Complex.xml
index 5a1bbf9c..91b346ca 100644
--- a/tests/simple_unit/SqlMap/maps/mssql/Complex.xml
+++ b/tests/unit/Data/SqlMap/maps/mssql/Complex.xml
@@ -1,21 +1,21 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Category" >
-
-
- <statement id="ComplexMap"
- resultClass="int" >
- select Account_ID from Accounts where Account_ID = #obj.Map.Id#
- </statement>
-
- <insert id="InsertComplexAccountViaInlineDefaultNull"
- parameterClass="array" >
- insert into Accounts
- (Account_ID, Account_FirstName, Account_LastName, Account_Email)
- values
- (#obj.Map.acct.Id#, #obj.Map.acct.FirstName#, #obj.Map.acct.LastName#, #obj.Map.acct.EmailAddress:VarChar:no_email@provided.com#
- )
- </insert>
-
-
-
-</sqlMap>
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Category" >
+
+
+ <statement id="ComplexMap"
+ resultClass="int" >
+ select Account_ID from Accounts where Account_ID = #obj.Map.Id#
+ </statement>
+
+ <insert id="InsertComplexAccountViaInlineDefaultNull"
+ parameterClass="array" >
+ insert into Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#obj.Map.acct.Id#, #obj.Map.acct.FirstName#, #obj.Map.acct.LastName#, #obj.Map.acct.EmailAddress:VarChar:no_email@provided.com#
+ )
+ </insert>
+
+
+
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/mssql/Document.xml b/tests/unit/Data/SqlMap/maps/mssql/Document.xml
index 5c9b6b14..de02c1ab 100644
--- a/tests/simple_unit/SqlMap/maps/mssql/Document.xml
+++ b/tests/unit/Data/SqlMap/maps/mssql/Document.xml
@@ -1,53 +1,53 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Document" >
-
- <resultMap id="document" class="Document">
- <result property="Id" column="Document_ID"/>
- <result property="Title" column="Document_Title"/>
- <discriminator column="Document_Type" type="string"/>
- <subMap value="Book" resultMapping="book" />
- <subMap value="Newspaper" resultMapping="newspaper" />
- </resultMap>
-
- <resultMap id="document-custom-handler" class="Document">
- <result property="Id" column="Document_ID"/>
- <result property="Title" column="Document_Title"/>
- <discriminator column="Document_Type" typeHandler="CustomInheritance"/>
- <subMap value="Book" resultMapping="book" />
- <subMap value="Newspaper" resultMapping="newspaper" />
- </resultMap>
-
- <resultMap id="book" class="Book" extends="document">
- <result property="PageNumber" column="Document_PageNumber"/>
- </resultMap>
-
- <resultMap id="newspaper" class="Newspaper" extends="document">
- <result property="City" column="Document_City"/>
- </resultMap>
-
- <select id="GetAllDocument"
- resultMap="document">
- select
- *
- from Documents
- order by Document_Type, Document_ID
- </select>
-
- <select id="GetTypedCollection"
- listClass="DocumentCollection"
- resultMap="document">
- select
- *
- from Documents
- order by Document_Type, Document_ID
- </select>
-
- <select id="GetAllDocumentWithCustomTypeHandler"
- resultMap="document-custom-handler">
- select
- *
- from Documents
- order by Document_Type, Document_ID
- </select>
-
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Document" >
+
+ <resultMap id="document" class="Document">
+ <result property="Id" column="Document_ID"/>
+ <result property="Title" column="Document_Title"/>
+ <discriminator column="Document_Type" type="string"/>
+ <subMap value="Book" resultMapping="book" />
+ <subMap value="Newspaper" resultMapping="newspaper" />
+ </resultMap>
+
+ <resultMap id="document-custom-handler" class="Document">
+ <result property="Id" column="Document_ID"/>
+ <result property="Title" column="Document_Title"/>
+ <discriminator column="Document_Type" typeHandler="CustomInheritance"/>
+ <subMap value="Book" resultMapping="book" />
+ <subMap value="Newspaper" resultMapping="newspaper" />
+ </resultMap>
+
+ <resultMap id="book" class="Book" extends="document">
+ <result property="PageNumber" column="Document_PageNumber"/>
+ </resultMap>
+
+ <resultMap id="newspaper" class="Newspaper" extends="document">
+ <result property="City" column="Document_City"/>
+ </resultMap>
+
+ <select id="GetAllDocument"
+ resultMap="document">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_ID
+ </select>
+
+ <select id="GetTypedCollection"
+ listClass="DocumentCollection"
+ resultMap="document">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_ID
+ </select>
+
+ <select id="GetAllDocumentWithCustomTypeHandler"
+ resultMap="document-custom-handler">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_ID
+ </select>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/mssql/DynamicAccount.xml b/tests/unit/Data/SqlMap/maps/mssql/DynamicAccount.xml
index 355ef4f8..492cd0c8 100644
--- a/tests/simple_unit/SqlMap/maps/mssql/DynamicAccount.xml
+++ b/tests/unit/Data/SqlMap/maps/mssql/DynamicAccount.xml
@@ -1,438 +1,438 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Account" >
- <select id="DynamicAll"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- </select>
-
- <select id="DynamicWithExtend"
- extends="DynamicAll"
- parameterClass="Account"
- resultClass="Account">
- <dynamic prepend="WHERE" >
- <isGreaterThan prepend="AND" property="Id" compareValue="0" >
- Account_ID = #Id#
- </isGreaterThan>
- <isNotNull prepend="AND" property="Ids" >
- Account_ID in
- <iterate property="Ids" open="(" close=")" conjunction="," >
- #Ids[]#
- </iterate>
- </isNotNull>
- <isNotEmpty prepend="AND" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="EmailAddress" >
- <isEqual property="EmailAddress" compareValue="Joe">
- Account_Email = 'clinton.begin@ibatis.com'
- </isEqual>
- <isNotEqual property="EmailAddress" compareValue="Joe">
- Account_Email = #EmailAddress#
- </isNotEqual>
- </isNotEmpty>
- </dynamic>
- </select>
-
- <!-- IBATISNET-114: remapResults -->
- <statement id="DynamicSqlOnColumnSelection"
- parameterClass="Account"
- resultClass="Account"
- remapResults="true">
- SELECT
- Account_ID as Id,
- <dynamic>
- <isEqual property="LastName" compareValue="Dalton" >
- Account_FirstName as FirstName,
- </isEqual>
- <isEqual property="LastName" compareValue="Dalton" >
- Account_LastName as LastName,
- </isEqual>
- </dynamic>
-
- Account_Email as EmailAddress
- FROM
- Accounts
- </statement>
-
- <statement id="DynamicIsEqual"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isEqual compareValue="Joe" >
- where Account_FirstName = 'Joe'
- </isEqual>
- </statement>
-
- <statement id="DynamicIsParameterPresent"
- parameterClass="integer"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isParameterPresent >
- where Account_ID = #value#
- </isParameterPresent>
- </statement>
-
- <statement id="DynamicIsNotEmpty"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isNotEmpty>
- where Account_FirstName = #value#
- </isNotEmpty>
- </statement>
-
- <statement id="DynamicIsGreater"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isGreaterThan compareValue="3" >
- where Account_ID = 1
- </isGreaterThan>
- </statement>
-
- <statement id="DynamicIsGreaterEqual"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isGreaterEqual compareValue="3" >
- where Account_ID = 1
- </isGreaterEqual>
- </statement>
-
- <statement id="DynamicIsLess"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isLessThan compareValue="3" >
- where Account_ID = 1
- </isLessThan>
- </statement>
-
- <statement id="DynamicIsLessEqual"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isLessEqual compareValue="3" >
- where Account_ID = 1
- </isLessEqual>
- </statement>
-
- <statement id="DynamicIsNotNull"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isNotNull>
- where Account_ID = 1
- </isNotNull>
- </statement>
-
- <statement id="DynamicIsPropertyAvailable"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isPropertyAvailable property="Id" >
- where Account_ID = 1
- </isPropertyAvailable>
- </statement>
-
-
- <statement id="DynamicSubst"
- parameterClass="map"
- resultClass="Account">
- <dynamic>
- $statement$
- </dynamic>
- </statement>
-
- <statement id="DynamicIterate"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- WHERE Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- </statement>
-
- <statement id="DynamicIterate2"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- WHERE Account_ID IN
- <iterate property="Ids" open="(" close=")" conjunction="," >
- #Ids[]#
- </iterate>
- </statement>
-
- <statement id="MultiDynamicIterate"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- WHERE Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- and Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- </statement>
-
-
- <statement id="DynamicQueryByExample"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="WHERE" >
- <isGreaterThan prepend="AND" property="Id" compareValue="0" >
- Account_ID = #Id#
- </isGreaterThan>
- <isNotNull prepend="AND" property="Ids" >
- Account_ID in
- <iterate property="Ids" open="(" close=")" conjunction="," >
- #Ids[]#
- </iterate>
- </isNotNull>
- <isNotEmpty prepend="AND" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="EmailAddress" >
- <isEqual property="EmailAddress" compareValue="Joe">
- Account_Email = 'clinton.begin@ibatis.com'
- </isEqual>
- <isNotEqual property="EmailAddress" compareValue="Joe">
- Account_Email = #EmailAddress#
- </isNotEqual>
- </isNotEmpty>
- </dynamic>
- </statement>
-
- <statement id="DynamicIterateWithPrepend1"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where" >
- Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- </dynamic>
- </statement>
-
- <statement id="DynamicIterateWithPrepend2"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where" >
- <iterate open="(" close=")" conjunction="OR">
- Account_ID = #[]#
- </iterate>
- </dynamic>
- </statement>
-
- <statement id="DynamicIterateWithPrepend3"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where" >
- <isParameterPresent prepend="BLAH!" >
- <iterate open="(" close=")" conjunction="OR">
- Account_ID = #[]#
- </iterate>
- </isParameterPresent>
- </dynamic>
- </statement>
-
- <statement id="DynamicWithPrepend"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where">
- <isParameterPresent>
- <isNotEmpty prepend="and" property="Id" >
- Account_ID = #Id#
- </isNotEmpty>
- <isNotEmpty prepend="and" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="and" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- </isParameterPresent>
- </dynamic>
- </statement>
-
- <statement id="DynamicWithTwoDynamicElements"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where">
- <isNotEmpty prepend="BLAH!" property="Id" >
- Account_ID = #Id#
- </isNotEmpty>
- </dynamic>
- <dynamic prepend="and">
- <isNotEmpty prepend="BLAH!" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="and" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- </dynamic>
- </statement>
-
- <statement id="ComplexDynamicStatement"
- cacheModel="account-cache"
- resultClass="Account"
- parameterClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="WHERE">
- <isNotNull prepend="AND" property="FirstName">
- (Account_FirstName = #FirstName#
- <isNotNull prepend="OR" property="LastName">
- Account_LastName = #LastName#
- </isNotNull>
- )
- </isNotNull>
- <isNotNull prepend="AND" property="EmailAddress">
- Account_Email like #EmailAddress#
- </isNotNull>
- <isGreaterThan prepend="AND" property="Id" compareValue="0">
- Account_ID = #Id#
- </isGreaterThan>
- </dynamic>
- order by Account_LastName
- </statement>
-
- <statement id="Jira-IBATISNET-11"
- resultClass="Account"
- parameterClass="Search">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where">
- <isNotNull prepend="and" property="NumberSearch">
- ((Account_ID $Operande$ #NumberSearch#) or
- (Account_ID $Operande$ #NumberSearch#))
- </isNotNull>
- <isEqual prepend="and" property="StartDate" compareValue="25/12/2004">
- <![CDATA[Account_FirstName >= #StartDate# ]]>
- </isEqual>
- <isEqual prepend="and" property="StartDateAnd" compareValue="true">
- <![CDATA[Account_LastName >= #StartDate# ]]>
- </isEqual>
- </dynamic>
-
- order by Account_LastName
- </statement>
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Account" >
+ <select id="DynamicAll"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ </select>
+
+ <select id="DynamicWithExtend"
+ extends="DynamicAll"
+ parameterClass="Account"
+ resultClass="Account">
+ <dynamic prepend="WHERE" >
+ <isGreaterThan prepend="AND" property="Id" compareValue="0" >
+ Account_ID = #Id#
+ </isGreaterThan>
+ <isNotNull prepend="AND" property="Ids" >
+ Account_ID in
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </isNotNull>
+ <isNotEmpty prepend="AND" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="EmailAddress" >
+ <isEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = 'clinton.begin@ibatis.com'
+ </isEqual>
+ <isNotEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = #EmailAddress#
+ </isNotEqual>
+ </isNotEmpty>
+ </dynamic>
+ </select>
+
+ <!-- IBATISNET-114: remapResults -->
+ <statement id="DynamicSqlOnColumnSelection"
+ parameterClass="Account"
+ resultClass="Account"
+ remapResults="true">
+ SELECT
+ Account_ID as Id,
+ <dynamic>
+ <isEqual property="LastName" compareValue="Dalton" >
+ Account_FirstName as FirstName,
+ </isEqual>
+ <isEqual property="LastName" compareValue="Dalton" >
+ Account_LastName as LastName,
+ </isEqual>
+ </dynamic>
+
+ Account_Email as EmailAddress
+ FROM
+ Accounts
+ </statement>
+
+ <statement id="DynamicIsEqual"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isEqual compareValue="Joe" >
+ where Account_FirstName = 'Joe'
+ </isEqual>
+ </statement>
+
+ <statement id="DynamicIsParameterPresent"
+ parameterClass="integer"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isParameterPresent >
+ where Account_ID = #value#
+ </isParameterPresent>
+ </statement>
+
+ <statement id="DynamicIsNotEmpty"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isNotEmpty>
+ where Account_FirstName = #value#
+ </isNotEmpty>
+ </statement>
+
+ <statement id="DynamicIsGreater"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isGreaterThan compareValue="3" >
+ where Account_ID = 1
+ </isGreaterThan>
+ </statement>
+
+ <statement id="DynamicIsGreaterEqual"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isGreaterEqual compareValue="3" >
+ where Account_ID = 1
+ </isGreaterEqual>
+ </statement>
+
+ <statement id="DynamicIsLess"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isLessThan compareValue="3" >
+ where Account_ID = 1
+ </isLessThan>
+ </statement>
+
+ <statement id="DynamicIsLessEqual"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isLessEqual compareValue="3" >
+ where Account_ID = 1
+ </isLessEqual>
+ </statement>
+
+ <statement id="DynamicIsNotNull"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isNotNull>
+ where Account_ID = 1
+ </isNotNull>
+ </statement>
+
+ <statement id="DynamicIsPropertyAvailable"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isPropertyAvailable property="Id" >
+ where Account_ID = 1
+ </isPropertyAvailable>
+ </statement>
+
+
+ <statement id="DynamicSubst"
+ parameterClass="map"
+ resultClass="Account">
+ <dynamic>
+ $statement$
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterate"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </statement>
+
+ <statement id="DynamicIterate2"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </statement>
+
+ <statement id="MultiDynamicIterate"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ and Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </statement>
+
+
+ <statement id="DynamicQueryByExample"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="WHERE" >
+ <isGreaterThan prepend="AND" property="Id" compareValue="0" >
+ Account_ID = #Id#
+ </isGreaterThan>
+ <isNotNull prepend="AND" property="Ids" >
+ Account_ID in
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </isNotNull>
+ <isNotEmpty prepend="AND" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="EmailAddress" >
+ <isEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = 'clinton.begin@ibatis.com'
+ </isEqual>
+ <isNotEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = #EmailAddress#
+ </isNotEqual>
+ </isNotEmpty>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend1"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend2"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ <iterate open="(" close=")" conjunction="OR">
+ Account_ID = #[]#
+ </iterate>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend3"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ <isParameterPresent prepend="BLAH!" >
+ <iterate open="(" close=")" conjunction="OR">
+ Account_ID = #[]#
+ </iterate>
+ </isParameterPresent>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicWithPrepend"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isParameterPresent>
+ <isNotEmpty prepend="and" property="Id" >
+ Account_ID = #Id#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ </isParameterPresent>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicWithTwoDynamicElements"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isNotEmpty prepend="BLAH!" property="Id" >
+ Account_ID = #Id#
+ </isNotEmpty>
+ </dynamic>
+ <dynamic prepend="and">
+ <isNotEmpty prepend="BLAH!" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ </dynamic>
+ </statement>
+
+ <statement id="ComplexDynamicStatement"
+ cacheModel="account-cache"
+ resultClass="Account"
+ parameterClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="WHERE">
+ <isNotNull prepend="AND" property="FirstName">
+ (Account_FirstName = #FirstName#
+ <isNotNull prepend="OR" property="LastName">
+ Account_LastName = #LastName#
+ </isNotNull>
+ )
+ </isNotNull>
+ <isNotNull prepend="AND" property="EmailAddress">
+ Account_Email like #EmailAddress#
+ </isNotNull>
+ <isGreaterThan prepend="AND" property="Id" compareValue="0">
+ Account_ID = #Id#
+ </isGreaterThan>
+ </dynamic>
+ order by Account_LastName
+ </statement>
+
+ <statement id="Jira-IBATISNET-11"
+ resultClass="Account"
+ parameterClass="Search">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isNotNull prepend="and" property="NumberSearch">
+ ((Account_ID $Operande$ #NumberSearch#) or
+ (Account_ID $Operande$ #NumberSearch#))
+ </isNotNull>
+ <isEqual prepend="and" property="StartDate" compareValue="25/12/2004">
+ <![CDATA[Account_FirstName >= #StartDate# ]]>
+ </isEqual>
+ <isEqual prepend="and" property="StartDateAnd" compareValue="true">
+ <![CDATA[Account_LastName >= #StartDate# ]]>
+ </isEqual>
+ </dynamic>
+
+ order by Account_LastName
+ </statement>
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/mssql/Enumeration.xml b/tests/unit/Data/SqlMap/maps/mssql/Enumeration.xml
index 938a4266..c010a8eb 100644
--- a/tests/simple_unit/SqlMap/maps/mssql/Enumeration.xml
+++ b/tests/unit/Data/SqlMap/maps/mssql/Enumeration.xml
@@ -1,47 +1,47 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMap namespace="Enumeration" >
-
- <resultMap id="enumeration-result" class="Enumeration" >
- <result property="Id" column="Enum_ID"/>
- <result property="Day" column="Enum_Day"/>
- <result property="Color" column="Enum_Color"/>
- <result property="Month" column="Enum_Month" nullValue="All"/>
- </resultMap>
-
- <select id="GetEnumerationNullValue"
- parameterClass="Integer"
- resultMap="enumeration-result">
- select
- Enum_ID,
- Enum_Day,
- Enum_Color,
- Enum_Month
- from Enumerations
- where Enum_ID = #value#
- </select>
-
- <select id="GetEnumeration" parameterClass="Integer" resultClass="Enumeration">
- select
- Enum_ID as Id,
- Enum_Day as Day,
- Enum_Color as Color,
- Enum_Month as Month
- from Enumerations
- where Enum_ID = #value#
- </select>
-
- <insert id="InsertEnumViaParameterMap" parameterMap="enum-insert-params" >
- insert into Enumerations
- (Enum_ID, Enum_Day, Enum_Color, Enum_Month)
- values
- (?, ?, ?, ?)
- </insert>
-
- <parameterMap id="enum-insert-params">
- <parameter property="Id" column="Enum_ID" />
- <parameter property="Day" column="Enum_Day"/>
- <parameter property="Color" column="Enum_Color" />
- <parameter property="Month" column="Enum_Month" nullValue="All"/>
- </parameterMap>
-
-</sqlMap>
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Enumeration" >
+
+ <resultMap id="enumeration-result" class="Enumeration" >
+ <result property="Id" column="Enum_ID"/>
+ <result property="Day" column="Enum_Day"/>
+ <result property="Color" column="Enum_Color"/>
+ <result property="Month" column="Enum_Month" nullValue="All"/>
+ </resultMap>
+
+ <select id="GetEnumerationNullValue"
+ parameterClass="Integer"
+ resultMap="enumeration-result">
+ select
+ Enum_ID,
+ Enum_Day,
+ Enum_Color,
+ Enum_Month
+ from Enumerations
+ where Enum_ID = #value#
+ </select>
+
+ <select id="GetEnumeration" parameterClass="Integer" resultClass="Enumeration">
+ select
+ Enum_ID as Id,
+ Enum_Day as Day,
+ Enum_Color as Color,
+ Enum_Month as Month
+ from Enumerations
+ where Enum_ID = #value#
+ </select>
+
+ <insert id="InsertEnumViaParameterMap" parameterMap="enum-insert-params" >
+ insert into Enumerations
+ (Enum_ID, Enum_Day, Enum_Color, Enum_Month)
+ values
+ (?, ?, ?, ?)
+ </insert>
+
+ <parameterMap id="enum-insert-params">
+ <parameter property="Id" column="Enum_ID" />
+ <parameter property="Day" column="Enum_Day"/>
+ <parameter property="Color" column="Enum_Color" />
+ <parameter property="Month" column="Enum_Month" nullValue="All"/>
+ </parameterMap>
+
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/mssql/LineItem.xml b/tests/unit/Data/SqlMap/maps/mssql/LineItem.xml
index ced09b52..33cb9294 100644
--- a/tests/simple_unit/SqlMap/maps/mssql/LineItem.xml
+++ b/tests/unit/Data/SqlMap/maps/mssql/LineItem.xml
@@ -1,182 +1,182 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sqlMap namespace="LineItem" >
-
- <resultMap id="LineItem-Price" class="decimal">
- <result property="value" column="LineItem_Price"/>
- </resultMap>
-
- <resultMap id="LineItem" class="LineItem">
- <result property="Id" column="LineItem_ID"/>
- <result property="Code" column="LineItem_Code"/>
- <result property="Quantity" column="LineItem_Quantity"/>
- <result property="Price" column="LineItem_Price"/>
- </resultMap>
-
- <resultMap id="LineItemWithNullReplacement" class="LineItem">
- <result property="Id" column="LineItem_ID"/>
- <result property="Code" column="LineItem_Code"/>
- <result property="Quantity" column="LineItem_Quantity"/>
- <result property="Price" column="LineItem_Price" nullValue="-77.77"/>
- </resultMap>
-
- <statement id="GetLineItemPrice"
- parameterClass="array"
- resultMap="LineItem-Price" >
- select
- LineItem_Price
- from LineItems
- where Order_ID = #Order_ID#
- and LineItem_ID = #LineItem_ID#
- </statement>
-
- <statement id="GetLineItemsForOrder"
- parameterClass="int"
- listClass="TList"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems where Order_ID = #value#
- </statement>
-
- <statement id="GetLineItemsForOrderWithListClass"
- parameterClass="int"
- listClass="LineItemCollection"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems where Order_ID = #value#
- order by LineItem_Code
- </statement>
-
- <statement id="GetSpecificLineItem"
- parameterClass="array"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems
- where Order_ID = #Order_ID#
- and LineItem_ID = #LineItem_ID#
- </statement>
-
- <statement id="GetSpecificLineItemWithPicture"
- parameterClass="array"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price,
- LineItem_Picture as PictureData
- from LineItems
- where Order_ID = #Order_ID#
- and LineItem_ID = #LineItem_ID#
- </statement>
-
- <select id="GetDynSpecificLineItem"
- parameterClass="HashMap"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems
- where Order_ID = #Order_ID#
- <dynamic>
- <isNotNull property="LineItem_ID">
- and LineItem_ID = #LineItem_ID#
- </isNotNull>
- </dynamic>
- </select>
-
- <statement id="GetSpecificLineItemWithNullReplacement"
- parameterClass="int"
- resultMap="LineItemWithNullReplacement">
- select
- LineItem_ID,
- LineItem_Code,
- LineItem_Quantity,
- LineItem_Price
- from LineItems
- where LineItem_ID = #value#
- </statement>
-
- <statement id="InsertLineItem"
- parameterMap="lineitem-insert-params" >
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (?, ?, ?, ?, ?);
- </statement>
-
- <statement id="InsertLineItemWithPicture"
- parameterMap="lineitem-insert-params-picture" >
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price, LineItem_Picture)
- values
- (?, ?, ?, ?, ?, ?);
- </statement>
-
- <insert id="InsertLineItemPostKey" parameterClass="LineItem">
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, dbType=Decimal#)
- <selectKey property="Id" type="post" resultClass="int" >
- select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
- </selectKey>
- </insert>
-
- <insert id="InsertLineItemPreKey" parameterClass="LineItem">
- <selectKey property="Id" type="pre" resultClass="int" >
- select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
- </selectKey>
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, dbType=Decimal#)
- </insert>
-
- <insert id="InsertLineItemNoKey" parameterClass="LineItem">
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, dbType=Decimal#)
- </insert>
-
- <!-- JIRA 23 -->
- <delete id="DeleteWithComments" >
- <!-- Delete LineItems -->
- delete from LineItems where Order_ID = 10
- <!-- Delete LineItems -->
- delete from LineItems where Order_ID = 9
- </delete>
-
- <parameterMap id="lineitem-insert-params">
- <parameter property="Id" />
- <parameter property="Order.Id" />
- <parameter property="Code" />
- <parameter property="Quantity" />
- <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
- </parameterMap>
-
- <parameterMap id="lineitem-insert-params-picture">
- <parameter property="Id" />
- <parameter property="Order.Id" />
- <parameter property="Code" />
- <parameter property="Quantity" />
- <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
- <parameter property="PictureData" dbType="Binary" /><!-- or Image -->
- </parameterMap>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="LineItem" >
+
+ <resultMap id="LineItem-Price" class="decimal">
+ <result property="value" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="LineItem" class="LineItem">
+ <result property="Id" column="LineItem_ID"/>
+ <result property="Code" column="LineItem_Code"/>
+ <result property="Quantity" column="LineItem_Quantity"/>
+ <result property="Price" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="LineItemWithNullReplacement" class="LineItem">
+ <result property="Id" column="LineItem_ID"/>
+ <result property="Code" column="LineItem_Code"/>
+ <result property="Quantity" column="LineItem_Quantity"/>
+ <result property="Price" column="LineItem_Price" nullValue="-77.77"/>
+ </resultMap>
+
+ <statement id="GetLineItemPrice"
+ parameterClass="array"
+ resultMap="LineItem-Price" >
+ select
+ LineItem_Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <statement id="GetLineItemsForOrder"
+ parameterClass="int"
+ listClass="TList"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems where Order_ID = #value#
+ </statement>
+
+ <statement id="GetLineItemsForOrderWithListClass"
+ parameterClass="int"
+ listClass="LineItemCollection"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems where Order_ID = #value#
+ order by LineItem_Code
+ </statement>
+
+ <statement id="GetSpecificLineItem"
+ parameterClass="array"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <statement id="GetSpecificLineItemWithPicture"
+ parameterClass="array"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price,
+ LineItem_Picture as PictureData
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <select id="GetDynSpecificLineItem"
+ parameterClass="HashMap"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ <dynamic>
+ <isNotNull property="LineItem_ID">
+ and LineItem_ID = #LineItem_ID#
+ </isNotNull>
+ </dynamic>
+ </select>
+
+ <statement id="GetSpecificLineItemWithNullReplacement"
+ parameterClass="int"
+ resultMap="LineItemWithNullReplacement">
+ select
+ LineItem_ID,
+ LineItem_Code,
+ LineItem_Quantity,
+ LineItem_Price
+ from LineItems
+ where LineItem_ID = #value#
+ </statement>
+
+ <statement id="InsertLineItem"
+ parameterMap="lineitem-insert-params" >
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (?, ?, ?, ?, ?);
+ </statement>
+
+ <statement id="InsertLineItemWithPicture"
+ parameterMap="lineitem-insert-params-picture" >
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price, LineItem_Picture)
+ values
+ (?, ?, ?, ?, ?, ?);
+ </statement>
+
+ <insert id="InsertLineItemPostKey" parameterClass="LineItem">
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, dbType=Decimal#)
+ <selectKey property="Id" type="post" resultClass="int" >
+ select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
+ </selectKey>
+ </insert>
+
+ <insert id="InsertLineItemPreKey" parameterClass="LineItem">
+ <selectKey property="Id" type="pre" resultClass="int" >
+ select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
+ </selectKey>
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, dbType=Decimal#)
+ </insert>
+
+ <insert id="InsertLineItemNoKey" parameterClass="LineItem">
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, dbType=Decimal#)
+ </insert>
+
+ <!-- JIRA 23 -->
+ <delete id="DeleteWithComments" >
+ <!-- Delete LineItems -->
+ delete from LineItems where Order_ID = 10
+ <!-- Delete LineItems -->
+ delete from LineItems where Order_ID = 9
+ </delete>
+
+ <parameterMap id="lineitem-insert-params">
+ <parameter property="Id" />
+ <parameter property="Order.Id" />
+ <parameter property="Code" />
+ <parameter property="Quantity" />
+ <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
+ </parameterMap>
+
+ <parameterMap id="lineitem-insert-params-picture">
+ <parameter property="Id" />
+ <parameter property="Order.Id" />
+ <parameter property="Code" />
+ <parameter property="Quantity" />
+ <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
+ <parameter property="PictureData" dbType="Binary" /><!-- or Image -->
+ </parameterMap>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/mssql/Order.xml b/tests/unit/Data/SqlMap/maps/mssql/Order.xml
index 14c9586a..87a2d1a0 100644
--- a/tests/simple_unit/SqlMap/maps/mssql/Order.xml
+++ b/tests/unit/Data/SqlMap/maps/mssql/Order.xml
@@ -1,475 +1,475 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sqlMap namespace="Order" >
-
-
- <resultMap id="credit-card-result" class="string">
- <result property="value" column="Order_CardNumber"/>
- </resultMap>
-
- <resultMap id="order-with-lines-result" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItemsList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder" />
- </resultMap>
-
- <resultMap id="order-with-lines-result-statement-namespaces" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItemsList" lazyLoad="true" column="Order_ID" select="LineItem.GetLineItemsForOrder" />
- </resultMap>
-
- <resultMap id="order-with-lines-collection" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItems" column="Order_ID" select="GetLineItemsForOrderWithListClass" />
- </resultMap>
-
- <resultMap id="order-with-lines-array" class="Order"
- extends="lite-order-result-by-name">
- <result property="LineItemsArray" column="Order_ID" select="GetLineItemsForOrder"/>
- </resultMap>
-
- <resultMap id="lite-order-map-result" class="array">
- <result property="Id" type="Int" column="Order_ID"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" type="string" column="Order_CardExpiry"/>
- <result property="CardType" type="string" column="Order_CardType"/>
- <result property="CardNumber" type="string" column="Order_CardNumber"/>
- <result property="Street" type="string" column="Order_Street"/>
- <result property="City" type="string" column="Order_City"/>
- <result property="Province" type="string" column="Order_Province"/>
- <result property="PostalCode" type="string" column="Order_PostalCode"/>
- </resultMap>
-
- <resultMap id="lite-order-result-by-name" class="Order">
- <result property="Id" column="Order_ID"/>
- <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- </resultMap>
-
- <resultMap id="order-with-types-result" class="Order">
- <result property="Id" column="Order_ID" dbType="Int"/><!-- Int for SqlClient, Obdc; Integer for Oledb -->
- <result property="Date" type="date" column="Order_Date" dbType="DateTime "/>
- <result property="CardExpiry" column="Order_CardExpiry" dbType="VarChar"/>
- <result property="CardType" column="Order_CardType" dbType="VarChar"/>
- <result property="CardNumber" column="Order_CardNumber" dbType="VarChar"/>
- <result property="Street" column="Order_Street" dbType="VarChar"/>
- <result property="City" column="Order_City" dbType="VarChar"/>
- <result property="Province" column="Order_Province" dbType="VarChar"/>
- <result property="PostalCode" column="Order_PostalCode" dbType="VarChar"/>
- </resultMap>
-
- <resultMap id="lite-order-result-by-index" class="Order">
- <result property="Id" column="Order_ID" columnIndex="0"/>
- <result property="Date" type="date" column="Order_Date" columnIndex="1" />
- <result property="CardExpiry" column="Order_CardExpiry" columnIndex="2"/>
- <result property="CardType" column="Order_CardType" columnIndex="3" />
- <result property="CardNumber" column="Order_CardNumber" columnIndex="4" />
- <result property="Street" column="Order_Street" columnIndex="5" />
- <result property="City" column="Order_City" columnIndex="6" />
- <result property="Province" column="Order_Province" columnIndex="7"/>
- <result property="PostalCode" column="Order_PostalCode" columnIndex="8" />
- </resultMap>
-
- <resultMap id="order-with-account-result" class="Order">
- <result property="Id" column="Order_ID"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="Account" column="Account_ID" select="GetAccountViaColumnName" />
- </resultMap>
-
- <resultMap id="order-with-sp-account-result" class="Order">
- <result property="Id" column="Order_ID"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="Account" column="Account_ID=Account_ID" select="GetAccountViaSP" />
- </resultMap>
-
- <resultMap id="order-with-collection-result" class="Order">
- <result property="Id" column="Order_ID"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="LineItemsList" column="Order_ID" select="GetLineItemsForOrder" />
- <result property="LineItems" column="Order_ID" select="GetLineItemsForOrder" lazyLoad="false" />
- </resultMap>
-
- <resultMap id="order-with-favourite-line-item" class="Order">
- <result property="Id" column="Order_ID"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem" column="Order_ID=Order_ID,LineItem_ID=Order_FavouriteLineItem" select="GetSpecificLineItem" />
- </resultMap>
-
- <resultMap id="order-with-dyn-favourite-line-item" class="Order">
- <result property="Id" column="Order_ID"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem"
- column="Order_ID=Order_ID,LineItem_ID=Order_FavouriteLineItem"
- select="GetDynSpecificLineItem" />
- </resultMap>
- <resultMap id="order-joined-favourite" class="Order">
- <result property="Id" column="Order_ID"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem" resultMapping="LineItem" />
- </resultMap>
-
- <resultMap id="order-joined-favourite2" class="Order">
- <result property="Id" column="Order_ID"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem.Id" column="LineItem_ID"/>
- <result property="FavouriteLineItem.Code" column="LineItem_Code"/>
- <result property="FavouriteLineItem.Quantity" column="LineItem_Quantity"/>
- <result property="FavouriteLineItem.Price" column="LineItem_Price"/>
- </resultMap>
-
- <resultMap id="order-joined-with-account" class="Order">
- <result property="Id" column="Order_ID"/>
- <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="Account" resultMapping="account-result-nullable-email" />
- </resultMap>
-
- <resultMap id="order-hash" class="array">
- <result property="Date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- </resultMap>
-
- <statement id="GetOrderByHashTable"
- parameterClass="Int"
- resultMap="order-hash" >
- select Order_Date from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderLiteByColumnName"
- parameterClass="Int"
- resultMap="lite-order-result-by-name" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderLiteByColumnIndex"
- parameterClass="Int"
- resultMap="lite-order-result-by-index" >
- select
- Order_ID,
- Order_Date,
- Order_CardExpiry,
- Order_CardType,
- Order_CardNumber,
- Order_Street,
- Order_City,
- Order_Province,
- Order_PostalCode
- from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderWithTypes"
- parameterClass="Int"
- resultMap="order-with-types-result" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderWithLineItems"
- parameterClass="Integer"
- resultMap="order-with-lines-result" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemsUsingStatementNamespaces"
- parameterClass="Integer"
- resultMap="order-with-lines-result-statement-namespaces" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetAllOrderWithLineItems"
- parameterClass="Integer"
- resultMap="order-with-lines-result" >
- select * from Orders
- </statement>
-
- <statement id="GetOrderCardExpiryViaResultClass"
- parameterClass="int"
- resultClass="date">
- select
- Order_Date as datetime
- from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderWithAccount"
- parameterClass="int"
- resultMap="order-with-account-result" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderWithAccountViaSP"
- parameterClass="int"
- resultMap="order-with-sp-account-result" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemsCollection"
- parameterClass="Integer"
- resultMap="order-with-collection-result" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderJoinedFavourite"
- parameterClass="Integer"
- resultMap="order-joined-favourite" >
- select * from Orders, LineItems
- where Orders.Order_ID = LineItems.Order_ID
- and Order_FavouriteLineItem = LineItems.LineItem_ID
- and Orders.Order_ID = #value#
- </statement>
-
- <statement id="GetOrderJoinedFavourite2"
- parameterClass="Integer"
- resultMap="order-joined-favourite2" >
- select * from Orders, LineItems
- where Orders.Order_ID = LineItems.Order_ID
- and Order_FavouriteLineItem = LineItems.LineItem_ID
- and Orders.Order_ID = #value#
- </statement>
-
- <statement id="GetOrderJoinedFavourite3"
- parameterClass="Integer"
- resultClass="Order" >
- select
- Orders.Order_ID as Id,
- Order_Date as Date,
- Order_CardExpiry as CardExpiry,
- Order_CardType as CardType,
- Order_CardNumber as CardNumber,
- Order_Street as Street,
- Order_City as City,
- Order_Province as Province,
- Order_PostalCode as PostalCode,
- LineItem_ID as "FavouriteLineItem.Id",
- LineItem_Code as "FavouriteLineItem.Code",
- LineItem_Quantity as "FavouriteLineItem.Quantity",
- LineItem_Price as "FavouriteLineItem.Price"
- from Orders, LineItems
- where Orders.Order_ID = LineItems.Order_ID
- and Order_FavouriteLineItem = LineItems.LineItem_ID
- and Orders.Order_ID = #value#
- </statement>
-
- <statement id="GetOrderWithFavouriteLineItem"
- parameterClass="int"
- resultMap="order-with-favourite-line-item" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemCollection"
- parameterClass="int"
- resultMap="order-with-lines-collection" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderAsHastable"
- parameterClass="Integer"
- resultMap="lite-order-map-result" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemArray"
- parameterClass="int"
- resultMap="order-with-lines-array">
- select * from Orders where Order_ID = #value#
- </statement>
-
- <statement id="GetAllCreditCardNumbersFromOrders"
- resultMap="credit-card-result" >
- select distinct Order_CardNumber from Orders
- order by Order_CardNumber
- </statement>
-
- <statement id="InsertOrderViaParameterMap"
- parameterMap="order-insert-params" >
- insert into Orders
- (Order_ID, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
- Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
- values
- (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- </statement>
-
- <statement id="InsertOrderViaExtendParameterMap"
- parameterMap="insert-extend" >
- insert into Orders
- (Order_ID, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
- Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
- values
- (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- </statement>
-
- <statement id="InsertOrderViaPublicFields">
- insert into Orders
- (Order_ID, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
- Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
- values
- (#Id#, #Account.Id#, #Date#, #CardExpiry#, #CardType#, #CardNumber#, #Street#, #City#, #Province#, #PostalCode#)
- </statement>
-
- <select id="GetOrderWithDynFavouriteLineItem"
- parameterClass="Integer"
- resultMap="order-with-dyn-favourite-line-item">
- select * from Orders where Order_ID = #value#
- </select>
-
- <select id="SelectOrderByDate"
- parameterClass="array"
- resultMap="lite-order-result-by-name">
- select * from Orders where Order_Date = #Foo#
- </select>
-
- <select id="SelectOrderByDateDynamic"
- parameterClass="array"
- resultMap="lite-order-result-by-name">
- select * from Orders
- where 1=1
- <isNotEmpty prepend="AND" property="Foo">
- (Order_Date = '$Foo$')
- </isNotEmpty>
- </select>
-
- <select id="GetAccountJIRA45"
- parameterClass="int"
- resultMap="indexed-account-result">
- select
- Account_ID,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetOrderJoinWithAccount"
- parameterClass="Integer"
- resultMap="order-joined-with-account">
- select
- Order_ID,
- Order_Date,
- Order_CardExpiry,
- Order_CardType,
- Order_CardNumber,
- Order_Street,
- Order_City,
- Order_Province,
- Order_PostalCode,
- acc.Account_ID,
- acc.Account_FirstName,
- acc.Account_LastName,
- acc.Account_Email
- from Orders as ord
- LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
- where Order_ID = #value#
- </select>
-
-
- <parameterMap id="order-insert-params">
- <parameter property="Id" dbType="Int"/> <!-- Int for SqlClient, Obdc; Integer for Oledb -->
- <parameter property="Account.Id" type="integer"/>
- <parameter property="Date" type="date" nullValue="0001-01-01 00:00:00" />
- <parameter property="CardExpiry" />
- <parameter property="CardType" />
- <parameter property="CardNumber" />
- <parameter property="Street" />
- <parameter property="City" />
- <parameter property="Province" />
- <parameter property="PostalCode" />
- </parameterMap>
-
- <parameterMap id="params-parent"> <!-- 1043181 support request -->
- <parameter property="Id" dbType="Int"/>
- <parameter property="Account.Id"/>
- <parameter property="Date" type="date" nullValue="0001-01-01 00:00:00" />
- <parameter property="CardExpiry" />
- <parameter property="CardType" />
- <parameter property="CardNumber" />
- <parameter property="Street" />
- <parameter property="City" />
- <parameter property="Province" />
- <parameter property="PostalCode" />
- </parameterMap>
-
- <parameterMap id="insert-extend" extends="params-parent">
- </parameterMap>
-
- <statement id="GetOrderWithLineItemsNoLazyLoad"
- parameterClass="Integer"
- resultMap="order-with-lines-result-no-lazy-load" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <resultMap id="order-with-lines-result-no-lazy-load" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItemsList" type="TList" column="Order_ID" select="GetLineItemsForOrder" />
- </resultMap>
-
- <statement id="GetOrderWithLineItemCollectionNoLazy"
- parameterClass="int"
- resultMap="order-with-lines-collection-no-lazy-load" >
- select * from Orders where Order_ID = #value#
- </statement>
-
- <resultMap id="order-with-lines-collection-no-lazy-load" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItems" column="Order_ID"
- select="GetLineItemsForOrderWithListClass" />
- </resultMap>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="Order" >
+
+
+ <resultMap id="credit-card-result" class="string">
+ <result property="value" column="Order_CardNumber"/>
+ </resultMap>
+
+ <resultMap id="order-with-lines-result" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-result-statement-namespaces" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" lazyLoad="true" column="Order_ID" select="LineItem.GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-collection" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItems" column="Order_ID" select="GetLineItemsForOrderWithListClass" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-array" class="Order"
+ extends="lite-order-result-by-name">
+ <result property="LineItemsArray" column="Order_ID" select="GetLineItemsForOrder"/>
+ </resultMap>
+
+ <resultMap id="lite-order-map-result" class="array">
+ <result property="Id" type="Int" column="Order_ID"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" type="string" column="Order_CardExpiry"/>
+ <result property="CardType" type="string" column="Order_CardType"/>
+ <result property="CardNumber" type="string" column="Order_CardNumber"/>
+ <result property="Street" type="string" column="Order_Street"/>
+ <result property="City" type="string" column="Order_City"/>
+ <result property="Province" type="string" column="Order_Province"/>
+ <result property="PostalCode" type="string" column="Order_PostalCode"/>
+ </resultMap>
+
+ <resultMap id="lite-order-result-by-name" class="Order">
+ <result property="Id" column="Order_ID"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ </resultMap>
+
+ <resultMap id="order-with-types-result" class="Order">
+ <result property="Id" column="Order_ID" dbType="Int"/><!-- Int for SqlClient, Obdc; Integer for Oledb -->
+ <result property="Date" type="date" column="Order_Date" dbType="DateTime "/>
+ <result property="CardExpiry" column="Order_CardExpiry" dbType="VarChar"/>
+ <result property="CardType" column="Order_CardType" dbType="VarChar"/>
+ <result property="CardNumber" column="Order_CardNumber" dbType="VarChar"/>
+ <result property="Street" column="Order_Street" dbType="VarChar"/>
+ <result property="City" column="Order_City" dbType="VarChar"/>
+ <result property="Province" column="Order_Province" dbType="VarChar"/>
+ <result property="PostalCode" column="Order_PostalCode" dbType="VarChar"/>
+ </resultMap>
+
+ <resultMap id="lite-order-result-by-index" class="Order">
+ <result property="Id" column="Order_ID" columnIndex="0"/>
+ <result property="Date" type="date" column="Order_Date" columnIndex="1" />
+ <result property="CardExpiry" column="Order_CardExpiry" columnIndex="2"/>
+ <result property="CardType" column="Order_CardType" columnIndex="3" />
+ <result property="CardNumber" column="Order_CardNumber" columnIndex="4" />
+ <result property="Street" column="Order_Street" columnIndex="5" />
+ <result property="City" column="Order_City" columnIndex="6" />
+ <result property="Province" column="Order_Province" columnIndex="7"/>
+ <result property="PostalCode" column="Order_PostalCode" columnIndex="8" />
+ </resultMap>
+
+ <resultMap id="order-with-account-result" class="Order">
+ <result property="Id" column="Order_ID"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="Account" column="Account_ID" select="GetAccountViaColumnName" />
+ </resultMap>
+
+ <resultMap id="order-with-sp-account-result" class="Order">
+ <result property="Id" column="Order_ID"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="Account" column="Account_ID=Account_ID" select="GetAccountViaSP" />
+ </resultMap>
+
+ <resultMap id="order-with-collection-result" class="Order">
+ <result property="Id" column="Order_ID"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="LineItemsList" column="Order_ID" select="GetLineItemsForOrder" />
+ <result property="LineItems" column="Order_ID" select="GetLineItemsForOrder" lazyLoad="false" />
+ </resultMap>
+
+ <resultMap id="order-with-favourite-line-item" class="Order">
+ <result property="Id" column="Order_ID"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem" column="Order_ID=Order_ID,LineItem_ID=Order_FavouriteLineItem" select="GetSpecificLineItem" />
+ </resultMap>
+
+ <resultMap id="order-with-dyn-favourite-line-item" class="Order">
+ <result property="Id" column="Order_ID"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem"
+ column="Order_ID=Order_ID,LineItem_ID=Order_FavouriteLineItem"
+ select="GetDynSpecificLineItem" />
+ </resultMap>
+ <resultMap id="order-joined-favourite" class="Order">
+ <result property="Id" column="Order_ID"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem" resultMapping="LineItem" />
+ </resultMap>
+
+ <resultMap id="order-joined-favourite2" class="Order">
+ <result property="Id" column="Order_ID"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem.Id" column="LineItem_ID"/>
+ <result property="FavouriteLineItem.Code" column="LineItem_Code"/>
+ <result property="FavouriteLineItem.Quantity" column="LineItem_Quantity"/>
+ <result property="FavouriteLineItem.Price" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="order-joined-with-account" class="Order">
+ <result property="Id" column="Order_ID"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="Account" resultMapping="account-result-nullable-email" />
+ </resultMap>
+
+ <resultMap id="order-hash" class="array">
+ <result property="Date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ </resultMap>
+
+ <statement id="GetOrderByHashTable"
+ parameterClass="Int"
+ resultMap="order-hash" >
+ select Order_Date from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderLiteByColumnName"
+ parameterClass="Int"
+ resultMap="lite-order-result-by-name" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderLiteByColumnIndex"
+ parameterClass="Int"
+ resultMap="lite-order-result-by-index" >
+ select
+ Order_ID,
+ Order_Date,
+ Order_CardExpiry,
+ Order_CardType,
+ Order_CardNumber,
+ Order_Street,
+ Order_City,
+ Order_Province,
+ Order_PostalCode
+ from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderWithTypes"
+ parameterClass="Int"
+ resultMap="order-with-types-result" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItems"
+ parameterClass="Integer"
+ resultMap="order-with-lines-result" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemsUsingStatementNamespaces"
+ parameterClass="Integer"
+ resultMap="order-with-lines-result-statement-namespaces" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetAllOrderWithLineItems"
+ parameterClass="Integer"
+ resultMap="order-with-lines-result" >
+ select * from Orders
+ </statement>
+
+ <statement id="GetOrderCardExpiryViaResultClass"
+ parameterClass="int"
+ resultClass="date">
+ select
+ Order_Date as datetime
+ from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderWithAccount"
+ parameterClass="int"
+ resultMap="order-with-account-result" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderWithAccountViaSP"
+ parameterClass="int"
+ resultMap="order-with-sp-account-result" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemsCollection"
+ parameterClass="Integer"
+ resultMap="order-with-collection-result" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite"
+ parameterClass="Integer"
+ resultMap="order-joined-favourite" >
+ select * from Orders, LineItems
+ where Orders.Order_ID = LineItems.Order_ID
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite2"
+ parameterClass="Integer"
+ resultMap="order-joined-favourite2" >
+ select * from Orders, LineItems
+ where Orders.Order_ID = LineItems.Order_ID
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite3"
+ parameterClass="Integer"
+ resultClass="Order" >
+ select
+ Orders.Order_ID as Id,
+ Order_Date as Date,
+ Order_CardExpiry as CardExpiry,
+ Order_CardType as CardType,
+ Order_CardNumber as CardNumber,
+ Order_Street as Street,
+ Order_City as City,
+ Order_Province as Province,
+ Order_PostalCode as PostalCode,
+ LineItem_ID as "FavouriteLineItem.Id",
+ LineItem_Code as "FavouriteLineItem.Code",
+ LineItem_Quantity as "FavouriteLineItem.Quantity",
+ LineItem_Price as "FavouriteLineItem.Price"
+ from Orders, LineItems
+ where Orders.Order_ID = LineItems.Order_ID
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderWithFavouriteLineItem"
+ parameterClass="int"
+ resultMap="order-with-favourite-line-item" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemCollection"
+ parameterClass="int"
+ resultMap="order-with-lines-collection" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderAsHastable"
+ parameterClass="Integer"
+ resultMap="lite-order-map-result" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemArray"
+ parameterClass="int"
+ resultMap="order-with-lines-array">
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <statement id="GetAllCreditCardNumbersFromOrders"
+ resultMap="credit-card-result" >
+ select distinct Order_CardNumber from Orders
+ order by Order_CardNumber
+ </statement>
+
+ <statement id="InsertOrderViaParameterMap"
+ parameterMap="order-insert-params" >
+ insert into Orders
+ (Order_ID, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ </statement>
+
+ <statement id="InsertOrderViaExtendParameterMap"
+ parameterMap="insert-extend" >
+ insert into Orders
+ (Order_ID, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ </statement>
+
+ <statement id="InsertOrderViaPublicFields">
+ insert into Orders
+ (Order_ID, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (#Id#, #Account.Id#, #Date#, #CardExpiry#, #CardType#, #CardNumber#, #Street#, #City#, #Province#, #PostalCode#)
+ </statement>
+
+ <select id="GetOrderWithDynFavouriteLineItem"
+ parameterClass="Integer"
+ resultMap="order-with-dyn-favourite-line-item">
+ select * from Orders where Order_ID = #value#
+ </select>
+
+ <select id="SelectOrderByDate"
+ parameterClass="array"
+ resultMap="lite-order-result-by-name">
+ select * from Orders where Order_Date = #Foo#
+ </select>
+
+ <select id="SelectOrderByDateDynamic"
+ parameterClass="array"
+ resultMap="lite-order-result-by-name">
+ select * from Orders
+ where 1=1
+ <isNotEmpty prepend="AND" property="Foo">
+ (Order_Date = '$Foo$')
+ </isNotEmpty>
+ </select>
+
+ <select id="GetAccountJIRA45"
+ parameterClass="int"
+ resultMap="indexed-account-result">
+ select
+ Account_ID,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetOrderJoinWithAccount"
+ parameterClass="Integer"
+ resultMap="order-joined-with-account">
+ select
+ Order_ID,
+ Order_Date,
+ Order_CardExpiry,
+ Order_CardType,
+ Order_CardNumber,
+ Order_Street,
+ Order_City,
+ Order_Province,
+ Order_PostalCode,
+ acc.Account_ID,
+ acc.Account_FirstName,
+ acc.Account_LastName,
+ acc.Account_Email
+ from Orders as ord
+ LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
+ where Order_ID = #value#
+ </select>
+
+
+ <parameterMap id="order-insert-params">
+ <parameter property="Id" dbType="Int"/> <!-- Int for SqlClient, Obdc; Integer for Oledb -->
+ <parameter property="Account.Id" type="integer"/>
+ <parameter property="Date" type="date" nullValue="0001-01-01 00:00:00" />
+ <parameter property="CardExpiry" />
+ <parameter property="CardType" />
+ <parameter property="CardNumber" />
+ <parameter property="Street" />
+ <parameter property="City" />
+ <parameter property="Province" />
+ <parameter property="PostalCode" />
+ </parameterMap>
+
+ <parameterMap id="params-parent"> <!-- 1043181 support request -->
+ <parameter property="Id" dbType="Int"/>
+ <parameter property="Account.Id"/>
+ <parameter property="Date" type="date" nullValue="0001-01-01 00:00:00" />
+ <parameter property="CardExpiry" />
+ <parameter property="CardType" />
+ <parameter property="CardNumber" />
+ <parameter property="Street" />
+ <parameter property="City" />
+ <parameter property="Province" />
+ <parameter property="PostalCode" />
+ </parameterMap>
+
+ <parameterMap id="insert-extend" extends="params-parent">
+ </parameterMap>
+
+ <statement id="GetOrderWithLineItemsNoLazyLoad"
+ parameterClass="Integer"
+ resultMap="order-with-lines-result-no-lazy-load" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <resultMap id="order-with-lines-result-no-lazy-load" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" type="TList" column="Order_ID" select="GetLineItemsForOrder" />
+ </resultMap>
+
+ <statement id="GetOrderWithLineItemCollectionNoLazy"
+ parameterClass="int"
+ resultMap="order-with-lines-collection-no-lazy-load" >
+ select * from Orders where Order_ID = #value#
+ </statement>
+
+ <resultMap id="order-with-lines-collection-no-lazy-load" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItems" column="Order_ID"
+ select="GetLineItemsForOrderWithListClass" />
+ </resultMap>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/mssql/Other.xml b/tests/unit/Data/SqlMap/maps/mssql/Other.xml
index fa250a5a..5d64f357 100644
--- a/tests/simple_unit/SqlMap/maps/mssql/Other.xml
+++ b/tests/unit/Data/SqlMap/maps/mssql/Other.xml
@@ -1,171 +1,171 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMap namespace="Other" >
-
- <resultMap id="other-result" class="Other" >
- <result property="Int" column="Other_Int"/>
- <result property="Long" column="Other_Long"/>
- <result property="Bool" column="Other_Bit"/>
- <result property="Bool2" column="Other_String" typeHandler="OuiNonBool"/>
- </resultMap>
-
- <resultMap id="A-result" class="A" >
- <result property="Id" column="A_ID"/>
- <result property="Libelle" column="A_Libelle"/>
- <result property="B" resultMapping="B-result"/>
- <result property="E" resultMapping="E-result"/>
- <result property="F" resultMapping="F-result"/>
- </resultMap>
-
- <resultMap id="B-result" class="B" >
- <result property="Id" column="B_ID"/>
- <result property="Libelle" column="B_Libelle"/>
- <result property="C" resultMapping="C-result"/>
- <result property="D" resultMapping="D-result"/>
- </resultMap>
-
- <resultMap id="C-result" class="C" >
- <result property="Id" column="C_ID"/>
- <result property="Libelle" column="C_Libelle"/>
- </resultMap>
-
- <resultMap id="D-result" class="D" >
- <result property="Id" column="D_ID"/>
- <result property="Libelle" column="D_Libelle"/>
- </resultMap>
-
- <resultMap id="E-result" class="E" >
- <result property="Id" column="E_ID"/>
- <result property="Libelle" column="E_Libelle"/>
- </resultMap>
-
- <resultMap id="F-result" class="F" >
- <result property="Id" column="F_ID"/>
- <result property="Libelle" column="F_Libelle"/>
- </resultMap>
-
- <select id="SelectComplexJoined" resultMap="A-result">
- SELECT
- A.Id AS A_ID,
- A.A_Libelle AS A_Libelle,
- B.ID AS B_ID,
- B.B_Libelle AS B_Libelle,
- C.ID AS C_ID,
- C.C_Libelle AS C_Libelle,
- D.ID AS D_ID,
- D.D_Libelle AS D_Libelle,
- E.ID AS E_ID,
- E.E_Libelle AS E_Libelle,
- F.ID AS F_ID,
- F.F_Libelle AS F_Libelle
- FROM A
- LEFT OUTER JOIN B ON A.B_ID = B.ID
- LEFT OUTER JOIN C ON B.C_ID = C.ID
- LEFT OUTER JOIN D ON B.D_ID = D.ID
- LEFT OUTER JOIN E ON A.E_ID = E.ID
- LEFT OUTER JOIN F ON A.F_ID = F.ID
- </select>
- <statement id="DynamicSelectByIntLong"
- parameterClass="array"
- resultMap="other-result">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- <dynamic prepend="WHERE">
- <isNotEqual prepend="AND" property="year" compareValue="0">
- Other_Int = #year#
- </isNotEqual>
-
- <isNotEqual prepend="AND" property="areaid" compareValue="0">
- Other_Long = #areaid#
- </isNotEqual>
- </dynamic>
- </statement>
-
- <statement id="DynamicSelectByBool"
- parameterClass="Other"
- resultMap="other-result">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- Where Other_Bit = #Bool#
- </statement>
-
- <statement id="InsertBool"
- parameterClass="Other">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( #Int#, #Long#, #Bool#, 'Yes')
- </statement>
-
- <statement id="InsertCustomTypeHandler"
- parameterMap="other-insert-params">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( ?, ?, ?, ?)
- </statement>
-
- <statement id="SelectByInt"
- parameterClass="int"
- resultMap="other-result">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- Where Other_Int = #value#
- </statement>
-
- <statement id="InsertInlineCustomTypeHandlerV1"
- parameterClass="Other">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( #Int#, #Long#, #Bool#, #Bool2,type=bool,dbType=Varchar#)
- </statement>
-
- <statement id="InsertInlineCustomTypeHandlerV2"
- parameterClass="Other">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( #Int#, #Long#, #Bool#, #Bool2,typeHandler=OuiNonBool#)
- </statement>
-
- <parameterMap id="other-insert-params">
- <parameter property="Int" />
- <parameter property="Long" />
- <parameter property="Bool" />
- <parameter property="Bool2" typeHandler="OuiNonBool"/>
- </parameterMap>
-
-
- <statement id="SelectByIntV1"
- parameterClass="int"
- resultMap="other-result-V1">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- Where Other_Int = #value#
- </statement>
-
-
- <resultMap id="other-result-V1" class="Other" >
- <result property="Int" column="Other_Int"/>
- <result property="Long" column="Other_Long"/>
- <result property="Bool" column="Other_Bit"/>
- <result property="Bool2" column="Other_String" />
- </resultMap>
-
-</sqlMap>
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Other" >
+
+ <resultMap id="other-result" class="Other" >
+ <result property="Int" column="Other_Int"/>
+ <result property="Long" column="Other_Long"/>
+ <result property="Bool" column="Other_Bit"/>
+ <result property="Bool2" column="Other_String" typeHandler="OuiNonBool"/>
+ </resultMap>
+
+ <resultMap id="A-result" class="A" >
+ <result property="Id" column="A_ID"/>
+ <result property="Libelle" column="A_Libelle"/>
+ <result property="B" resultMapping="B-result"/>
+ <result property="E" resultMapping="E-result"/>
+ <result property="F" resultMapping="F-result"/>
+ </resultMap>
+
+ <resultMap id="B-result" class="B" >
+ <result property="Id" column="B_ID"/>
+ <result property="Libelle" column="B_Libelle"/>
+ <result property="C" resultMapping="C-result"/>
+ <result property="D" resultMapping="D-result"/>
+ </resultMap>
+
+ <resultMap id="C-result" class="C" >
+ <result property="Id" column="C_ID"/>
+ <result property="Libelle" column="C_Libelle"/>
+ </resultMap>
+
+ <resultMap id="D-result" class="D" >
+ <result property="Id" column="D_ID"/>
+ <result property="Libelle" column="D_Libelle"/>
+ </resultMap>
+
+ <resultMap id="E-result" class="E" >
+ <result property="Id" column="E_ID"/>
+ <result property="Libelle" column="E_Libelle"/>
+ </resultMap>
+
+ <resultMap id="F-result" class="F" >
+ <result property="Id" column="F_ID"/>
+ <result property="Libelle" column="F_Libelle"/>
+ </resultMap>
+
+ <select id="SelectComplexJoined" resultMap="A-result">
+ SELECT
+ A.Id AS A_ID,
+ A.A_Libelle AS A_Libelle,
+ B.ID AS B_ID,
+ B.B_Libelle AS B_Libelle,
+ C.ID AS C_ID,
+ C.C_Libelle AS C_Libelle,
+ D.ID AS D_ID,
+ D.D_Libelle AS D_Libelle,
+ E.ID AS E_ID,
+ E.E_Libelle AS E_Libelle,
+ F.ID AS F_ID,
+ F.F_Libelle AS F_Libelle
+ FROM A
+ LEFT OUTER JOIN B ON A.B_ID = B.ID
+ LEFT OUTER JOIN C ON B.C_ID = C.ID
+ LEFT OUTER JOIN D ON B.D_ID = D.ID
+ LEFT OUTER JOIN E ON A.E_ID = E.ID
+ LEFT OUTER JOIN F ON A.F_ID = F.ID
+ </select>
+ <statement id="DynamicSelectByIntLong"
+ parameterClass="array"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ <dynamic prepend="WHERE">
+ <isNotEqual prepend="AND" property="year" compareValue="0">
+ Other_Int = #year#
+ </isNotEqual>
+
+ <isNotEqual prepend="AND" property="areaid" compareValue="0">
+ Other_Long = #areaid#
+ </isNotEqual>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicSelectByBool"
+ parameterClass="Other"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Bit = #Bool#
+ </statement>
+
+ <statement id="InsertBool"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, 'Yes')
+ </statement>
+
+ <statement id="InsertCustomTypeHandler"
+ parameterMap="other-insert-params">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( ?, ?, ?, ?)
+ </statement>
+
+ <statement id="SelectByInt"
+ parameterClass="int"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Int = #value#
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,type=bool,dbType=Varchar#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,typeHandler=OuiNonBool#)
+ </statement>
+
+ <parameterMap id="other-insert-params">
+ <parameter property="Int" />
+ <parameter property="Long" />
+ <parameter property="Bool" />
+ <parameter property="Bool2" typeHandler="OuiNonBool"/>
+ </parameterMap>
+
+
+ <statement id="SelectByIntV1"
+ parameterClass="int"
+ resultMap="other-result-V1">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Int = #value#
+ </statement>
+
+
+ <resultMap id="other-result-V1" class="Other" >
+ <result property="Int" column="Other_Int"/>
+ <result property="Long" column="Other_Long"/>
+ <result property="Bool" column="Other_Bit"/>
+ <result property="Bool2" column="Other_String" />
+ </resultMap>
+
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/mssql/ResultClass.xml b/tests/unit/Data/SqlMap/maps/mssql/ResultClass.xml
index f6ccfbce..ac705ac1 100644
--- a/tests/simple_unit/SqlMap/maps/mssql/ResultClass.xml
+++ b/tests/unit/Data/SqlMap/maps/mssql/ResultClass.xml
@@ -1,125 +1,125 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sqlMap namespace="ResultClass" >
-
- <statement id="GetBoolean"
- parameterClass="Int"
- resultClass="bool" >
- select cast(1 as bit) from Orders where Order_ID = #dummy#
- </statement>
- <statement id="GetBooleanWithoutResultClass"
- parameterClass="Int"
- extends="GetBoolean">
- </statement>
-
- <statement id="GetByte"
- parameterClass="Int"
- resultClass="int" >
- select cast(155 as tinyint) from Orders where Order_ID = #value#
- </statement>
- <statement id="GetByteWithoutResultClass"
- parameterClass="Int"
- extends="GetByte">
- </statement>
-
- <statement id="GetChar"
- parameterClass="Int"
- resultClass="string" >
- select cast('a' as char) from Orders where Order_ID = #value#
- </statement>
- <!-- SQL Server provider doesn't know char type, the resultClass type must be specified -->
- <statement id="GetCharWithoutResultClass"
- parameterClass="Int" resultClass="string"
- extends="GetChar">
- </statement>
-
- <statement id="GetDate"
- parameterClass="Int"
- resultClass="date" >
- select cast('2003-02-15 8:15:00' as datetime) as datetime from Orders where Order_ID = #value#
- </statement>
- <statement id="GetDateWithoutResultClass"
- parameterClass="Int"
- extends="GetDate">
- </statement>
-
- <statement id="GetDecimal"
- parameterClass="Int"
- resultClass="decimal" >
- select cast(1.56 as decimal(9,2)) from Orders where Order_ID = #value#
- </statement>
- <statement id="GetDecimalWithoutResultClass"
- parameterClass="Int"
- extends="GetDecimal">
- </statement>
-
- <statement id="GetDouble"
- parameterClass="Int"
- resultClass="double" >
- select cast(99.5 as float) from Orders where Order_ID= #value#
- </statement>
- <statement id="GetDoubleWithoutResultClass"
- parameterClass="Int"
- extends="GetDouble">
- </statement>
-
- <statement id="GetGuid"
- parameterClass="Int"
- resultClass="guid" >
- select cast('CD5ABF17-4BBC-4C86-92F1-257735414CF4' as UniqueIdentifier) from Orders where Order_ID = #value#
- </statement>
- <statement id="GetGuidWithoutResultClass" parameterClass="Int" extends="GetGuid">
- </statement>
-
- <statement id="GetInt16"
- parameterClass="Int"
- resultClass="integer" >
- select cast(32111 as SmallInt) from Orders where Order_ID = #value#
- </statement>
- <statement id="GetInt16WithoutResultClass"
- parameterClass="Int"
- extends="GetInt16">
- </statement>
-
- <statement id="GetInt32"
- parameterClass="Int"
- resultClass="int" >
- select cast(999999 as int) from Orders where Order_ID = #value#
- </statement>
- <statement id="GetInt32WithoutResultClass"
- parameterClass="Int"
- extends="GetInt32">
- </statement>
-
- <statement id="GetInt64"
- parameterClass="Int"
- resultClass="float" >
- select cast(9223372036854775800 as bigint) from Orders where Order_ID = #value#
- </statement>
- <statement id="GetInt64WithoutResultClass"
- parameterClass="Int"
- extends="GetInt64">
- </statement>
-
- <statement id="GetSingle"
- parameterClass="Int"
- resultClass="float" >
- select cast(92233.5 as real) from Orders where Order_ID = #value#
- </statement>
- <statement id="GetSingleWithoutResultClass"
- parameterClass="Int"
- extends="GetSingle">
- </statement>
-
- <statement id="GetString"
- parameterClass="Int"
- resultClass="string" >
- select 'VISA'
- from Orders where Order_ID = #value#
- </statement>
- <statement id="GetStringWithoutResultClass"
- parameterClass="Int"
- extends="GetString">
- </statement>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="ResultClass" >
+
+ <statement id="GetBoolean"
+ parameterClass="Int"
+ resultClass="bool" >
+ select cast(1 as bit) from Orders where Order_ID = #dummy#
+ </statement>
+ <statement id="GetBooleanWithoutResultClass"
+ parameterClass="Int"
+ extends="GetBoolean">
+ </statement>
+
+ <statement id="GetByte"
+ parameterClass="Int"
+ resultClass="int" >
+ select cast(155 as tinyint) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetByteWithoutResultClass"
+ parameterClass="Int"
+ extends="GetByte">
+ </statement>
+
+ <statement id="GetChar"
+ parameterClass="Int"
+ resultClass="string" >
+ select cast('a' as char) from Orders where Order_ID = #value#
+ </statement>
+ <!-- SQL Server provider doesn't know char type, the resultClass type must be specified -->
+ <statement id="GetCharWithoutResultClass"
+ parameterClass="Int" resultClass="string"
+ extends="GetChar">
+ </statement>
+
+ <statement id="GetDate"
+ parameterClass="Int"
+ resultClass="date" >
+ select cast('2003-02-15 8:15:00' as datetime) as datetime from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetDateWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDate">
+ </statement>
+
+ <statement id="GetDecimal"
+ parameterClass="Int"
+ resultClass="decimal" >
+ select cast(1.56 as decimal(9,2)) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetDecimalWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDecimal">
+ </statement>
+
+ <statement id="GetDouble"
+ parameterClass="Int"
+ resultClass="double" >
+ select cast(99.5 as float) from Orders where Order_ID= #value#
+ </statement>
+ <statement id="GetDoubleWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDouble">
+ </statement>
+
+ <statement id="GetGuid"
+ parameterClass="Int"
+ resultClass="guid" >
+ select cast('CD5ABF17-4BBC-4C86-92F1-257735414CF4' as UniqueIdentifier) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetGuidWithoutResultClass" parameterClass="Int" extends="GetGuid">
+ </statement>
+
+ <statement id="GetInt16"
+ parameterClass="Int"
+ resultClass="integer" >
+ select cast(32111 as SmallInt) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt16WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt16">
+ </statement>
+
+ <statement id="GetInt32"
+ parameterClass="Int"
+ resultClass="int" >
+ select cast(999999 as int) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt32WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt32">
+ </statement>
+
+ <statement id="GetInt64"
+ parameterClass="Int"
+ resultClass="float" >
+ select cast(9223372036854775800 as bigint) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt64WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt64">
+ </statement>
+
+ <statement id="GetSingle"
+ parameterClass="Int"
+ resultClass="float" >
+ select cast(92233.5 as real) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetSingleWithoutResultClass"
+ parameterClass="Int"
+ extends="GetSingle">
+ </statement>
+
+ <statement id="GetString"
+ parameterClass="Int"
+ resultClass="string" >
+ select 'VISA'
+ from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetStringWithoutResultClass"
+ parameterClass="Int"
+ extends="GetString">
+ </statement>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/Account.xml b/tests/unit/Data/SqlMap/maps/sqlite/Account.xml
index b9f4bda9..aa175459 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/Account.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/Account.xml
@@ -1,641 +1,641 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<sqlMap namespace="Account" >
-
- <!-- =============================================
- <resultMap
- name="name"
- class="name"
- extend="resultMapId"
- >
- <result
- property="name"
- column="name"
- columnIndex="name"
- nullValue="value"
- select="name"
- resultMap="name"
- lazyLoad="true/false"
- dbType=""
- />
- <procedure
- name="name"
- parameterMap="name"
- >
- <statement
- name="name"
- parameterClass="name"
- parameterMap="name"
- resultClass="name"
- resultMap="name"
- listClass="name"
- >
- <parameterMap
- name="name"
- class=""
- >
- <parameter
- property="name"
- dbType=""
- output="true/false"
- type=""
- nullValue=""
- extend="parameterMapId"
- />
-
- ============================================= -->
-
- <cacheModel id="account-cache" implementation="LRU" >
- <flushInterval hours="24"/>
- <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
- <flushOnExecute statement="UpdateAccountViaParameterMap"/>
- <property name="size" value="10"/>
- </cacheModel>
-
- <!--
- <cacheModel name="account-cache" implementation="LRU" >
- <flushInterval hours="24"/>
- <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
- <flushOnExecute statement="UpdateAccountViaParameterMap"/>
- <property name="CacheSize" value="50"/>
- </cacheModel>
- -->
-
-
- <alias>
- <typeAlias alias="HundredsBool" type="IBatisNet.DataMapper.Test.Domain.HundredsTypeHandlerCallback, IBatisNet.DataMapper.Test"/>
- </alias>
-
- <resultMap id="account-result" class="Account" >
- <result property="Id" column="Account_Id"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email" nullValue="no_email@provided.com"/>
- <result property="BannerOptions" column="Account_Banner_Option" typeHandler="OuiNonBool"/>
- <result property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
- </resultMap>
- <resultMap id="indexed-account-result" class="Account">
- <result property="Id" column="Account_Id" columnIndex="0"/>
- <result property="FirstName" column="Account_FirstName" columnIndex="1"/>
- <result property="LastName" column="Account_LastName" columnIndex="2"/>
- <result property="EmailAddress" column="Account_Email" columnIndex="3" nullValue="no_email@provided.com"/>
- </resultMap>
- <resultMap id="account-result-nullable-email" class="Account">
- <result property="Id" column="Account_Id"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email"/>
- </resultMap>
-
- <resultMap id="email-result" class="string">
- <result property="value" column="Account_Email"/>
- </resultMap>
-
- <resultMap id="account-hashtable-result" class="array">
- <result property="Id" column="Account_Id"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email"/>
- </resultMap>
-
-
- <!-- =============================================
- MAPPED STATEMENTS - w/Inline Parameters
- =============================================
- -->
-
- <select id="GetAllAccountsAsArrayListViaResultClass"
- resultClass="TList">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetAccountsDynamic" resultMap="account-result" parameterClass="Hashtable" >
- select * from Accounts
- <dynamic prepend="where">
- <isParameterPresent>
- <isNotEmpty prepend="and" property="FirstName" >
- Account_FirstName LIKE '%$FirstName$%'
- </isNotEmpty>
- <isNotEmpty prepend="and" property="LastName" >
- Account_LastName LIKE '%$LastName$%'
- </isNotEmpty>
- <isNotEmpty prepend="and" property="EmailAddress" >
- Account_Email LIKE '%$EmailAddress$%'
- </isNotEmpty>
- </isParameterPresent>
- </dynamic>
- order by Account_LastName
- limit 0, $MaximumAllowed$
- </select>
-
- <select id="SelectWithProperty"
- resultMap="account-result">
- select *
- from Accounts
- where Account_FirstName = ${accountName}
- </select>
-
- <select id="GetCachedAccountsViaResultMap"
- resultMap="account-result"
- cacheModel="account-cache" >
- select *
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetNoAccountWithCache"
- parameterClass="Integer"
- resultMap="account-hashtable-result"
- cacheModel="account-cache">
- select *
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAccountAsHashtable"
- parameterClass="Integer"
- resultMap="account-hashtable-result">
- select *
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAllAccountsAsHashMapViaResultMap"
- resultMap="account-hashtable-result">
- select *
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetAccountAsHashtableResultClass"
- parameterClass="int"
- resultClass="array">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAllAccountsAsHashtableViaResultClass"
- resultClass="array">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetAccountViaColumnName"
- parameterClass="int"
- resultMap="account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email,
- Account_Banner_Option,
- Account_Cart_Option
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAccountViaColumnIndex"
- parameterClass="int"
- resultMap="indexed-account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAllAccountsViaResultMap"
- resultMap="account-result">
- select * from Accounts
- order by Account_Id
- </select>
-
- <select id="GetAllAccountsViaResultClass"
- resultClass="Account">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetFewAccountsViaResultMap"
- resultMap="account-result">
- <![CDATA[
- select * from Accounts
- where Account_Id < 2
- order by Account_Id
- ]]>
- </select>
-
- <select id="GetNoAccountsViaResultMap"
- resultMap="account-result">
- select * from Accounts
- where Account_Id > 1000
- order by Account_Id
- </select>
-
-
- <select id="GetAccountNullableEmail"
- resultMap="account-result-nullable-email">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAccountViaResultClass"
- resultClass="Account">
- <![CDATA[
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where Account_Id = #value#
- ]]>
- </select>
-
- <select id="GetAccountViaInlineParameters"
- resultMap="indexed-account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_Id = #Id# and Account_Id = #Id#
- </select>
-
- <select id="GetEmailAddressViaResultClass" resultClass="string">
- select Account_Email as value
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetEmailAddressViaResultMap"
- parameterClass="int"
- resultMap="email-result">
- select Account_Email
- from Accounts
- where Account_Id = #value#
- </select>
-
- <select id="GetAllEmailAddressesViaResultClass"
- resultClass="string">
- select Account_Email
- from Accounts
- order by Account_Id
- </select>
-
- <select id="GetAllEmailAddressesViaResultMap"
- resultMap="email-result">
- select Account_Email
- from Accounts
- order by Account_Id
- </select>
-
- <insert id="InsertAccountViaParameterMap"
- parameterMap="account-insert-params">
- insert into Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option)
- values
- (?, ?, ?, ?, ?, ?)
- </insert>
-
- <update id="UpdateAccountViaParameterMap"
- parameterMap="update-params">
- update Accounts set
- Account_FirstName = ?,
- Account_LastName = ?,
- Account_Email = ?
- where
- Account_Id = ?
- </update>
-
- <update id="UpdateAccountViaParameterMap2"
- parameterMap="update-params2">
- update Accounts set
- Account_Id = ?,
- Account_FirstName = ?,
- Account_LastName = ?,
- Account_Email = ?
- where
- Account_Id = ?
- </update>
-
- <delete id="DeleteAccountViaInlineParameters">
- delete from Accounts
- where
- Account_Id = #Id#
- </delete>
-
- <select id="GetAccountComplexMapping"
- resultMap="indexed-account-result"
- parameterClass="array">
- select *
- from Accounts
- where
- Account_FirstName = #Account.FirstName#
- And Account_LastName = #Order.City#
- </select>
-
- <select id="GetDynamicOrderedEmailAddressesViaResultMap"
- resultMap="email-result">
- select Account_Email
- from Accounts
- order by $value$
- </select>
-
- <!-- Dynamic statements -->
- <select id="GetAllAccountsViaResultMapWithDynamicElement"
- resultMap="account-result">
- select * from Accounts
- where Account_Email $value$ '%@%'
- order by Account_Id
- </select>
-
- <select id="SimpleDynamicSubstitution"
- parameterClass="Hashtable"
- resultClass="Account">
- $statement$
- </select>
-
- <!-- Public Fields -->
- <insert id="InsertAccountViaPublicFields">
- insert into Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email)
- values
- (#Id#, #FirstName#, #LastName#, #EmailAddress#
- )
- </insert>
-
-
- <!-- Inline Parameters -->
- <update id="UpdateAccountViaInlineParameters"
- parameterClass="Account">
- update Accounts set
- Account_FirstName = #FirstName#,
- Account_LastName = #LastName#,
- Account_Email = #EmailAddress, dbType=VarChar, nullValue=no_email@provided.com#
- where
- Account_Id = #Id#
- </update>
-
- <insert id="InsertAccountViaInlineParameters"
- parameterClass="Account" >
- insert into Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email)
- values
- (#Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar, nullValue=no_email@provided.com#
- )
- </insert>
-
- <insert id="InsertAccountNullableEmail"
- parameterClass="Account" >
- insert into Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email)
- values
- ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
- </insert>
-
- <insert id="InsertAccountUknownParameterClass">
- insert into Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email)
- values
- ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
- </insert>
-
- <delete id="DeleteAccount"
- parameterClass="Account">
- delete from Accounts
- where Account_Id = #Id#
- and Account_Id = #Id#
- </delete>
-
- <!-- Extends statement -->
- <select id="GetAllAccounts"
- resultMap="indexed-account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- </select>
-
- <select id="GetAllAccountsOrderByName"
- extends="GetAllAccounts"
- resultMap="indexed-account-result">
- order by Account_FirstName
- </select>
-
- <select id="GetOneAccount"
- extends="GetAllAccounts"
- resultMap="indexed-account-result">
- where Account_Id = #value#
- </select>
-
- <select id="GetSomeAccount"
- extends="GetAllAccounts"
- parameterClass="Hashtable"
- resultMap="indexed-account-result">
- where Account_Id between #lowID# and #hightID#
- </select>
-
- <select id="SelectAccountJIRA29" parameterClass="map" resultClass="Account">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where Account_FirstName = '##$AccountName$##'
- </select>
-
- <select id="SelectAccountJIRA29-2"
- parameterClass="Hashtable"
- resultClass="Account">
- select
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- where 1=1
- <isNotEmpty prepend="AND" property="Foo">
- (Account_FirstName = '##$Foo$##')
- </isNotEmpty>
- </select>
-
- <select id="GetAccountWithRepeatingProperty"
- parameterClass="Account"
- resultMap="indexed-account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_Id = #Id# and
- Account_Id = #Id# and
- Account_FirstName = #FirstName# and
- Account_LastName = #LastName# and
- Account_Id = #Id#
- </select>
-
- <select id="GetAllAccountsViaCustomTypeHandler"
- resultMap="account-result">
- select * from Accounts
- order by Account_Id
- </select>
-
- <!-- JIRA-110 -->
- <select id="GetManyAccound" resultClass="Account">
- SELECT
- Account_Id as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- FROM Accounts
- </select>
-
- <select id="Get1Account" extends="GetManyAccound" resultClass="Account">WHERE Account_Id=1</select>
-
- <statement id="GetAccounts" resultMap="account-result">
- SELECT *
- FROM
- Accounts
- </statement>
- <!-- JIRA-110 -->
-
- <insert id="InsertAccountDynamic" parameterClass="Account">
- INSERT INTO Accounts
- (Account_Id, Account_FirstName, Account_LastName, Account_Email)
- VALUES(#Id#, #FirstName#, #LastName#
- <dynamic prepend=",">
- <isNotNull prepend="," property="EmailAddress">
- #EmailAddress#
- </isNotNull>
- <isNull prepend="," property="EmailAddress">
- null
- </isNull>
- </dynamic>
- )
- </insert>
-
-
- <!-- accounts and orders -->
-
- <select id="getAccountWithOrders" resultMap="Account-with-Orders">
- SELECT
- Accounts.Account_Id as Account_Id,
- Accounts.Account_FirstName as Account_FirstName,
- Accounts.Account_LastName as Account_LastName,
- Accounts.Account_Email as Account_Email,
- Accounts.Account_Banner_Option as Account_Banner_Option,
- Accounts.Account_Cart_Option as Account_Cart_Option,
- Orders.Order_Id as Order_Id,
- Orders.Order_Date as Order_Date,
- Orders.Order_CardType as Order_CardType,
- Orders.Order_CardNumber as Order_CardNumber,
- Orders.Order_CardExpiry as Order_CardExpiry,
- Orders.Order_Street as Order_Street,
- Orders.Order_City as Order_City,
- Orders.Order_Province as Order_Province,
- Orders.Order_PostalCode as Order_PostalCode,
- Orders.Order_FavouriteLineItem as Order_FavouriteLineItem
- FROM accounts
- LEFT JOIN orders ON
- accounts.account_id = orders.account_id
- </select>
-
- <resultMap id="Account-with-Orders" class="AccountWithOrders" groupBy="Account_Id">
- <result property="Id" column="Account_Id"/>
- <result property="FirstName" column="Account_FirstName"/>
- <result property="LastName" column="Account_LastName"/>
- <result property="EmailAddress" column="Account_Email" />
- <result property="Orders" resultMapping="account-orders" />
- </resultMap>
-
- <resultMap id="account-orders" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- </resultMap>
-
-
- <!-- For procedure, the parameters of the parameterMap must in the same order
- as for the procedure paramaters-->
- <procedure id="InsertAccountViaStoreProcedure" parameterMap="account-insert-params">
- ps_InsertAccount
- </procedure>
-
- <procedure id="SwapEmailAddresses" parameterMap="swap-params">
- ps_swap_email_address
- </procedure>
-
- <!-- =============================================
- OPTIONAL EXPLICIT PARAMETER MAP
- ============================================= -->
-
- <parameterMap id="swap-params">
- <parameter property="email1" column="First_Email" />
- <parameter property="email2" column="Second_Email" />
- </parameterMap>
-
- <parameterMap id="account-insert-params">
- <parameter property="Id" />
- <parameter property="FirstName" />
- <parameter property="LastName" />
- <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
- <parameter property="BannerOptions" dbType="Varchar" type="bool"/>
- <parameter property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
- </parameterMap>
-
- <parameterMap id="update-params">
- <parameter property="FirstName" />
- <parameter property="LastName" />
- <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
- <parameter property="Id" />
- </parameterMap>
-
- <parameterMap id="update-params2">
- <parameter property="Id" />
- <parameter property="FirstName" />
- <parameter property="LastName" />
- <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
- <parameter property="Id" />
- </parameterMap>
-
-
+<?xml version="1.0" encoding="UTF-8" ?>
+<sqlMap namespace="Account" >
+
+ <!-- =============================================
+ <resultMap
+ name="name"
+ class="name"
+ extend="resultMapId"
+ >
+ <result
+ property="name"
+ column="name"
+ columnIndex="name"
+ nullValue="value"
+ select="name"
+ resultMap="name"
+ lazyLoad="true/false"
+ dbType=""
+ />
+ <procedure
+ name="name"
+ parameterMap="name"
+ >
+ <statement
+ name="name"
+ parameterClass="name"
+ parameterMap="name"
+ resultClass="name"
+ resultMap="name"
+ listClass="name"
+ >
+ <parameterMap
+ name="name"
+ class=""
+ >
+ <parameter
+ property="name"
+ dbType=""
+ output="true/false"
+ type=""
+ nullValue=""
+ extend="parameterMapId"
+ />
+
+ ============================================= -->
+
+ <cacheModel id="account-cache" implementation="LRU" >
+ <flushInterval hours="24"/>
+ <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
+ <flushOnExecute statement="UpdateAccountViaParameterMap"/>
+ <property name="size" value="10"/>
+ </cacheModel>
+
+ <!--
+ <cacheModel name="account-cache" implementation="LRU" >
+ <flushInterval hours="24"/>
+ <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
+ <flushOnExecute statement="UpdateAccountViaParameterMap"/>
+ <property name="CacheSize" value="50"/>
+ </cacheModel>
+ -->
+
+
+ <alias>
+ <typeAlias alias="HundredsBool" type="IBatisNet.DataMapper.Test.Domain.HundredsTypeHandlerCallback, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+ <resultMap id="account-result" class="Account" >
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email" nullValue="no_email@provided.com"/>
+ <result property="BannerOptions" column="Account_Banner_Option" typeHandler="OuiNonBool"/>
+ <result property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
+ </resultMap>
+ <resultMap id="indexed-account-result" class="Account">
+ <result property="Id" column="Account_Id" columnIndex="0"/>
+ <result property="FirstName" column="Account_FirstName" columnIndex="1"/>
+ <result property="LastName" column="Account_LastName" columnIndex="2"/>
+ <result property="EmailAddress" column="Account_Email" columnIndex="3" nullValue="no_email@provided.com"/>
+ </resultMap>
+ <resultMap id="account-result-nullable-email" class="Account">
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email"/>
+ </resultMap>
+
+ <resultMap id="email-result" class="string">
+ <result property="value" column="Account_Email"/>
+ </resultMap>
+
+ <resultMap id="account-hashtable-result" class="array">
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email"/>
+ </resultMap>
+
+
+ <!-- =============================================
+ MAPPED STATEMENTS - w/Inline Parameters
+ =============================================
+ -->
+
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="TList">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAccountsDynamic" resultMap="account-result" parameterClass="Hashtable" >
+ select * from Accounts
+ <dynamic prepend="where">
+ <isParameterPresent>
+ <isNotEmpty prepend="and" property="FirstName" >
+ Account_FirstName LIKE '%$FirstName$%'
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName LIKE '%$LastName$%'
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="EmailAddress" >
+ Account_Email LIKE '%$EmailAddress$%'
+ </isNotEmpty>
+ </isParameterPresent>
+ </dynamic>
+ order by Account_LastName
+ limit 0, $MaximumAllowed$
+ </select>
+
+ <select id="SelectWithProperty"
+ resultMap="account-result">
+ select *
+ from Accounts
+ where Account_FirstName = ${accountName}
+ </select>
+
+ <select id="GetCachedAccountsViaResultMap"
+ resultMap="account-result"
+ cacheModel="account-cache" >
+ select *
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetNoAccountWithCache"
+ parameterClass="Integer"
+ resultMap="account-hashtable-result"
+ cacheModel="account-cache">
+ select *
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAccountAsHashtable"
+ parameterClass="Integer"
+ resultMap="account-hashtable-result">
+ select *
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllAccountsAsHashMapViaResultMap"
+ resultMap="account-hashtable-result">
+ select *
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAccountAsHashtableResultClass"
+ parameterClass="int"
+ resultClass="array">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllAccountsAsHashtableViaResultClass"
+ resultClass="array">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAccountViaColumnName"
+ parameterClass="int"
+ resultMap="account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email,
+ Account_Banner_Option,
+ Account_Cart_Option
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAccountViaColumnIndex"
+ parameterClass="int"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllAccountsViaResultMap"
+ resultMap="account-result">
+ select * from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAllAccountsViaResultClass"
+ resultClass="Account">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetFewAccountsViaResultMap"
+ resultMap="account-result">
+ <![CDATA[
+ select * from Accounts
+ where Account_Id < 2
+ order by Account_Id
+ ]]>
+ </select>
+
+ <select id="GetNoAccountsViaResultMap"
+ resultMap="account-result">
+ select * from Accounts
+ where Account_Id > 1000
+ order by Account_Id
+ </select>
+
+
+ <select id="GetAccountNullableEmail"
+ resultMap="account-result-nullable-email">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAccountViaResultClass"
+ resultClass="Account">
+ <![CDATA[
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_Id = #value#
+ ]]>
+ </select>
+
+ <select id="GetAccountViaInlineParameters"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #Id# and Account_Id = #Id#
+ </select>
+
+ <select id="GetEmailAddressViaResultClass" resultClass="string">
+ select Account_Email as value
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetEmailAddressViaResultMap"
+ parameterClass="int"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetAllEmailAddressesViaResultClass"
+ resultClass="string">
+ select Account_Email
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <select id="GetAllEmailAddressesViaResultMap"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ order by Account_Id
+ </select>
+
+ <insert id="InsertAccountViaParameterMap"
+ parameterMap="account-insert-params">
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option)
+ values
+ (?, ?, ?, ?, ?, ?)
+ </insert>
+
+ <update id="UpdateAccountViaParameterMap"
+ parameterMap="update-params">
+ update Accounts set
+ Account_FirstName = ?,
+ Account_LastName = ?,
+ Account_Email = ?
+ where
+ Account_Id = ?
+ </update>
+
+ <update id="UpdateAccountViaParameterMap2"
+ parameterMap="update-params2">
+ update Accounts set
+ Account_Id = ?,
+ Account_FirstName = ?,
+ Account_LastName = ?,
+ Account_Email = ?
+ where
+ Account_Id = ?
+ </update>
+
+ <delete id="DeleteAccountViaInlineParameters">
+ delete from Accounts
+ where
+ Account_Id = #Id#
+ </delete>
+
+ <select id="GetAccountComplexMapping"
+ resultMap="indexed-account-result"
+ parameterClass="array">
+ select *
+ from Accounts
+ where
+ Account_FirstName = #Account.FirstName#
+ And Account_LastName = #Order.City#
+ </select>
+
+ <select id="GetDynamicOrderedEmailAddressesViaResultMap"
+ resultMap="email-result">
+ select Account_Email
+ from Accounts
+ order by $value$
+ </select>
+
+ <!-- Dynamic statements -->
+ <select id="GetAllAccountsViaResultMapWithDynamicElement"
+ resultMap="account-result">
+ select * from Accounts
+ where Account_Email $value$ '%@%'
+ order by Account_Id
+ </select>
+
+ <select id="SimpleDynamicSubstitution"
+ parameterClass="Hashtable"
+ resultClass="Account">
+ $statement$
+ </select>
+
+ <!-- Public Fields -->
+ <insert id="InsertAccountViaPublicFields">
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#Id#, #FirstName#, #LastName#, #EmailAddress#
+ )
+ </insert>
+
+
+ <!-- Inline Parameters -->
+ <update id="UpdateAccountViaInlineParameters"
+ parameterClass="Account">
+ update Accounts set
+ Account_FirstName = #FirstName#,
+ Account_LastName = #LastName#,
+ Account_Email = #EmailAddress, dbType=VarChar, nullValue=no_email@provided.com#
+ where
+ Account_Id = #Id#
+ </update>
+
+ <insert id="InsertAccountViaInlineParameters"
+ parameterClass="Account" >
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar, nullValue=no_email@provided.com#
+ )
+ </insert>
+
+ <insert id="InsertAccountNullableEmail"
+ parameterClass="Account" >
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
+ </insert>
+
+ <insert id="InsertAccountUknownParameterClass">
+ insert into Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ values
+ ( #Id#, #FirstName#, #LastName#, #EmailAddress, dbType=VarChar# )
+ </insert>
+
+ <delete id="DeleteAccount"
+ parameterClass="Account">
+ delete from Accounts
+ where Account_Id = #Id#
+ and Account_Id = #Id#
+ </delete>
+
+ <!-- Extends statement -->
+ <select id="GetAllAccounts"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ </select>
+
+ <select id="GetAllAccountsOrderByName"
+ extends="GetAllAccounts"
+ resultMap="indexed-account-result">
+ order by Account_FirstName
+ </select>
+
+ <select id="GetOneAccount"
+ extends="GetAllAccounts"
+ resultMap="indexed-account-result">
+ where Account_Id = #value#
+ </select>
+
+ <select id="GetSomeAccount"
+ extends="GetAllAccounts"
+ parameterClass="Hashtable"
+ resultMap="indexed-account-result">
+ where Account_Id between #lowID# and #hightID#
+ </select>
+
+ <select id="SelectAccountJIRA29" parameterClass="map" resultClass="Account">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where Account_FirstName = '##$AccountName$##'
+ </select>
+
+ <select id="SelectAccountJIRA29-2"
+ parameterClass="Hashtable"
+ resultClass="Account">
+ select
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ where 1=1
+ <isNotEmpty prepend="AND" property="Foo">
+ (Account_FirstName = '##$Foo$##')
+ </isNotEmpty>
+ </select>
+
+ <select id="GetAccountWithRepeatingProperty"
+ parameterClass="Account"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_Id = #Id# and
+ Account_Id = #Id# and
+ Account_FirstName = #FirstName# and
+ Account_LastName = #LastName# and
+ Account_Id = #Id#
+ </select>
+
+ <select id="GetAllAccountsViaCustomTypeHandler"
+ resultMap="account-result">
+ select * from Accounts
+ order by Account_Id
+ </select>
+
+ <!-- JIRA-110 -->
+ <select id="GetManyAccound" resultClass="Account">
+ SELECT
+ Account_Id as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ FROM Accounts
+ </select>
+
+ <select id="Get1Account" extends="GetManyAccound" resultClass="Account">WHERE Account_Id=1</select>
+
+ <statement id="GetAccounts" resultMap="account-result">
+ SELECT *
+ FROM
+ Accounts
+ </statement>
+ <!-- JIRA-110 -->
+
+ <insert id="InsertAccountDynamic" parameterClass="Account">
+ INSERT INTO Accounts
+ (Account_Id, Account_FirstName, Account_LastName, Account_Email)
+ VALUES(#Id#, #FirstName#, #LastName#
+ <dynamic prepend=",">
+ <isNotNull prepend="," property="EmailAddress">
+ #EmailAddress#
+ </isNotNull>
+ <isNull prepend="," property="EmailAddress">
+ null
+ </isNull>
+ </dynamic>
+ )
+ </insert>
+
+
+ <!-- accounts and orders -->
+
+ <select id="getAccountWithOrders" resultMap="Account-with-Orders">
+ SELECT
+ Accounts.Account_Id as Account_Id,
+ Accounts.Account_FirstName as Account_FirstName,
+ Accounts.Account_LastName as Account_LastName,
+ Accounts.Account_Email as Account_Email,
+ Accounts.Account_Banner_Option as Account_Banner_Option,
+ Accounts.Account_Cart_Option as Account_Cart_Option,
+ Orders.Order_Id as Order_Id,
+ Orders.Order_Date as Order_Date,
+ Orders.Order_CardType as Order_CardType,
+ Orders.Order_CardNumber as Order_CardNumber,
+ Orders.Order_CardExpiry as Order_CardExpiry,
+ Orders.Order_Street as Order_Street,
+ Orders.Order_City as Order_City,
+ Orders.Order_Province as Order_Province,
+ Orders.Order_PostalCode as Order_PostalCode,
+ Orders.Order_FavouriteLineItem as Order_FavouriteLineItem
+ FROM accounts
+ LEFT JOIN orders ON
+ accounts.account_id = orders.account_id
+ </select>
+
+ <resultMap id="Account-with-Orders" class="AccountWithOrders" groupBy="Account_Id">
+ <result property="Id" column="Account_Id"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email" />
+ <result property="Orders" resultMapping="account-orders" />
+ </resultMap>
+
+ <resultMap id="account-orders" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ </resultMap>
+
+
+ <!-- For procedure, the parameters of the parameterMap must in the same order
+ as for the procedure paramaters-->
+ <procedure id="InsertAccountViaStoreProcedure" parameterMap="account-insert-params">
+ ps_InsertAccount
+ </procedure>
+
+ <procedure id="SwapEmailAddresses" parameterMap="swap-params">
+ ps_swap_email_address
+ </procedure>
+
+ <!-- =============================================
+ OPTIONAL EXPLICIT PARAMETER MAP
+ ============================================= -->
+
+ <parameterMap id="swap-params">
+ <parameter property="email1" column="First_Email" />
+ <parameter property="email2" column="Second_Email" />
+ </parameterMap>
+
+ <parameterMap id="account-insert-params">
+ <parameter property="Id" />
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="BannerOptions" dbType="Varchar" type="bool"/>
+ <parameter property="CartOptions" column="Account_Cart_Option" typeHandler="HundredsBool"/>
+ </parameterMap>
+
+ <parameterMap id="update-params">
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="Id" />
+ </parameterMap>
+
+ <parameterMap id="update-params2">
+ <parameter property="Id" />
+ <parameter property="FirstName" />
+ <parameter property="LastName" />
+ <parameter property="EmailAddress" nullValue="no_email@provided.com"/>
+ <parameter property="Id" />
+ </parameterMap>
+
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/ActiveRecord.xml b/tests/unit/Data/SqlMap/maps/sqlite/ActiveRecord.xml
index 3e9ee3cf..1c48010f 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/ActiveRecord.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/ActiveRecord.xml
@@ -1,16 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<sqlMap>
-
- <select id="GetActiveRecordAccounts" resultClass="ActiveAccount">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email,
- Account_Banner_Option,
- Account_Cart_Option
- from Accounts
- order by Account_Id
- </select>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<sqlMap>
+
+ <select id="GetActiveRecordAccounts" resultClass="ActiveAccount">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email,
+ Account_Banner_Option,
+ Account_Cart_Option
+ from Accounts
+ order by Account_Id
+ </select>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/Category.xml b/tests/unit/Data/SqlMap/maps/sqlite/Category.xml
index ec81449b..05c51fb5 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/Category.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/Category.xml
@@ -1,162 +1,162 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMap namespace="Category" >
-
- <alias>
- <typeAlias alias="Category" type="IBatisNet.DataMapper.Test.Domain.Category, IBatisNet.DataMapper.Test"/>
- </alias>
-
-
- <select id="GetCategory" parameterClass="Integer" resultClass="Category">
- select
- Category_ID as Id,
- Category_Name as Name,
- Category_Guid as GuidString
- from Categories
- where Category_ID = #value#
- </select>
-
- <select id="GetCategoryGuid" parameterClass="Integer" resultClass="guid">
- select
- Category_Guid as value
- from Categories
- where Category_ID = #value#
- </select>
-
- <!-- Test for statement as insert -->
- <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
- <insert id="InsertCategory" parameterClass="Category">
- <selectKey property="Id" type="post" resultClass="int">
- select LAST_INSERT_ID() as value
- </selectKey>
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (#Name#, #GuidString:Varchar#);
- </insert>
-
- <!-- -->
- <insert id="InsertCategoryViaInsertStatement" parameterClass="Category" >
- <selectKey property="Id" type="post" resultClass="int">
- select LAST_INSERT_ID() as value
- </selectKey>
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (#Name#, #GuidString:Varchar#)
- </insert>
-
- <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
- <insert id="InsertCategoryViaParameterMap" parameterMap="InsertParam">
- <selectKey property="Id" type="post" resultClass="int">
- select LAST_INSERT_ID() as value
- </selectKey>
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (?,?);
- </insert>
-
- <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
- <insert id="InsertCategoryNull" parameterMap="insert-null-params">
- <selectKey property="Id" type="post" resultClass="int">
- select LAST_INSERT_ID() as value
- </selectKey>
- insert into Categories
- (Category_Name, Category_Guid)
- values
- (?,?);
- </insert>
-
- <update id="UpdateCategoryViaParameterMap" parameterMap="UpdateParam">
- update Categories set
- Category_Name =?,
- Category_Guid = ?
- where
- Category_Id = ?
- </update>
-
- <procedure id="InsertCategoryViaStoreProcedure" parameterMap="category-insert-params">
- ps_InsertCategorie
- </procedure>
-
- <insert id="InsertCategoryGenerate" parameterMap="insert-generate-params">
- <selectKey property="Id" type="post" resultClass="int">
- select LAST_INSERT_ID() as value
- </selectKey>
- <generate table="Categories" />
- </insert>
-
- <update id="UpdateCategoryGenerate" parameterMap="update-generate-params">
- <generate table="Categories" by="Category_Id"/>
- </update>
-
- <delete id="DeleteCategoryGenerate" parameterMap="delete-generate-params">
- <generate table="Categories" by="Category_Id, Category_Name"/>
- </delete>
-
- <select id="SelectByPKCategoryGenerate" resultClass="Category" parameterClass="Category" parameterMap="select-generate-params">
- <generate table="Categories" by="Category_Id"/>
- </select>
-
- <select id="SelectAllCategoryGenerate" resultClass="Category" parameterMap="select-generate-params">
- <generate table="Categories" />
- </select>
-
- <statement id="DynamicGuid"
- resultClass="Category"
- parameterClass="Category">
- select
- Category_ID as Id,
- Category_Name as Name,
- Category_Guid as Guid
- from Categories
- <dynamic prepend="where">
- <isNotEqual prepend="and" property="Guid" compareProperty="EmptyGuid">
- Category_Guid=#GuidString:Varchar#
- </isNotEqual>
- </dynamic>
- </statement>
- <parameterMap id="category-insert-params">
- <parameter property="Id" column="Category_Id" dbType="Int32" />
- <parameter property="Name" column="Category_Name"/>
- <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
- </parameterMap>
-
- <parameterMap id="InsertParam">
- <parameter property="Name" column="Category_Name"/>
- <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
- </parameterMap>
-
- <parameterMap id="insert-null-params">
- <parameter property="Name" column="Category_Name"/>
- <parameter property="GuidString" column="Category_Guid" nullValue="00000000-0000-0000-0000-000000000000" dbType="Varchar"/>
- </parameterMap>
-
- <parameterMap id="UpdateParam" extends="InsertParam">
- <parameter property="Id" column="Category_Id" />
- </parameterMap>
-
- <!-- Used by generated statement -->
-
- <parameterMap id="insert-generate-params">
- <parameter property="Name" column="Category_Name"/>
- <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
- </parameterMap>
-
- <parameterMap id="update-generate-params" extends="insert-generate-params">
- <parameter property="Id" column="Category_Id" />
- </parameterMap>
-
- <parameterMap id="delete-generate-params">
- <parameter property="Id" column="Category_Id" />
- <parameter property="Name" column="Category_Name"/>
- </parameterMap>
-
- <parameterMap id="select-generate-params">
- <parameter property="Id" column="Category_Id" />
- <parameter property="Name" column="Category_Name"/>
- <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
- </parameterMap>
-
-
-</sqlMap>
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Category" >
+
+ <alias>
+ <typeAlias alias="Category" type="IBatisNet.DataMapper.Test.Domain.Category, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+
+ <select id="GetCategory" parameterClass="Integer" resultClass="Category">
+ select
+ Category_ID as Id,
+ Category_Name as Name,
+ Category_Guid as GuidString
+ from Categories
+ where Category_ID = #value#
+ </select>
+
+ <select id="GetCategoryGuid" parameterClass="Integer" resultClass="guid">
+ select
+ Category_Guid as value
+ from Categories
+ where Category_ID = #value#
+ </select>
+
+ <!-- Test for statement as insert -->
+ <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
+ <insert id="InsertCategory" parameterClass="Category">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (#Name#, #GuidString:Varchar#);
+ </insert>
+
+ <!-- -->
+ <insert id="InsertCategoryViaInsertStatement" parameterClass="Category" >
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (#Name#, #GuidString:Varchar#)
+ </insert>
+
+ <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
+ <insert id="InsertCategoryViaParameterMap" parameterMap="InsertParam">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (?,?);
+ </insert>
+
+ <!-- Needs to be <insert> vs <statement> for MySql due to selectKey -->
+ <insert id="InsertCategoryNull" parameterMap="insert-null-params">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ insert into Categories
+ (Category_Name, Category_Guid)
+ values
+ (?,?);
+ </insert>
+
+ <update id="UpdateCategoryViaParameterMap" parameterMap="UpdateParam">
+ update Categories set
+ Category_Name =?,
+ Category_Guid = ?
+ where
+ Category_Id = ?
+ </update>
+
+ <procedure id="InsertCategoryViaStoreProcedure" parameterMap="category-insert-params">
+ ps_InsertCategorie
+ </procedure>
+
+ <insert id="InsertCategoryGenerate" parameterMap="insert-generate-params">
+ <selectKey property="Id" type="post" resultClass="int">
+ select LAST_INSERT_ID() as value
+ </selectKey>
+ <generate table="Categories" />
+ </insert>
+
+ <update id="UpdateCategoryGenerate" parameterMap="update-generate-params">
+ <generate table="Categories" by="Category_Id"/>
+ </update>
+
+ <delete id="DeleteCategoryGenerate" parameterMap="delete-generate-params">
+ <generate table="Categories" by="Category_Id, Category_Name"/>
+ </delete>
+
+ <select id="SelectByPKCategoryGenerate" resultClass="Category" parameterClass="Category" parameterMap="select-generate-params">
+ <generate table="Categories" by="Category_Id"/>
+ </select>
+
+ <select id="SelectAllCategoryGenerate" resultClass="Category" parameterMap="select-generate-params">
+ <generate table="Categories" />
+ </select>
+
+ <statement id="DynamicGuid"
+ resultClass="Category"
+ parameterClass="Category">
+ select
+ Category_ID as Id,
+ Category_Name as Name,
+ Category_Guid as Guid
+ from Categories
+ <dynamic prepend="where">
+ <isNotEqual prepend="and" property="Guid" compareProperty="EmptyGuid">
+ Category_Guid=#GuidString:Varchar#
+ </isNotEqual>
+ </dynamic>
+ </statement>
+ <parameterMap id="category-insert-params">
+ <parameter property="Id" column="Category_Id" dbType="Int32" />
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="InsertParam">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="insert-null-params">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" nullValue="00000000-0000-0000-0000-000000000000" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="UpdateParam" extends="InsertParam">
+ <parameter property="Id" column="Category_Id" />
+ </parameterMap>
+
+ <!-- Used by generated statement -->
+
+ <parameterMap id="insert-generate-params">
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+ <parameterMap id="update-generate-params" extends="insert-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ </parameterMap>
+
+ <parameterMap id="delete-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ <parameter property="Name" column="Category_Name"/>
+ </parameterMap>
+
+ <parameterMap id="select-generate-params">
+ <parameter property="Id" column="Category_Id" />
+ <parameter property="Name" column="Category_Name"/>
+ <parameter property="GuidString" column="Category_Guid" dbType="Varchar"/>
+ </parameterMap>
+
+
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/MySql/Complex.xml b/tests/unit/Data/SqlMap/maps/sqlite/Complex.xml
index f6da811d..c596e555 100644
--- a/tests/simple_unit/SqlMap/maps/MySql/Complex.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/Complex.xml
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Complex" >
-
- <statements>
-
- <statement id="ComplexMap"
- resultClass="int" >
- select Account_ID from Accounts where Account_ID = #obj.Map.Id#
- </statement>
-
- <insert id="InsertComplexAccountViaInlineDefaultNull"
- parameterClass="Hashtable" >
- insert into Accounts
- (Account_ID, Account_FirstName, Account_LastName, Account_Email)
- values
- (#obj.Map.acct.Id#, #obj.Map.acct.FirstName#, #obj.Map.acct.LastName#, #obj.Map.acct.EmailAddress:Varchar:no_email@provided.com#
- )
- </insert>
-
- </statements>
-
-
-</sqlMap>
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Complex" >
+
+ <statements>
+
+ <statement id="ComplexMap"
+ resultClass="int" >
+ select Account_ID from Accounts where Account_ID = #obj.Map.Id#
+ </statement>
+
+ <insert id="InsertComplexAccountViaInlineDefaultNull"
+ parameterClass="Hashtable" >
+ insert into Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email)
+ values
+ (#obj.Map.acct.Id#, #obj.Map.acct.FirstName#, #obj.Map.acct.LastName#, #obj.Map.acct.EmailAddress:Varchar:no_email@provided.com#
+ )
+ </insert>
+
+ </statements>
+
+
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/Document.xml b/tests/unit/Data/SqlMap/maps/sqlite/Document.xml
index 1f426e54..83028e05 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/Document.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/Document.xml
@@ -1,53 +1,53 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Document" >
-
- <resultMap id="document" class="Document">
- <result property="Id" column="Document_Id" type="integer" />
- <result property="Title" column="Document_Title"/>
- <discriminator column="Document_Type" type="string"/>
- <subMap value="Book" resultMapping="book" />
- <subMap value="Newspaper" resultMapping="newspaper" />
- </resultMap>
-
- <resultMap id="document-custom-handler" class="Document">
- <result property="Id" column="Document_Id" type="integer"/>
- <result property="Title" column="Document_Title"/>
- <discriminator column="Document_Type" typeHandler="CustomInheritance"/>
- <subMap value="Book" resultMapping="book" />
- <subMap value="Newspaper" resultMapping="newspaper" />
- </resultMap>
-
- <resultMap id="book" class="Book" extends="document">
- <result property="PageNumber" column="Document_PageNumber"/>
- </resultMap>
-
- <resultMap id="newspaper" class="Newspaper" extends="document">
- <result property="City" column="Document_City"/>
- </resultMap>
-
- <statement id="GetAllDocument"
- resultMap="document">
- select
- *
- from Documents
- order by Document_Type, Document_Id
- </statement>
-
- <select id="GetTypedCollection"
- listClass="DocumentCollection"
- resultMap="document">
- select
- *
- from Documents
- order by Document_Type, Document_Id
- </select>
-
- <select id="GetAllDocumentWithCustomTypeHandler"
- resultMap="document-custom-handler">
- select
- *
- from Documents
- order by Document_Type, Document_Id
- </select>
-
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Document" >
+
+ <resultMap id="document" class="Document">
+ <result property="Id" column="Document_Id" type="integer" />
+ <result property="Title" column="Document_Title"/>
+ <discriminator column="Document_Type" type="string"/>
+ <subMap value="Book" resultMapping="book" />
+ <subMap value="Newspaper" resultMapping="newspaper" />
+ </resultMap>
+
+ <resultMap id="document-custom-handler" class="Document">
+ <result property="Id" column="Document_Id" type="integer"/>
+ <result property="Title" column="Document_Title"/>
+ <discriminator column="Document_Type" typeHandler="CustomInheritance"/>
+ <subMap value="Book" resultMapping="book" />
+ <subMap value="Newspaper" resultMapping="newspaper" />
+ </resultMap>
+
+ <resultMap id="book" class="Book" extends="document">
+ <result property="PageNumber" column="Document_PageNumber"/>
+ </resultMap>
+
+ <resultMap id="newspaper" class="Newspaper" extends="document">
+ <result property="City" column="Document_City"/>
+ </resultMap>
+
+ <statement id="GetAllDocument"
+ resultMap="document">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_Id
+ </statement>
+
+ <select id="GetTypedCollection"
+ listClass="DocumentCollection"
+ resultMap="document">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_Id
+ </select>
+
+ <select id="GetAllDocumentWithCustomTypeHandler"
+ resultMap="document-custom-handler">
+ select
+ *
+ from Documents
+ order by Document_Type, Document_Id
+ </select>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/DynamicAccount.xml b/tests/unit/Data/SqlMap/maps/sqlite/DynamicAccount.xml
index 4d12424b..429a745a 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/DynamicAccount.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/DynamicAccount.xml
@@ -1,447 +1,447 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Account" >
-
- <alias>
- <typeAlias alias="Search" type="IBatisNet.DataMapper.Test.Domain.Search, IBatisNet.DataMapper.Test"/>
- </alias>
-
- <statements>
-
- <select id="DynamicAll"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- </select>
-
- <select id="DynamicWithExtend"
- extends="DynamicAll"
- parameterClass="Account"
- resultClass="Account">
- <dynamic prepend="WHERE" >
- <isGreaterThan prepend="AND" property="Id" compareValue="0" >
- Account_ID = #Id#
- </isGreaterThan>
- <isNotNull prepend="AND" property="Ids" >
- Account_ID in
- <iterate property="Ids" open="(" close=")" conjunction="," >
- #Ids[]#
- </iterate>
- </isNotNull>
- <isNotEmpty prepend="AND" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="EmailAddress" >
- <isEqual property="EmailAddress" compareValue="Joe">
- Account_Email = 'clinton.begin@ibatis.com'
- </isEqual>
- <isNotEqual property="EmailAddress" compareValue="Joe">
- Account_Email = #EmailAddress#
- </isNotEqual>
- </isNotEmpty>
- </dynamic>
- </select>
-
- <!-- IBATISNET-114: remapResults -->
- <statement id="DynamicSqlOnColumnSelection"
- parameterClass="Account"
- resultClass="Account">
- SELECT
- Account_ID as Id,
- <dynamic>
- <isEqual property="LastName" compareValue="Dalton" >
- Account_FirstName as FirstName,
- </isEqual>
- <isEqual property="LastName" compareValue="Dalton" >
- Account_LastName as LastName,
- </isEqual>
- </dynamic>
-
- Account_Email as EmailAddress
- FROM
- Accounts
- </statement>
-
- <statement id="DynamicIsEqual"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isEqual compareValue="Joe" >
- where Account_FirstName = 'Joe'
- </isEqual>
- </statement>
-
- <statement id="DynamicIsParameterPresent"
- parameterClass="integer"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isParameterPresent >
- where Account_ID = #value#
- </isParameterPresent>
- </statement>
-
- <statement id="DynamicIsNotEmpty"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isNotEmpty>
- where Account_FirstName = #value#
- </isNotEmpty>
- </statement>
-
- <statement id="DynamicIsGreater"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isGreaterThan compareValue="3" >
- where Account_ID = 1
- </isGreaterThan>
- </statement>
-
- <statement id="DynamicIsGreaterEqual"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isGreaterEqual compareValue="3" >
- where Account_ID = 1
- </isGreaterEqual>
- </statement>
-
- <statement id="DynamicIsLess"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isLessThan compareValue="3" >
- where Account_ID = 1
- </isLessThan>
- </statement>
-
- <statement id="DynamicIsLessEqual"
- parameterClass="int"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isLessEqual compareValue="3" >
- where Account_ID = 1
- </isLessEqual>
- </statement>
-
- <statement id="DynamicIsNotNull"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isNotNull>
- where Account_ID = 1
- </isNotNull>
- </statement>
-
- <statement id="DynamicIsPropertyAvailable"
- parameterClass="string"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <isPropertyAvailable property="Id" >
- where Account_ID = 1
- </isPropertyAvailable>
- </statement>
-
-
- <statement id="DynamicSubst"
- parameterClass="map"
- resultClass="Account">
- <dynamic>
- $statement$
- </dynamic>
- </statement>
-
- <statement id="DynamicIterate"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- WHERE Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- </statement>
-
- <statement id="DynamicIterate2"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- WHERE Account_ID IN
- <iterate property="Ids" open="(" close=")" conjunction="," >
- #Ids[]#
- </iterate>
- </statement>
-
- <statement id="MultiDynamicIterate"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- WHERE Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- and Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- </statement>
-
-
- <statement id="DynamicQueryByExample"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="WHERE" >
- <isGreaterThan prepend="AND" property="Id" compareValue="0" >
- Account_ID = #Id#
- </isGreaterThan>
- <isNotNull prepend="AND" property="Ids" >
- Account_ID in
- <iterate property="Ids" open="(" close=")" conjunction="," >
- #Ids[]#
- </iterate>
- </isNotNull>
- <isNotEmpty prepend="AND" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="EmailAddress" >
- <isEqual property="EmailAddress" compareValue="Joe">
- Account_Email = 'clinton.begin@ibatis.com'
- </isEqual>
- <isNotEqual property="EmailAddress" compareValue="Joe">
- Account_Email = #EmailAddress#
- </isNotEqual>
- </isNotEmpty>
- </dynamic>
- </statement>
-
- <statement id="DynamicIterateWithPrepend1"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where" >
- Account_ID IN
- <iterate open="(" close=")" conjunction=",">
- #[]#
- </iterate>
- </dynamic>
- </statement>
-
- <statement id="DynamicIterateWithPrepend2"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where" >
- <iterate open="(" close=")" conjunction="OR">
- Account_ID = #[]#
- </iterate>
- </dynamic>
- </statement>
-
- <statement id="DynamicIterateWithPrepend3"
- parameterClass="list"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where" >
- <isParameterPresent prepend="BLAH!" >
- <iterate open="(" close=")" conjunction="OR">
- Account_ID = #[]#
- </iterate>
- </isParameterPresent>
- </dynamic>
- </statement>
-
- <statement id="DynamicWithPrepend"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where">
- <isParameterPresent>
- <isNotEmpty prepend="and" property="Id" >
- Account_ID = #Id#
- </isNotEmpty>
- <isNotEmpty prepend="and" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="and" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- </isParameterPresent>
- </dynamic>
- </statement>
-
- <statement id="DynamicWithTwoDynamicElements"
- parameterClass="Account"
- resultClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where">
- <isNotEmpty prepend="BLAH!" property="Id" >
- Account_ID = #Id#
- </isNotEmpty>
- </dynamic>
- <dynamic prepend="and">
- <isNotEmpty prepend="BLAH!" property="FirstName" >
- Account_FirstName = #FirstName#
- </isNotEmpty>
- <isNotEmpty prepend="and" property="LastName" >
- Account_LastName = #LastName#
- </isNotEmpty>
- </dynamic>
- </statement>
-
- <statement id="ComplexDynamicStatement"
- cacheModel="account-cache"
- resultClass="Account"
- parameterClass="Account">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="WHERE">
- <isNotNull prepend="AND" property="FirstName">
- (Account_FirstName = #FirstName#
- <isNotNull prepend="OR" property="LastName">
- Account_LastName = #LastName#
- </isNotNull>
- )
- </isNotNull>
- <isNotNull prepend="AND" property="EmailAddress">
- Account_Email like #EmailAddress#
- </isNotNull>
- <isGreaterThan prepend="AND" property="Id" compareValue="0">
- Account_ID = #Id#
- </isGreaterThan>
- </dynamic>
- order by Account_LastName
- </statement>
-
- <statement id="Jira-IBATISNET-11"
- resultClass="Account"
- parameterClass="Search">
- select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
- from Accounts
- <dynamic prepend="where">
- <isNotNull prepend="and" property="NumberSearch">
- ((Account_ID $Operande$ #NumberSearch#) or
- (Account_ID $Operande$ #NumberSearch#))
- </isNotNull>
- <isEqual prepend="and" property="StartDate" compareValue="25/12/2004">
- <![CDATA[Account_FirstName >= #StartDate# ]]>
- </isEqual>
- <isEqual prepend="and" property="StartDateAnd" compareValue="true">
- <![CDATA[Account_LastName >= #StartDate# ]]>
- </isEqual>
- </dynamic>
-
- order by Account_LastName
- </statement>
- </statements>
-
-
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Account" >
+
+ <alias>
+ <typeAlias alias="Search" type="IBatisNet.DataMapper.Test.Domain.Search, IBatisNet.DataMapper.Test"/>
+ </alias>
+
+ <statements>
+
+ <select id="DynamicAll"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ </select>
+
+ <select id="DynamicWithExtend"
+ extends="DynamicAll"
+ parameterClass="Account"
+ resultClass="Account">
+ <dynamic prepend="WHERE" >
+ <isGreaterThan prepend="AND" property="Id" compareValue="0" >
+ Account_ID = #Id#
+ </isGreaterThan>
+ <isNotNull prepend="AND" property="Ids" >
+ Account_ID in
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </isNotNull>
+ <isNotEmpty prepend="AND" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="EmailAddress" >
+ <isEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = 'clinton.begin@ibatis.com'
+ </isEqual>
+ <isNotEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = #EmailAddress#
+ </isNotEqual>
+ </isNotEmpty>
+ </dynamic>
+ </select>
+
+ <!-- IBATISNET-114: remapResults -->
+ <statement id="DynamicSqlOnColumnSelection"
+ parameterClass="Account"
+ resultClass="Account">
+ SELECT
+ Account_ID as Id,
+ <dynamic>
+ <isEqual property="LastName" compareValue="Dalton" >
+ Account_FirstName as FirstName,
+ </isEqual>
+ <isEqual property="LastName" compareValue="Dalton" >
+ Account_LastName as LastName,
+ </isEqual>
+ </dynamic>
+
+ Account_Email as EmailAddress
+ FROM
+ Accounts
+ </statement>
+
+ <statement id="DynamicIsEqual"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isEqual compareValue="Joe" >
+ where Account_FirstName = 'Joe'
+ </isEqual>
+ </statement>
+
+ <statement id="DynamicIsParameterPresent"
+ parameterClass="integer"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isParameterPresent >
+ where Account_ID = #value#
+ </isParameterPresent>
+ </statement>
+
+ <statement id="DynamicIsNotEmpty"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isNotEmpty>
+ where Account_FirstName = #value#
+ </isNotEmpty>
+ </statement>
+
+ <statement id="DynamicIsGreater"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isGreaterThan compareValue="3" >
+ where Account_ID = 1
+ </isGreaterThan>
+ </statement>
+
+ <statement id="DynamicIsGreaterEqual"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isGreaterEqual compareValue="3" >
+ where Account_ID = 1
+ </isGreaterEqual>
+ </statement>
+
+ <statement id="DynamicIsLess"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isLessThan compareValue="3" >
+ where Account_ID = 1
+ </isLessThan>
+ </statement>
+
+ <statement id="DynamicIsLessEqual"
+ parameterClass="int"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isLessEqual compareValue="3" >
+ where Account_ID = 1
+ </isLessEqual>
+ </statement>
+
+ <statement id="DynamicIsNotNull"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isNotNull>
+ where Account_ID = 1
+ </isNotNull>
+ </statement>
+
+ <statement id="DynamicIsPropertyAvailable"
+ parameterClass="string"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <isPropertyAvailable property="Id" >
+ where Account_ID = 1
+ </isPropertyAvailable>
+ </statement>
+
+
+ <statement id="DynamicSubst"
+ parameterClass="map"
+ resultClass="Account">
+ <dynamic>
+ $statement$
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterate"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </statement>
+
+ <statement id="DynamicIterate2"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </statement>
+
+ <statement id="MultiDynamicIterate"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ WHERE Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ and Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </statement>
+
+
+ <statement id="DynamicQueryByExample"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="WHERE" >
+ <isGreaterThan prepend="AND" property="Id" compareValue="0" >
+ Account_ID = #Id#
+ </isGreaterThan>
+ <isNotNull prepend="AND" property="Ids" >
+ Account_ID in
+ <iterate property="Ids" open="(" close=")" conjunction="," >
+ #Ids[]#
+ </iterate>
+ </isNotNull>
+ <isNotEmpty prepend="AND" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ <isNotEmpty prepend="AND" property="EmailAddress" >
+ <isEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = 'clinton.begin@ibatis.com'
+ </isEqual>
+ <isNotEqual property="EmailAddress" compareValue="Joe">
+ Account_Email = #EmailAddress#
+ </isNotEqual>
+ </isNotEmpty>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend1"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ Account_ID IN
+ <iterate open="(" close=")" conjunction=",">
+ #[]#
+ </iterate>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend2"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ <iterate open="(" close=")" conjunction="OR">
+ Account_ID = #[]#
+ </iterate>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicIterateWithPrepend3"
+ parameterClass="list"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where" >
+ <isParameterPresent prepend="BLAH!" >
+ <iterate open="(" close=")" conjunction="OR">
+ Account_ID = #[]#
+ </iterate>
+ </isParameterPresent>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicWithPrepend"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isParameterPresent>
+ <isNotEmpty prepend="and" property="Id" >
+ Account_ID = #Id#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ </isParameterPresent>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicWithTwoDynamicElements"
+ parameterClass="Account"
+ resultClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isNotEmpty prepend="BLAH!" property="Id" >
+ Account_ID = #Id#
+ </isNotEmpty>
+ </dynamic>
+ <dynamic prepend="and">
+ <isNotEmpty prepend="BLAH!" property="FirstName" >
+ Account_FirstName = #FirstName#
+ </isNotEmpty>
+ <isNotEmpty prepend="and" property="LastName" >
+ Account_LastName = #LastName#
+ </isNotEmpty>
+ </dynamic>
+ </statement>
+
+ <statement id="ComplexDynamicStatement"
+ cacheModel="account-cache"
+ resultClass="Account"
+ parameterClass="Account">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="WHERE">
+ <isNotNull prepend="AND" property="FirstName">
+ (Account_FirstName = #FirstName#
+ <isNotNull prepend="OR" property="LastName">
+ Account_LastName = #LastName#
+ </isNotNull>
+ )
+ </isNotNull>
+ <isNotNull prepend="AND" property="EmailAddress">
+ Account_Email like #EmailAddress#
+ </isNotNull>
+ <isGreaterThan prepend="AND" property="Id" compareValue="0">
+ Account_ID = #Id#
+ </isGreaterThan>
+ </dynamic>
+ order by Account_LastName
+ </statement>
+
+ <statement id="Jira-IBATISNET-11"
+ resultClass="Account"
+ parameterClass="Search">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ <dynamic prepend="where">
+ <isNotNull prepend="and" property="NumberSearch">
+ ((Account_ID $Operande$ #NumberSearch#) or
+ (Account_ID $Operande$ #NumberSearch#))
+ </isNotNull>
+ <isEqual prepend="and" property="StartDate" compareValue="25/12/2004">
+ <![CDATA[Account_FirstName >= #StartDate# ]]>
+ </isEqual>
+ <isEqual prepend="and" property="StartDateAnd" compareValue="true">
+ <![CDATA[Account_LastName >= #StartDate# ]]>
+ </isEqual>
+ </dynamic>
+
+ order by Account_LastName
+ </statement>
+ </statements>
+
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/Enumeration.xml b/tests/unit/Data/SqlMap/maps/sqlite/Enumeration.xml
index cee96b0a..58391c5d 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/Enumeration.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/Enumeration.xml
@@ -1,55 +1,55 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMap namespace="Enumeration" >
-
- <resultMaps>
- <resultMap id="enumeration-result" class="Enumeration" >
- <result property="Id" column="Enum_ID"/>
- <result property="Day" column="Enum_Day"/>
- <result property="Color" column="Enum_Color"/>
- <result property="Month" column="Enum_Month" nullValue="All"/>
- </resultMap>
- </resultMaps>
-
- <statements>
-
- <select id="GetEnumerationNullValue"
- parameterClass="Integer"
- resultMap="enumeration-result">
- select
- Enum_ID,
- Enum_Day,
- Enum_Color,
- Enum_Month
- from Enumerations
- where Enum_ID = #value#
- </select>
-
- <select id="GetEnumeration" parameterClass="Integer" resultClass="Enumeration">
- select
- Enum_ID as Id,
- Enum_Day as Day,
- Enum_Color as Color,
- Enum_Month as Month
- from Enumerations
- where Enum_ID = #value#
- </select>
-
- <insert id="InsertEnumViaParameterMap" parameterMap="insert-params" >
- insert into Enumerations
- (Enum_ID, Enum_Day, Enum_Color, Enum_Month)
- values
- (?, ?, ?, ?)
- </insert>
-
- </statements>
-
- <parameterMaps>
- <parameterMap id="insert-params">
- <parameter property="Id" column="Enum_ID" />
- <parameter property="Day" column="Enum_Day"/>
- <parameter property="Color" column="Enum_Color" />
- <parameter property="Month" column="Enum_Month" nullValue="All"/>
- </parameterMap>
- </parameterMaps>
-
-</sqlMap>
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Enumeration" >
+
+ <resultMaps>
+ <resultMap id="enumeration-result" class="Enumeration" >
+ <result property="Id" column="Enum_ID"/>
+ <result property="Day" column="Enum_Day"/>
+ <result property="Color" column="Enum_Color"/>
+ <result property="Month" column="Enum_Month" nullValue="All"/>
+ </resultMap>
+ </resultMaps>
+
+ <statements>
+
+ <select id="GetEnumerationNullValue"
+ parameterClass="Integer"
+ resultMap="enumeration-result">
+ select
+ Enum_ID,
+ Enum_Day,
+ Enum_Color,
+ Enum_Month
+ from Enumerations
+ where Enum_ID = #value#
+ </select>
+
+ <select id="GetEnumeration" parameterClass="Integer" resultClass="Enumeration">
+ select
+ Enum_ID as Id,
+ Enum_Day as Day,
+ Enum_Color as Color,
+ Enum_Month as Month
+ from Enumerations
+ where Enum_ID = #value#
+ </select>
+
+ <insert id="InsertEnumViaParameterMap" parameterMap="insert-params" >
+ insert into Enumerations
+ (Enum_ID, Enum_Day, Enum_Color, Enum_Month)
+ values
+ (?, ?, ?, ?)
+ </insert>
+
+ </statements>
+
+ <parameterMaps>
+ <parameterMap id="insert-params">
+ <parameter property="Id" column="Enum_ID" />
+ <parameter property="Day" column="Enum_Day"/>
+ <parameter property="Color" column="Enum_Color" />
+ <parameter property="Month" column="Enum_Month" nullValue="All"/>
+ </parameterMap>
+ </parameterMaps>
+
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/LineItem.xml b/tests/unit/Data/SqlMap/maps/sqlite/LineItem.xml
index cee1ee36..95cc4af7 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/LineItem.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/LineItem.xml
@@ -1,183 +1,183 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sqlMap namespace="LineItem" >
-
- <resultMap id="LineItem-Price" class="float">
- <result property="value" column="LineItem_Price"/>
- </resultMap>
-
- <resultMap id="LineItem" class="LineItem">
- <result property="Id" column="LineItem_Id"/>
- <result property="Code" column="LineItem_Code"/>
- <result property="Quantity" column="LineItem_Quantity"/>
- <result property="Price" column="LineItem_Price"/>
- </resultMap>
-
- <resultMap id="LineItemWithNullReplacement" class="LineItem">
- <result property="Id" column="LineItem_Id"/>
- <result property="Code" column="LineItem_Code"/>
- <result property="Quantity" column="LineItem_Quantity"/>
- <result property="Price" column="LineItem_Price" nullValue="-77.77"/>
- </resultMap>
-
-
- <statement id="GetLineItemPrice"
- parameterClass="array"
- resultMap="LineItem-Price" >
- select
- LineItem_Price
- from LineItems
- where Order_ID = #Order_ID#
- and LineItem_ID = #LineItem_ID#
- </statement>
-
- <statement id="GetLineItemsForOrder"
- parameterClass="int"
- listClass="TList"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems where Order_ID = #value#
- </statement>
-
-
- <statement id="GetLineItemsForOrderWithListClass"
- parameterClass="int"
- listClass="LineItemCollection"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems where Order_ID = #value#
- order by LineItem_Code
- </statement>
-
- <statement id="GetSpecificLineItem"
- parameterClass="array"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems
- where Order_ID = #Order_ID#
- and LineItem_ID = #LineItem_ID#
- </statement>
-
- <statement id="GetSpecificLineItemWithPicture"
- parameterClass="array"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price,
- LineItem_Picture as PictureData
- from LineItems
- where Order_ID = #Order_ID#
- and LineItem_ID = #LineItem_ID#
- </statement>
-
- <select id="GetDynSpecificLineItem"
- parameterClass="array"
- resultClass="LineItem">
- select
- LineItem_ID as Id,
- LineItem_Code as Code,
- LineItem_Quantity as Quantity,
- LineItem_Price as Price
- from LineItems
- where Order_ID = #Order_ID#
- <dynamic>
- <isNotNull property="LineItem_ID">
- and LineItem_ID = #LineItem_ID#
- </isNotNull>
- </dynamic>
- </select>
-
- <statement id="GetSpecificLineItemWithNullReplacement"
- parameterClass="int"
- resultMap="LineItemWithNullReplacement">
- select
- LineItem_ID,
- LineItem_Code,
- LineItem_Quantity,
- LineItem_Price
- from LineItems
- where LineItem_ID = #value#
- </statement>
-
- <statement id="InsertLineItem"
- parameterMap="line-item-insert-params" >
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (?, ?, ?, ?, ?);
- </statement>
-
- <statement id="InsertLineItemWithPicture"
- parameterMap="line-item-insert-params-picture" >
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price, LineItem_Picture)
- values
- (?, ?, ?, ?, ?, ?);
- </statement>
-
- <insert id="InsertLineItemPostKey" parameterClass="LineItem">
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
- <selectKey property="Id" type="post" resultClass="int" >
- select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
- </selectKey>
- </insert>
-
- <insert id="InsertLineItemPreKey" parameterClass="LineItem">
- <selectKey property="Id" type="pre" resultClass="int" >
- select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
- </selectKey>
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
- </insert>
-
- <insert id="InsertLineItemNoKey" parameterClass="LineItem">
- insert into LineItems
- (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
- values
- (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
- </insert>
-
- <!-- JIRA 23 -->
- <delete id="DeleteWithComments" >
- <!-- Delete LineItems -->
- delete from LineItems where Order_ID = 10;
- <!-- Delete LineItems -->
- </delete>
-
- <parameterMap id="line-item-insert-params">
- <parameter property="Id" />
- <parameter property="Order.Id" />
- <parameter property="Code" />
- <parameter property="Quantity" />
- <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
- </parameterMap>
-
- <parameterMap id="line-item-insert-params-picture">
- <parameter property="Id" />
- <parameter property="Order.Id" />
- <parameter property="Code" />
- <parameter property="Quantity" />
- <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
- <parameter property="PictureData" dbType="Blob" />
- </parameterMap>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="LineItem" >
+
+ <resultMap id="LineItem-Price" class="float">
+ <result property="value" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="LineItem" class="LineItem">
+ <result property="Id" column="LineItem_Id"/>
+ <result property="Code" column="LineItem_Code"/>
+ <result property="Quantity" column="LineItem_Quantity"/>
+ <result property="Price" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="LineItemWithNullReplacement" class="LineItem">
+ <result property="Id" column="LineItem_Id"/>
+ <result property="Code" column="LineItem_Code"/>
+ <result property="Quantity" column="LineItem_Quantity"/>
+ <result property="Price" column="LineItem_Price" nullValue="-77.77"/>
+ </resultMap>
+
+
+ <statement id="GetLineItemPrice"
+ parameterClass="array"
+ resultMap="LineItem-Price" >
+ select
+ LineItem_Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <statement id="GetLineItemsForOrder"
+ parameterClass="int"
+ listClass="TList"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems where Order_ID = #value#
+ </statement>
+
+
+ <statement id="GetLineItemsForOrderWithListClass"
+ parameterClass="int"
+ listClass="LineItemCollection"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems where Order_ID = #value#
+ order by LineItem_Code
+ </statement>
+
+ <statement id="GetSpecificLineItem"
+ parameterClass="array"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <statement id="GetSpecificLineItemWithPicture"
+ parameterClass="array"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price,
+ LineItem_Picture as PictureData
+ from LineItems
+ where Order_ID = #Order_ID#
+ and LineItem_ID = #LineItem_ID#
+ </statement>
+
+ <select id="GetDynSpecificLineItem"
+ parameterClass="array"
+ resultClass="LineItem">
+ select
+ LineItem_ID as Id,
+ LineItem_Code as Code,
+ LineItem_Quantity as Quantity,
+ LineItem_Price as Price
+ from LineItems
+ where Order_ID = #Order_ID#
+ <dynamic>
+ <isNotNull property="LineItem_ID">
+ and LineItem_ID = #LineItem_ID#
+ </isNotNull>
+ </dynamic>
+ </select>
+
+ <statement id="GetSpecificLineItemWithNullReplacement"
+ parameterClass="int"
+ resultMap="LineItemWithNullReplacement">
+ select
+ LineItem_ID,
+ LineItem_Code,
+ LineItem_Quantity,
+ LineItem_Price
+ from LineItems
+ where LineItem_ID = #value#
+ </statement>
+
+ <statement id="InsertLineItem"
+ parameterMap="line-item-insert-params" >
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (?, ?, ?, ?, ?);
+ </statement>
+
+ <statement id="InsertLineItemWithPicture"
+ parameterMap="line-item-insert-params-picture" >
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price, LineItem_Picture)
+ values
+ (?, ?, ?, ?, ?, ?);
+ </statement>
+
+ <insert id="InsertLineItemPostKey" parameterClass="LineItem">
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
+ <selectKey property="Id" type="post" resultClass="int" >
+ select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
+ </selectKey>
+ </insert>
+
+ <insert id="InsertLineItemPreKey" parameterClass="LineItem">
+ <selectKey property="Id" type="pre" resultClass="int" >
+ select 99 from LineItems where LineItem_ID = 1 and Order_ID=1
+ </selectKey>
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
+ </insert>
+
+ <insert id="InsertLineItemNoKey" parameterClass="LineItem">
+ insert into LineItems
+ (LineItem_ID, Order_ID, LineItem_Code, LineItem_Quantity, LineItem_Price)
+ values
+ (#Id#, #Order.Id#, #Code#, #Quantity#, #Price, type=float#)
+ </insert>
+
+ <!-- JIRA 23 -->
+ <delete id="DeleteWithComments" >
+ <!-- Delete LineItems -->
+ delete from LineItems where Order_ID = 10;
+ <!-- Delete LineItems -->
+ </delete>
+
+ <parameterMap id="line-item-insert-params">
+ <parameter property="Id" />
+ <parameter property="Order.Id" />
+ <parameter property="Code" />
+ <parameter property="Quantity" />
+ <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
+ </parameterMap>
+
+ <parameterMap id="line-item-insert-params-picture">
+ <parameter property="Id" />
+ <parameter property="Order.Id" />
+ <parameter property="Code" />
+ <parameter property="Quantity" />
+ <parameter property="Price" dbType="Decimal" nullValue="-99.99"/>
+ <parameter property="PictureData" dbType="Blob" />
+ </parameterMap>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/Order.xml b/tests/unit/Data/SqlMap/maps/sqlite/Order.xml
index 69210bf7..17b45d35 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/Order.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/Order.xml
@@ -1,503 +1,503 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sqlMap namespace="Order">
-
- <!-- If the type is not specified, ADO.NET infers the
- data provider Type of the Parameter from the Value property
- of the Parameter object. -->
-
-
- <resultMap id="credit-card-result" class="string">
- <result property="value" column="Order_CardNumber"/>
- </resultMap>
- <!-- -->
- <resultMap id="order-with-lines-result" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItemsList" lazyLoad="true" type="TList" column="Order_Id" select="GetLineItemsForOrder" />
- </resultMap>
-
- <resultMap id="order-with-lines-result-no-lazy-load" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItemsList" type="TList" column="Order_Id" select="GetLineItemsForOrder" />
- </resultMap>
-
- <resultMap id="order-with-lines-result-statement-namespaces" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItemsList" lazyLoad="true" type="TList" column="Order_Id" select="LineItem.GetLineItemsForOrder" />
- </resultMap>
-
- <resultMap id="order-with-lines-collection" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItems" column="Order_Id" lazyLoad="true"
- select="GetLineItemsForOrderWithListClass" />
- </resultMap>
-
- <resultMap id="order-with-lines-collection-no-lazy-load" class="Order"
- extends="lite-order-result-by-name" >
- <result property="LineItems" column="Order_Id"
- select="GetLineItemsForOrderWithListClass" />
- </resultMap>
-
- <resultMap id="order-with-lines-array" class="Order"
- extends="lite-order-result-by-name">
- <result property="LineItemsArray" column="Order_Id" select="GetLineItemsForOrder"/>
- </resultMap>
-
- <resultMap id="lite-order-map-result" class="array">
- <result property="Id" type="Int" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" type="string" column="Order_CardExpiry"/>
- <result property="CardType" type="string" column="Order_CardType"/>
- <result property="CardNumber" type="string" column="Order_CardNumber"/>
- <result property="Street" type="string" column="Order_Street"/>
- <result property="City" type="string" column="Order_City"/>
- <result property="Province" type="string" column="Order_Province"/>
- <result property="PostalCode" type="string" column="Order_PostalCode"/>
- </resultMap>
-
- <resultMap id="lite-order-result-by-name" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- </resultMap>
-
- <resultMap id="order-hash" class="array">
- <result property="Date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
- </resultMap>
-
- <resultMap id="order-with-types-result" class="Order">
- <result property="Id" column="Order_Id" />
- <result property="Date" column="Order_Date" type="date" />
- <result property="CardExpiry" column="Order_CardExpiry" />
- <result property="CardType" column="Order_CardType" />
- <result property="CardNumber" column="Order_CardNumber" />
- <result property="Street" column="Order_Street" />
- <result property="City" column="Order_City" />
- <result property="Province" column="Order_Province" />
- <result property="PostalCode" column="Order_PostalCode" />
- </resultMap>
-
- <resultMap id="lite-order-result-by-index" class="Order">
- <result property="Id" column="Order_Id" columnIndex="0"/>
- <result property="Date" column="Order_Date" type="date" columnIndex="1" />
- <result property="CardExpiry" column="Order_CardExpiry" columnIndex="2"/>
- <result property="CardType" column="Order_CardType" columnIndex="3" />
- <result property="CardNumber" column="Order_CardNumber" columnIndex="4" />
- <result property="Street" column="Order_Street" columnIndex="5" />
- <result property="City" column="Order_City" columnIndex="6" />
- <result property="Province" column="Order_Province" columnIndex="7"/>
- <result property="PostalCode" column="Order_PostalCode" columnIndex="8" />
- </resultMap>
-
- <resultMap id="order-with-account-result" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="Account" column="Account_Id" select="GetAccountViaColumnName" />
- </resultMap>
-
- <resultMap id="order-with-collection-result" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="LineItemsList" column="Order_Id" select="GetLineItemsForOrder" />
- <result property="LineItems" column="Order_Id" select="GetLineItemsForOrder" lazyLoad="false" />
- </resultMap>
-
- <resultMap id="order-with-favourite-line-item" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem"
- column="Order_ID=Order_Id,LineItem_ID=Order_FavouriteLineItem"
- select="GetSpecificLineItem" />
- </resultMap>
-
- <resultMap id="order-with-dyn-favourite-line-item" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem"
- column="Order_ID=Order_Id,LineItem_ID=Order_FavouriteLineItem"
- select="GetDynSpecificLineItem" />
- </resultMap>
-
- <resultMap id="order-joined-favourite" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem" resultMapping="LineItem" />
- </resultMap>
-
- <resultMap id="order-joined-favourite2" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="FavouriteLineItem.Id" column="LineItem_Id"/>
- <result property="FavouriteLineItem.Code" column="LineItem_Code"/>
- <result property="FavouriteLineItem.Quantity" column="LineItem_Quantity"/>
- <result property="FavouriteLineItem.Price" column="LineItem_Price"/>
- </resultMap>
-
- <resultMap id="order-joined-with-account" class="Order">
- <result property="Id" column="Order_Id"/>
- <result property="Date" type="date" column="Order_Date" nullValue="01/01/0001 00:00:00"/>
- <result property="CardExpiry" column="Order_CardExpiry"/>
- <result property="CardType" column="Order_CardType"/>
- <result property="CardNumber" column="Order_CardNumber"/>
- <result property="Street" column="Order_Street"/>
- <result property="City" column="Order_City"/>
- <result property="Province" column="Order_Province"/>
- <result property="PostalCode" column="Order_PostalCode"/>
- <result property="Account" resultMapping="account-result-nullable-email" />
- </resultMap>
-
- <statement id="GetOrderLiteByColumnName"
- parameterClass="integer"
- resultMap="lite-order-result-by-name" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderByHashTable"
- parameterClass="Int"
- resultMap="order-hash" >
- select Order_Date from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderLiteByColumnIndex"
- parameterClass="Int"
- resultMap="lite-order-result-by-index" >
- select
- Order_Id,
- Order_Date,
- Order_CardExpiry,
- Order_CardType,
- Order_CardNumber,
- Order_Street,
- Order_City,
- Order_Province,
- Order_PostalCode
- from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithTypes"
- parameterClass="Int"
- resultMap="order-with-types-result" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItems"
- parameterClass="Integer"
- ListClass="TList"
- resultMap="order-with-lines-result" >
- select * from Orders where Order_Id = #value#
- </statement>
-
-
- <statement id="GetOrderWithLineItemsNoLazyLoad"
- parameterClass="Integer"
- resultMap="order-with-lines-result-no-lazy-load" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemsUsingStatementNamespaces"
- parameterClass="Integer"
- resultMap="order-with-lines-result-statement-namespaces" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetAllOrderWithLineItems"
- resultMap="order-with-lines-result" >
- select * from Orders
- </statement>
-
- <statement id="GetOrderCardExpiryViaResultClass"
- parameterClass="int"
- resultClass="date">
- select
- Order_Date as 'datetime'
- from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithAccount"
- parameterClass="int"
- resultMap="order-with-account-result" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemsCollection"
- parameterClass="Integer"
- resultMap="order-with-collection-result" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderJoinedFavourite"
- parameterClass="Integer"
- resultMap="order-joined-favourite" >
- select
- Orders.Order_Id as Order_Id,
- Orders.Account_Id as Account_Id,
- Orders.Order_Date as Order_Date,
- Orders.Order_CardType as Order_CardType,
- Orders.Order_CardNumber as Order_CardNumber,
- Orders.Order_CardExpiry as Order_CardExpiry,
- Orders.Order_Street as Order_Street,
- Orders.Order_City as Order_City,
- Orders.Order_Province as Order_Province,
- Orders.Order_PostalCode as Order_PostalCode,
- Orders.Order_FavouriteLineItem as Order_FavouriteLineItem,
- LineItems.LineItem_Id as LineItem_Id,
- LineItems.Order_Id as Order_Id,
- LineItems.LineItem_Code as LineItem_Code,
- LineItems.LineItem_Quantity as LineItem_Quantity,
- LineItems.LineItem_Price as LineItem_Price,
- LineItems.LineItem_Picture as LineItem_Picture
-
- from Orders, LineItems
- where Orders.Order_Id = LineItems.Order_Id
- and Order_FavouriteLineItem = LineItems.LineItem_ID
- and Orders.Order_Id = #value#
- </statement>
-
- <statement id="GetOrderJoinedFavourite2"
- parameterClass="Integer"
- resultMap="order-joined-favourite2" >
- select
-
- Orders.Order_Id as Order_Id,
- Orders.Account_Id as Account_Id,
- Orders.Order_Date as Order_Date,
- Orders.Order_CardType as Order_CardType,
- Orders.Order_CardNumber as Order_CardNumber,
- Orders.Order_CardExpiry as Order_CardExpiry,
- Orders.Order_Street as Order_Street,
- Orders.Order_City as Order_City,
- Orders.Order_Province as Order_Province,
- Orders.Order_PostalCode as Order_PostalCode,
- Orders.Order_FavouriteLineItem as Order_FavouriteLineItem,
- LineItems.LineItem_Id as LineItem_Id,
- LineItems.Order_Id as Order_Id,
- LineItems.LineItem_Code as LineItem_Code,
- LineItems.LineItem_Quantity as LineItem_Quantity,
- LineItems.LineItem_Price as LineItem_Price,
- LineItems.LineItem_Picture as LineItem_Picture
-
- from Orders, LineItems
- where Orders.Order_Id = LineItems.Order_Id
- and Order_FavouriteLineItem = LineItems.LineItem_ID
- and Orders.Order_Id = #value#
- </statement>
-
- <statement id="GetOrderJoinedFavourite3"
- parameterClass="Integer"
- resultClass="Order" >
- select
- Orders.Order_Id as Id,
- Order_Date as Date,
- Order_CardExpiry as CardExpiry,
- Order_CardType as CardType,
- Order_CardNumber as CardNumber,
- Order_Street as Street,
- Order_City as City,
- Order_Province as Province,
- Order_PostalCode as PostalCode,
- LineItem_ID as "FavouriteLineItem.Id",
- LineItem_Code as "FavouriteLineItem.Code",
- LineItem_Quantity as "FavouriteLineItem.Quantity",
- LineItem_Price as "FavouriteLineItem.Price"
- from Orders, LineItems
- where Orders.Order_Id = LineItems.Order_Id
- and Order_FavouriteLineItem = LineItems.LineItem_ID
- and Orders.Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithFavouriteLineItem"
- parameterClass="int"
- resultMap="order-with-favourite-line-item" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemCollection"
- parameterClass="int"
- resultMap="order-with-lines-collection" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemCollectionNoLazy"
- parameterClass="int"
- resultMap="order-with-lines-collection-no-lazy-load" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderAsHastable"
- parameterClass="Integer"
- resultMap="lite-order-map-result" >
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetOrderWithLineItemArray"
- parameterClass="int"
- resultMap="order-with-lines-array">
- select * from Orders where Order_Id = #value#
- </statement>
-
- <statement id="GetAllCreditCardNumbersFromOrders"
- resultMap="credit-card-result" >
- select distinct Order_CardNumber from Orders
- order by Order_CardNumber
- </statement>
-
- <statement id="InsertOrderViaParameterMap"
- parameterMap="order-insert-params-full" >
- insert into Orders
- (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
- Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
- values
- (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- </statement>
-
- <statement id="InsertOrderViaExtendParameterMap"
- parameterMap="insert-extend" >
- insert into Orders
- (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
- Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
- values
- (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- </statement>
-
- <statement id="InsertOrderViaPublicFields">
- insert into Orders
- (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
- Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
- values
- (#Id#, #Account.Id#, #Date#, #CardExpiry#, #CardType#, #CardNumber#, #Street#, #City#, #Province#, #PostalCode#)
- </statement>
-
- <select id="GetOrderWithDynFavouriteLineItem"
- parameterClass="Integer"
- resultMap="order-with-dyn-favourite-line-item">
- select * from Orders where Order_Id = #value#
- </select>
-
- <select id="SelectOrderByDate"
- parameterClass="array"
- resultMap="lite-order-result-by-name">
- select * from Orders where Order_Date = #Foo#
- </select>
-
- <select id="SelectOrderByDateDynamic"
- parameterClass="array"
- resultMap="lite-order-result-by-name">
- select * from Orders
- where 1=1
- <isNotEmpty prepend="AND" property="Foo">
- (Order_Date = '$Foo$')
- </isNotEmpty>
- </select>
-
- <select id="GetAccountJIRA45"
- parameterClass="int"
- resultMap="indexed-account-result">
- select
- Account_Id,
- Account_FirstName,
- Account_LastName,
- Account_Email
- from Accounts
- where Account_ID = #value#
- </select>
-
- <select id="GetOrderJoinWithAccount"
- parameterClass="Integer"
- resultMap="order-joined-with-account">
- select
- Order_Id,
- Order_Date,
- Order_CardExpiry,
- Order_CardType,
- Order_CardNumber,
- Order_Street,
- Order_City,
- Order_Province,
- Order_PostalCode,
- acc.Account_ID as Account_ID,
- acc.Account_FirstName as Account_FirstName,
- acc.Account_LastName as Account_LastName,
- acc.Account_Email as Account_Email
- from Orders as ord
- LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
- where Order_Id = #value#
- </select>
-
- <parameterMap id="order-insert-params-full">
- <parameter property="Id" dbType="Int32"/>
- <parameter property="Account.Id"/>
- <parameter property="Date" nullValue="0001-01-01 00:00:00" />
- <parameter property="CardExpiry" />
- <parameter property="CardType" />
- <parameter property="CardNumber" />
- <parameter property="Street" />
- <parameter property="City" />
- <parameter property="Province" />
- <parameter property="PostalCode" />
- </parameterMap>
-
- <parameterMap id="params-parent"> <!-- 1043181 support request -->
- <parameter property="Id" dbType="Int32"/>
- <parameter property="Account.Id"/>
- <parameter property="Date" nullValue="0001-01-01 00:00:00" />
- <parameter property="CardExpiry" />
- <parameter property="CardType" />
- <parameter property="CardNumber" />
- <parameter property="Street" />
- <parameter property="City" />
- <parameter property="Province" />
- <parameter property="PostalCode" />
- </parameterMap>
-
- <parameterMap id="insert-extend" extends="params-parent">
- </parameterMap>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="Order">
+
+ <!-- If the type is not specified, ADO.NET infers the
+ data provider Type of the Parameter from the Value property
+ of the Parameter object. -->
+
+
+ <resultMap id="credit-card-result" class="string">
+ <result property="value" column="Order_CardNumber"/>
+ </resultMap>
+ <!-- -->
+ <resultMap id="order-with-lines-result" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" lazyLoad="true" type="TList" column="Order_Id" select="GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-result-no-lazy-load" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" type="TList" column="Order_Id" select="GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-result-statement-namespaces" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItemsList" lazyLoad="true" type="TList" column="Order_Id" select="LineItem.GetLineItemsForOrder" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-collection" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItems" column="Order_Id" lazyLoad="true"
+ select="GetLineItemsForOrderWithListClass" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-collection-no-lazy-load" class="Order"
+ extends="lite-order-result-by-name" >
+ <result property="LineItems" column="Order_Id"
+ select="GetLineItemsForOrderWithListClass" />
+ </resultMap>
+
+ <resultMap id="order-with-lines-array" class="Order"
+ extends="lite-order-result-by-name">
+ <result property="LineItemsArray" column="Order_Id" select="GetLineItemsForOrder"/>
+ </resultMap>
+
+ <resultMap id="lite-order-map-result" class="array">
+ <result property="Id" type="Int" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" type="string" column="Order_CardExpiry"/>
+ <result property="CardType" type="string" column="Order_CardType"/>
+ <result property="CardNumber" type="string" column="Order_CardNumber"/>
+ <result property="Street" type="string" column="Order_Street"/>
+ <result property="City" type="string" column="Order_City"/>
+ <result property="Province" type="string" column="Order_Province"/>
+ <result property="PostalCode" type="string" column="Order_PostalCode"/>
+ </resultMap>
+
+ <resultMap id="lite-order-result-by-name" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ </resultMap>
+
+ <resultMap id="order-hash" class="array">
+ <result property="Date" column="Order_Date" nullValue="0001-01-01 00:00:00"/>
+ </resultMap>
+
+ <resultMap id="order-with-types-result" class="Order">
+ <result property="Id" column="Order_Id" />
+ <result property="Date" column="Order_Date" type="date" />
+ <result property="CardExpiry" column="Order_CardExpiry" />
+ <result property="CardType" column="Order_CardType" />
+ <result property="CardNumber" column="Order_CardNumber" />
+ <result property="Street" column="Order_Street" />
+ <result property="City" column="Order_City" />
+ <result property="Province" column="Order_Province" />
+ <result property="PostalCode" column="Order_PostalCode" />
+ </resultMap>
+
+ <resultMap id="lite-order-result-by-index" class="Order">
+ <result property="Id" column="Order_Id" columnIndex="0"/>
+ <result property="Date" column="Order_Date" type="date" columnIndex="1" />
+ <result property="CardExpiry" column="Order_CardExpiry" columnIndex="2"/>
+ <result property="CardType" column="Order_CardType" columnIndex="3" />
+ <result property="CardNumber" column="Order_CardNumber" columnIndex="4" />
+ <result property="Street" column="Order_Street" columnIndex="5" />
+ <result property="City" column="Order_City" columnIndex="6" />
+ <result property="Province" column="Order_Province" columnIndex="7"/>
+ <result property="PostalCode" column="Order_PostalCode" columnIndex="8" />
+ </resultMap>
+
+ <resultMap id="order-with-account-result" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="Account" column="Account_Id" select="GetAccountViaColumnName" />
+ </resultMap>
+
+ <resultMap id="order-with-collection-result" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="LineItemsList" column="Order_Id" select="GetLineItemsForOrder" />
+ <result property="LineItems" column="Order_Id" select="GetLineItemsForOrder" lazyLoad="false" />
+ </resultMap>
+
+ <resultMap id="order-with-favourite-line-item" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem"
+ column="Order_ID=Order_Id,LineItem_ID=Order_FavouriteLineItem"
+ select="GetSpecificLineItem" />
+ </resultMap>
+
+ <resultMap id="order-with-dyn-favourite-line-item" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem"
+ column="Order_ID=Order_Id,LineItem_ID=Order_FavouriteLineItem"
+ select="GetDynSpecificLineItem" />
+ </resultMap>
+
+ <resultMap id="order-joined-favourite" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem" resultMapping="LineItem" />
+ </resultMap>
+
+ <resultMap id="order-joined-favourite2" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="FavouriteLineItem.Id" column="LineItem_Id"/>
+ <result property="FavouriteLineItem.Code" column="LineItem_Code"/>
+ <result property="FavouriteLineItem.Quantity" column="LineItem_Quantity"/>
+ <result property="FavouriteLineItem.Price" column="LineItem_Price"/>
+ </resultMap>
+
+ <resultMap id="order-joined-with-account" class="Order">
+ <result property="Id" column="Order_Id"/>
+ <result property="Date" type="date" column="Order_Date" nullValue="01/01/0001 00:00:00"/>
+ <result property="CardExpiry" column="Order_CardExpiry"/>
+ <result property="CardType" column="Order_CardType"/>
+ <result property="CardNumber" column="Order_CardNumber"/>
+ <result property="Street" column="Order_Street"/>
+ <result property="City" column="Order_City"/>
+ <result property="Province" column="Order_Province"/>
+ <result property="PostalCode" column="Order_PostalCode"/>
+ <result property="Account" resultMapping="account-result-nullable-email" />
+ </resultMap>
+
+ <statement id="GetOrderLiteByColumnName"
+ parameterClass="integer"
+ resultMap="lite-order-result-by-name" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderByHashTable"
+ parameterClass="Int"
+ resultMap="order-hash" >
+ select Order_Date from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderLiteByColumnIndex"
+ parameterClass="Int"
+ resultMap="lite-order-result-by-index" >
+ select
+ Order_Id,
+ Order_Date,
+ Order_CardExpiry,
+ Order_CardType,
+ Order_CardNumber,
+ Order_Street,
+ Order_City,
+ Order_Province,
+ Order_PostalCode
+ from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithTypes"
+ parameterClass="Int"
+ resultMap="order-with-types-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItems"
+ parameterClass="Integer"
+ ListClass="TList"
+ resultMap="order-with-lines-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+
+ <statement id="GetOrderWithLineItemsNoLazyLoad"
+ parameterClass="Integer"
+ resultMap="order-with-lines-result-no-lazy-load" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemsUsingStatementNamespaces"
+ parameterClass="Integer"
+ resultMap="order-with-lines-result-statement-namespaces" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetAllOrderWithLineItems"
+ resultMap="order-with-lines-result" >
+ select * from Orders
+ </statement>
+
+ <statement id="GetOrderCardExpiryViaResultClass"
+ parameterClass="int"
+ resultClass="date">
+ select
+ Order_Date as 'datetime'
+ from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithAccount"
+ parameterClass="int"
+ resultMap="order-with-account-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemsCollection"
+ parameterClass="Integer"
+ resultMap="order-with-collection-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite"
+ parameterClass="Integer"
+ resultMap="order-joined-favourite" >
+ select
+ Orders.Order_Id as Order_Id,
+ Orders.Account_Id as Account_Id,
+ Orders.Order_Date as Order_Date,
+ Orders.Order_CardType as Order_CardType,
+ Orders.Order_CardNumber as Order_CardNumber,
+ Orders.Order_CardExpiry as Order_CardExpiry,
+ Orders.Order_Street as Order_Street,
+ Orders.Order_City as Order_City,
+ Orders.Order_Province as Order_Province,
+ Orders.Order_PostalCode as Order_PostalCode,
+ Orders.Order_FavouriteLineItem as Order_FavouriteLineItem,
+ LineItems.LineItem_Id as LineItem_Id,
+ LineItems.Order_Id as Order_Id,
+ LineItems.LineItem_Code as LineItem_Code,
+ LineItems.LineItem_Quantity as LineItem_Quantity,
+ LineItems.LineItem_Price as LineItem_Price,
+ LineItems.LineItem_Picture as LineItem_Picture
+
+ from Orders, LineItems
+ where Orders.Order_Id = LineItems.Order_Id
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite2"
+ parameterClass="Integer"
+ resultMap="order-joined-favourite2" >
+ select
+
+ Orders.Order_Id as Order_Id,
+ Orders.Account_Id as Account_Id,
+ Orders.Order_Date as Order_Date,
+ Orders.Order_CardType as Order_CardType,
+ Orders.Order_CardNumber as Order_CardNumber,
+ Orders.Order_CardExpiry as Order_CardExpiry,
+ Orders.Order_Street as Order_Street,
+ Orders.Order_City as Order_City,
+ Orders.Order_Province as Order_Province,
+ Orders.Order_PostalCode as Order_PostalCode,
+ Orders.Order_FavouriteLineItem as Order_FavouriteLineItem,
+ LineItems.LineItem_Id as LineItem_Id,
+ LineItems.Order_Id as Order_Id,
+ LineItems.LineItem_Code as LineItem_Code,
+ LineItems.LineItem_Quantity as LineItem_Quantity,
+ LineItems.LineItem_Price as LineItem_Price,
+ LineItems.LineItem_Picture as LineItem_Picture
+
+ from Orders, LineItems
+ where Orders.Order_Id = LineItems.Order_Id
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderJoinedFavourite3"
+ parameterClass="Integer"
+ resultClass="Order" >
+ select
+ Orders.Order_Id as Id,
+ Order_Date as Date,
+ Order_CardExpiry as CardExpiry,
+ Order_CardType as CardType,
+ Order_CardNumber as CardNumber,
+ Order_Street as Street,
+ Order_City as City,
+ Order_Province as Province,
+ Order_PostalCode as PostalCode,
+ LineItem_ID as "FavouriteLineItem.Id",
+ LineItem_Code as "FavouriteLineItem.Code",
+ LineItem_Quantity as "FavouriteLineItem.Quantity",
+ LineItem_Price as "FavouriteLineItem.Price"
+ from Orders, LineItems
+ where Orders.Order_Id = LineItems.Order_Id
+ and Order_FavouriteLineItem = LineItems.LineItem_ID
+ and Orders.Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithFavouriteLineItem"
+ parameterClass="int"
+ resultMap="order-with-favourite-line-item" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemCollection"
+ parameterClass="int"
+ resultMap="order-with-lines-collection" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemCollectionNoLazy"
+ parameterClass="int"
+ resultMap="order-with-lines-collection-no-lazy-load" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderAsHastable"
+ parameterClass="Integer"
+ resultMap="lite-order-map-result" >
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetOrderWithLineItemArray"
+ parameterClass="int"
+ resultMap="order-with-lines-array">
+ select * from Orders where Order_Id = #value#
+ </statement>
+
+ <statement id="GetAllCreditCardNumbersFromOrders"
+ resultMap="credit-card-result" >
+ select distinct Order_CardNumber from Orders
+ order by Order_CardNumber
+ </statement>
+
+ <statement id="InsertOrderViaParameterMap"
+ parameterMap="order-insert-params-full" >
+ insert into Orders
+ (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ </statement>
+
+ <statement id="InsertOrderViaExtendParameterMap"
+ parameterMap="insert-extend" >
+ insert into Orders
+ (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ </statement>
+
+ <statement id="InsertOrderViaPublicFields">
+ insert into Orders
+ (Order_Id, Account_ID, Order_Date, Order_CardExpiry, Order_CardType,
+ Order_CardNumber, Order_Street, Order_City, Order_Province, Order_PostalCode )
+ values
+ (#Id#, #Account.Id#, #Date#, #CardExpiry#, #CardType#, #CardNumber#, #Street#, #City#, #Province#, #PostalCode#)
+ </statement>
+
+ <select id="GetOrderWithDynFavouriteLineItem"
+ parameterClass="Integer"
+ resultMap="order-with-dyn-favourite-line-item">
+ select * from Orders where Order_Id = #value#
+ </select>
+
+ <select id="SelectOrderByDate"
+ parameterClass="array"
+ resultMap="lite-order-result-by-name">
+ select * from Orders where Order_Date = #Foo#
+ </select>
+
+ <select id="SelectOrderByDateDynamic"
+ parameterClass="array"
+ resultMap="lite-order-result-by-name">
+ select * from Orders
+ where 1=1
+ <isNotEmpty prepend="AND" property="Foo">
+ (Order_Date = '$Foo$')
+ </isNotEmpty>
+ </select>
+
+ <select id="GetAccountJIRA45"
+ parameterClass="int"
+ resultMap="indexed-account-result">
+ select
+ Account_Id,
+ Account_FirstName,
+ Account_LastName,
+ Account_Email
+ from Accounts
+ where Account_ID = #value#
+ </select>
+
+ <select id="GetOrderJoinWithAccount"
+ parameterClass="Integer"
+ resultMap="order-joined-with-account">
+ select
+ Order_Id,
+ Order_Date,
+ Order_CardExpiry,
+ Order_CardType,
+ Order_CardNumber,
+ Order_Street,
+ Order_City,
+ Order_Province,
+ Order_PostalCode,
+ acc.Account_ID as Account_ID,
+ acc.Account_FirstName as Account_FirstName,
+ acc.Account_LastName as Account_LastName,
+ acc.Account_Email as Account_Email
+ from Orders as ord
+ LEFT OUTER JOIN Accounts as acc on acc.Account_ID = ord.Account_ID
+ where Order_Id = #value#
+ </select>
+
+ <parameterMap id="order-insert-params-full">
+ <parameter property="Id" dbType="Int32"/>
+ <parameter property="Account.Id"/>
+ <parameter property="Date" nullValue="0001-01-01 00:00:00" />
+ <parameter property="CardExpiry" />
+ <parameter property="CardType" />
+ <parameter property="CardNumber" />
+ <parameter property="Street" />
+ <parameter property="City" />
+ <parameter property="Province" />
+ <parameter property="PostalCode" />
+ </parameterMap>
+
+ <parameterMap id="params-parent"> <!-- 1043181 support request -->
+ <parameter property="Id" dbType="Int32"/>
+ <parameter property="Account.Id"/>
+ <parameter property="Date" nullValue="0001-01-01 00:00:00" />
+ <parameter property="CardExpiry" />
+ <parameter property="CardType" />
+ <parameter property="CardNumber" />
+ <parameter property="Street" />
+ <parameter property="City" />
+ <parameter property="Province" />
+ <parameter property="PostalCode" />
+ </parameterMap>
+
+ <parameterMap id="insert-extend" extends="params-parent">
+ </parameterMap>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/Other.xml b/tests/unit/Data/SqlMap/maps/sqlite/Other.xml
index 64893689..f8683f7e 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/Other.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/Other.xml
@@ -1,170 +1,170 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMap namespace="Other" >
-
- <resultMap id="other-result" class="Other" >
- <result property="Int" column="Other_Int"/>
- <result property="Long" column="Other_Long"/>
- <result property="Bool" column="Other_Bit"/>
- <result property="Bool2" column="Other_String" typeHandler="OuiNonBool"/>
- </resultMap>
-
- <resultMap id="other-result-V1" class="Other" >
- <result property="Int" column="Other_Int"/>
- <result property="Long" column="Other_Long"/>
- <result property="Bool" column="Other_Bit"/>
- <result property="Bool2" column="Other_String" />
- </resultMap>
-
- <resultMap id="A-result" class="A" >
- <result property="Id" column="A_ID"/>
- <result property="Libelle" column="A_Libelle"/>
- <result property="B" resultMapping="B-result"/>
- <result property="E" resultMapping="E-result"/>
- <result property="F" resultMapping="F-result"/>
- </resultMap>
-
- <resultMap id="B-result" class="B" >
- <result property="Id" column="B_ID"/>
- <result property="Libelle" column="B_Libelle"/>
- <result property="C" resultMapping="C-result"/>
- <result property="D" resultMapping="D-result"/>
- </resultMap>
-
- <resultMap id="C-result" class="C" >
- <result property="Id" column="C_ID"/>
- <result property="Libelle" column="C_Libelle"/>
- </resultMap>
-
- <resultMap id="D-result" class="D" >
- <result property="Id" column="D_ID"/>
- <result property="Libelle" column="D_Libelle"/>
- </resultMap>
-
- <resultMap id="E-result" class="E" >
- <result property="Id" column="E_ID"/>
- <result property="Libelle" column="E_Libelle"/>
- </resultMap>
-
- <resultMap id="F-result" class="F" >
- <result property="Id" column="F_ID"/>
- <result property="Libelle" column="F_Libelle"/>
- </resultMap>
-
- <select id="SelectComplexJoined" resultMap="A-result">
- SELECT
- A.Id AS A_ID,
- A.A_Libelle AS A_Libelle,
- B.ID AS B_ID,
- B.B_Libelle AS B_Libelle,
- C.ID AS C_ID,
- C.C_Libelle AS C_Libelle,
- D.ID AS D_ID,
- D.D_Libelle AS D_Libelle,
- E.ID AS E_ID,
- E.E_Libelle AS E_Libelle,
- F.ID AS F_ID,
- F.F_Libelle AS F_Libelle
- FROM A
- LEFT OUTER JOIN B ON A.B_ID = B.ID
- LEFT OUTER JOIN C ON B.C_ID = C.ID
- LEFT OUTER JOIN D ON B.D_ID = D.ID
- LEFT OUTER JOIN E ON A.E_ID = E.ID
- LEFT OUTER JOIN F ON A.F_ID = F.ID
- </select>
-
-
- <statement id="DynamicSelectByIntLong"
- parameterClass="Hashtable"
- resultMap="other-result">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- <dynamic prepend="WHERE">
- <isNotEqual prepend="AND" property="year" compareValue="0">
- Other_Int = #year#
- </isNotEqual>
-
- <isNotEqual prepend="AND" property="areaid" compareValue="0">
- Other_Long = #areaid#
- </isNotEqual>
- </dynamic>
- </statement>
-
- <statement id="DynamicSelectByBool"
- parameterClass="Other"
- resultMap="other-result">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- Where Other_Bit = #Bool#
- </statement>
-
- <statement id="InsertBool"
- parameterClass="Other">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( #Int#, #Long#, #Bool#, 'Yes')
- </statement>
-
- <statement id="InsertCustomTypeHandler"
- parameterMap="other-insert-params">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( ?, ?, ?, ?)
- </statement>
-
- <statement id="SelectByInt"
- parameterClass="int"
- resultMap="other-result">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- Where Other_Int = #value#
- </statement>
-
- <statement id="SelectByIntV1"
- parameterClass="int"
- resultMap="other-result-V1">
- select
- Other_Int,
- Other_Long,
- Other_Bit,
- Other_String
- from Others
- Where Other_Int = #value#
- </statement>
-
- <statement id="InsertInlineCustomTypeHandlerV1"
- parameterClass="Other">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( #Int#, #Long#, #Bool#, #Bool2,type=bool,dbType=Varchar#)
- </statement>
-
- <statement id="InsertInlineCustomTypeHandlerV2"
- parameterClass="Other">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit, Other_String )
- values
- ( #Int#, #Long#, #Bool#, #Bool2,typeHandler=OuiNonBool#)
- </statement>
-
- <parameterMap id="other-insert-params">
- <parameter property="Int" />
- <parameter property="Long" />
- <parameter property="Bool" />
- <parameter property="Bool2" typeHandler="OuiNonBool"/>
- </parameterMap>
-</sqlMap>
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMap namespace="Other" >
+
+ <resultMap id="other-result" class="Other" >
+ <result property="Int" column="Other_Int"/>
+ <result property="Long" column="Other_Long"/>
+ <result property="Bool" column="Other_Bit"/>
+ <result property="Bool2" column="Other_String" typeHandler="OuiNonBool"/>
+ </resultMap>
+
+ <resultMap id="other-result-V1" class="Other" >
+ <result property="Int" column="Other_Int"/>
+ <result property="Long" column="Other_Long"/>
+ <result property="Bool" column="Other_Bit"/>
+ <result property="Bool2" column="Other_String" />
+ </resultMap>
+
+ <resultMap id="A-result" class="A" >
+ <result property="Id" column="A_ID"/>
+ <result property="Libelle" column="A_Libelle"/>
+ <result property="B" resultMapping="B-result"/>
+ <result property="E" resultMapping="E-result"/>
+ <result property="F" resultMapping="F-result"/>
+ </resultMap>
+
+ <resultMap id="B-result" class="B" >
+ <result property="Id" column="B_ID"/>
+ <result property="Libelle" column="B_Libelle"/>
+ <result property="C" resultMapping="C-result"/>
+ <result property="D" resultMapping="D-result"/>
+ </resultMap>
+
+ <resultMap id="C-result" class="C" >
+ <result property="Id" column="C_ID"/>
+ <result property="Libelle" column="C_Libelle"/>
+ </resultMap>
+
+ <resultMap id="D-result" class="D" >
+ <result property="Id" column="D_ID"/>
+ <result property="Libelle" column="D_Libelle"/>
+ </resultMap>
+
+ <resultMap id="E-result" class="E" >
+ <result property="Id" column="E_ID"/>
+ <result property="Libelle" column="E_Libelle"/>
+ </resultMap>
+
+ <resultMap id="F-result" class="F" >
+ <result property="Id" column="F_ID"/>
+ <result property="Libelle" column="F_Libelle"/>
+ </resultMap>
+
+ <select id="SelectComplexJoined" resultMap="A-result">
+ SELECT
+ A.Id AS A_ID,
+ A.A_Libelle AS A_Libelle,
+ B.ID AS B_ID,
+ B.B_Libelle AS B_Libelle,
+ C.ID AS C_ID,
+ C.C_Libelle AS C_Libelle,
+ D.ID AS D_ID,
+ D.D_Libelle AS D_Libelle,
+ E.ID AS E_ID,
+ E.E_Libelle AS E_Libelle,
+ F.ID AS F_ID,
+ F.F_Libelle AS F_Libelle
+ FROM A
+ LEFT OUTER JOIN B ON A.B_ID = B.ID
+ LEFT OUTER JOIN C ON B.C_ID = C.ID
+ LEFT OUTER JOIN D ON B.D_ID = D.ID
+ LEFT OUTER JOIN E ON A.E_ID = E.ID
+ LEFT OUTER JOIN F ON A.F_ID = F.ID
+ </select>
+
+
+ <statement id="DynamicSelectByIntLong"
+ parameterClass="Hashtable"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ <dynamic prepend="WHERE">
+ <isNotEqual prepend="AND" property="year" compareValue="0">
+ Other_Int = #year#
+ </isNotEqual>
+
+ <isNotEqual prepend="AND" property="areaid" compareValue="0">
+ Other_Long = #areaid#
+ </isNotEqual>
+ </dynamic>
+ </statement>
+
+ <statement id="DynamicSelectByBool"
+ parameterClass="Other"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Bit = #Bool#
+ </statement>
+
+ <statement id="InsertBool"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, 'Yes')
+ </statement>
+
+ <statement id="InsertCustomTypeHandler"
+ parameterMap="other-insert-params">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( ?, ?, ?, ?)
+ </statement>
+
+ <statement id="SelectByInt"
+ parameterClass="int"
+ resultMap="other-result">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Int = #value#
+ </statement>
+
+ <statement id="SelectByIntV1"
+ parameterClass="int"
+ resultMap="other-result-V1">
+ select
+ Other_Int,
+ Other_Long,
+ Other_Bit,
+ Other_String
+ from Others
+ Where Other_Int = #value#
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,type=bool,dbType=Varchar#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit, Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,typeHandler=OuiNonBool#)
+ </statement>
+
+ <parameterMap id="other-insert-params">
+ <parameter property="Int" />
+ <parameter property="Long" />
+ <parameter property="Bool" />
+ <parameter property="Bool2" typeHandler="OuiNonBool"/>
+ </parameterMap>
+</sqlMap>
diff --git a/tests/simple_unit/SqlMap/maps/sqlite/ResultClass.xml b/tests/unit/Data/SqlMap/maps/sqlite/ResultClass.xml
index 37985ba7..8be5fcca 100644
--- a/tests/simple_unit/SqlMap/maps/sqlite/ResultClass.xml
+++ b/tests/unit/Data/SqlMap/maps/sqlite/ResultClass.xml
@@ -1,130 +1,130 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<sqlMap namespace="ResultClass" >
-
- <statement id="GetBoolean"
- parameterClass="Int"
- resultClass="bool" >
- select 1 from Orders where Order_ID = #dummy#
- </statement>
- <statement id="GetBooleanWithoutResultClass"
- parameterClass="Int"
- extends="GetBoolean">
- </statement>
-
- <statement id="GetByte"
- parameterClass="Int"
- resultClass="string" >
- select 155 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetByteWithoutResultClass"
- parameterClass="Int"
- extends="GetByte">
- </statement>
-
- <!--
- NOTE: Use MySql 4.0.2 or higher for "cast"
- -->
- <statement id="GetChar"
- parameterClass="Int"
- resultClass="string" >
- select 'a' from Orders where Order_ID = #value#
- </statement>
- <statement id="GetCharWithoutResultClass"
- parameterClass="Int"
- extends="GetChar">
- </statement>
-
- <statement id="GetDate"
- parameterClass="Int"
- resultClass="TDateTime" >
- select '2003-02-15 8:15:00' as datetime from Orders where Order_ID = #value#
- </statement>
- <statement id="GetDateWithoutResultClass"
- parameterClass="Int"
- extends="GetDate">
- </statement>
-
- <statement id="GetDecimal"
- parameterClass="Int"
- resultClass="float" >
- select 1.56 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetDecimalWithoutResultClass"
- parameterClass="Int"
- extends="GetDecimal">
- </statement>
-
- <statement id="GetDouble"
- parameterClass="Int"
- resultClass="float" >
- select 99.5 from Orders where Order_ID= #value#
- </statement>
- <statement id="GetDoubleWithoutResultClass"
- parameterClass="Int"
- extends="GetDouble">
- </statement>
-
- <!--
- Use binary for cast for MySql
- -->
- <statement id="GetGuid"
- parameterClass="Int"
- resultClass="guid" >
- select cast('CD5ABF17-4BBC-4C86-92F1-257735414CF4' as binary) from Orders where Order_ID = #value#
- </statement>
- <statement id="GetGuidWithoutResultClass" parameterClass="Int" extends="GetGuid">
- </statement>
-
- <statement id="GetInt16"
- parameterClass="Int"
- resultClass="int" >
- select 32111 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetInt16WithoutResultClass"
- parameterClass="Int"
- extends="GetInt16">
- </statement>
-
- <statement id="GetInt32"
- parameterClass="Int"
- resultClass="int" >
- select 999999 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetInt32WithoutResultClass"
- parameterClass="Int"
- extends="GetInt32">
- </statement>
-
- <statement id="GetInt64"
- parameterClass="Int"
- resultClass="double" >
- select 9223372036854775800 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetInt64WithoutResultClass"
- parameterClass="Int"
- extends="GetInt64">
- </statement>
-
- <statement id="GetSingle"
- parameterClass="Int"
- resultClass="float" >
- select 92233.5 from Orders where Order_ID = #value#
- </statement>
- <statement id="GetSingleWithoutResultClass"
- parameterClass="Int"
- extends="GetSingle">
- </statement>
-
- <statement id="GetString"
- parameterClass="Int"
- resultClass="string" >
- select 'VISA'
- from Orders where Order_ID = #value#
- </statement>
- <statement id="GetStringWithoutResultClass"
- parameterClass="Int"
- extends="GetString">
- </statement>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<sqlMap namespace="ResultClass" >
+
+ <statement id="GetBoolean"
+ parameterClass="Int"
+ resultClass="bool" >
+ select 1 from Orders where Order_ID = #dummy#
+ </statement>
+ <statement id="GetBooleanWithoutResultClass"
+ parameterClass="Int"
+ extends="GetBoolean">
+ </statement>
+
+ <statement id="GetByte"
+ parameterClass="Int"
+ resultClass="string" >
+ select 155 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetByteWithoutResultClass"
+ parameterClass="Int"
+ extends="GetByte">
+ </statement>
+
+ <!--
+ NOTE: Use MySql 4.0.2 or higher for "cast"
+ -->
+ <statement id="GetChar"
+ parameterClass="Int"
+ resultClass="string" >
+ select 'a' from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetCharWithoutResultClass"
+ parameterClass="Int"
+ extends="GetChar">
+ </statement>
+
+ <statement id="GetDate"
+ parameterClass="Int"
+ resultClass="TDateTime" >
+ select '2003-02-15 8:15:00' as datetime from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetDateWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDate">
+ </statement>
+
+ <statement id="GetDecimal"
+ parameterClass="Int"
+ resultClass="float" >
+ select 1.56 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetDecimalWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDecimal">
+ </statement>
+
+ <statement id="GetDouble"
+ parameterClass="Int"
+ resultClass="float" >
+ select 99.5 from Orders where Order_ID= #value#
+ </statement>
+ <statement id="GetDoubleWithoutResultClass"
+ parameterClass="Int"
+ extends="GetDouble">
+ </statement>
+
+ <!--
+ Use binary for cast for MySql
+ -->
+ <statement id="GetGuid"
+ parameterClass="Int"
+ resultClass="guid" >
+ select cast('CD5ABF17-4BBC-4C86-92F1-257735414CF4' as binary) from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetGuidWithoutResultClass" parameterClass="Int" extends="GetGuid">
+ </statement>
+
+ <statement id="GetInt16"
+ parameterClass="Int"
+ resultClass="int" >
+ select 32111 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt16WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt16">
+ </statement>
+
+ <statement id="GetInt32"
+ parameterClass="Int"
+ resultClass="int" >
+ select 999999 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt32WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt32">
+ </statement>
+
+ <statement id="GetInt64"
+ parameterClass="Int"
+ resultClass="double" >
+ select 9223372036854775800 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetInt64WithoutResultClass"
+ parameterClass="Int"
+ extends="GetInt64">
+ </statement>
+
+ <statement id="GetSingle"
+ parameterClass="Int"
+ resultClass="float" >
+ select 92233.5 from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetSingleWithoutResultClass"
+ parameterClass="Int"
+ extends="GetSingle">
+ </statement>
+
+ <statement id="GetString"
+ parameterClass="Int"
+ resultClass="string" >
+ select 'VISA'
+ from Orders where Order_ID = #value#
+ </statement>
+ <statement id="GetStringWithoutResultClass"
+ parameterClass="Int"
+ extends="GetString">
+ </statement>
+
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/maps/tests.xml b/tests/unit/Data/SqlMap/maps/tests.xml
index 5e93cae4..d2f45c2f 100644
--- a/tests/simple_unit/SqlMap/maps/tests.xml
+++ b/tests/unit/Data/SqlMap/maps/tests.xml
@@ -1,19 +1,19 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<sqlmap>
-
-<statement id="test" parameterClass="array" >
- <![CDATA[
- SELECT a.*, b.*
- FROM img_request a
- left join hello_mst b on a.img_pat_id=b.pat_id
- WHERE (img_requested_ap_dt >= #fromdt# and img_requested_ap_dt <= #todt#)
- ]]>
-</statement>
-
-<select id="GetAllProgress" parameterClass="array" extends="test">
- <![CDATA[
- AND img_progress =#status#
- ]]>
-</select>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+<sqlmap>
+
+<statement id="test" parameterClass="array" >
+ <![CDATA[
+ SELECT a.*, b.*
+ FROM img_request a
+ left join hello_mst b on a.img_pat_id=b.pat_id
+ WHERE (img_requested_ap_dt >= #fromdt# and img_requested_ap_dt <= #todt#)
+ ]]>
+</statement>
+
+<select id="GetAllProgress" parameterClass="array" extends="test">
+ <![CDATA[
+ AND img_progress =#status#
+ ]]>
+</select>
+
</sqlmap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/mssql.xml b/tests/unit/Data/SqlMap/mssql.xml
index eae030b0..d2bec5d5 100644
--- a/tests/simple_unit/SqlMap/mssql.xml
+++ b/tests/unit/Data/SqlMap/mssql.xml
@@ -1,33 +1,33 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMapConfig>
-
- <properties resource="properties.config"/>
-
- <settings>
- <setting useStatementNamespaces="false"/>
- <setting cacheModelsEnabled="true"/>
- </settings>
-
- <!-- ==== Database configuration ========= -->
- <provider class="TAdodbProvider" >
- <!-- connection string set in common.php -->
- <datasource />
- </provider>
-
- <typeHandlers>
- <typeHandler type="bool" dbType="Varchar" callback="OuiNonBool"/>
- </typeHandlers>
-
- <sqlMaps>
- <sqlMap name="Account" resource="maps/mssql/Account.xml"/>
- <sqlMap name="DynamicAccount" resource="maps/mssql/DynamicAccount.xml"/>
- <sqlMap name="Order" resource="maps/mssql/Order.xml"/>
- <sqlMap name="Category" resource="maps/mssql/Category.xml"/>
- <sqlMap name="Complex" resource="maps/mssql/Complex.xml"/>
- <sqlMap name="LineItem" resource="maps/mssql/LineItem.xml"/>
- <sqlMap name="Enumeration" resource="maps/mssql/Enumeration.xml"/>
- <sqlMap name="Other" resource="maps/mssql/Other.xml"/>
- <sqlMap name="ResultClass" resource="maps/mssql/ResultClass.xml"/>
- <sqlMap name="Document" resource="maps/mssql/Document.xml"/>
- </sqlMaps>
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMapConfig>
+
+ <properties resource="properties.config"/>
+
+ <settings>
+ <setting useStatementNamespaces="false"/>
+ <setting cacheModelsEnabled="true"/>
+ </settings>
+
+ <!-- ==== Database configuration ========= -->
+ <provider class="TAdodbProvider" >
+ <!-- connection string set in common.php -->
+ <datasource />
+ </provider>
+
+ <typeHandlers>
+ <typeHandler type="bool" dbType="Varchar" callback="OuiNonBool"/>
+ </typeHandlers>
+
+ <sqlMaps>
+ <sqlMap name="Account" resource="maps/mssql/Account.xml"/>
+ <sqlMap name="DynamicAccount" resource="maps/mssql/DynamicAccount.xml"/>
+ <sqlMap name="Order" resource="maps/mssql/Order.xml"/>
+ <sqlMap name="Category" resource="maps/mssql/Category.xml"/>
+ <sqlMap name="Complex" resource="maps/mssql/Complex.xml"/>
+ <sqlMap name="LineItem" resource="maps/mssql/LineItem.xml"/>
+ <sqlMap name="Enumeration" resource="maps/mssql/Enumeration.xml"/>
+ <sqlMap name="Other" resource="maps/mssql/Other.xml"/>
+ <sqlMap name="ResultClass" resource="maps/mssql/ResultClass.xml"/>
+ <sqlMap name="Document" resource="maps/mssql/Document.xml"/>
+ </sqlMaps>
</sqlMapConfig> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/mysql.xml b/tests/unit/Data/SqlMap/mysql.xml
index 11d6e4bc..b4ac85b8 100644
--- a/tests/simple_unit/SqlMap/mysql.xml
+++ b/tests/unit/Data/SqlMap/mysql.xml
@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMapConfig>
-
- <properties>
- <property name="selectKey" value="select @@IDENTITY as value" />
- <property name="MyCategoryName" value="'Film'" />
- <property name="accountName" value="'Joe'" />
- </properties>
-
- <typeHandlers>
- <typeHandler dbType="Varchar" class="OuiNonBool"/>
- <typeHandler dbType="date" class="TDateTimeHandler" />
- </typeHandlers>
-
- <sqlMaps>
- <sqlMap name="Account" resource="maps/MySql/Account.xml"/>
- <sqlMap name="DynamicAccount" resource="maps/MySql/DynamicAccount.xml"/>
- <sqlMap name="Order" resource="maps/MySql/Order.xml"/>
- <sqlMap name="Category" resource="maps/MySql/Category.xml"/>
- <sqlMap name="Complex" resource="maps/MySql/Complex.xml"/>
- <sqlMap name="LineItem" resource="maps/MySql/LineItem.xml"/>
- <sqlMap name="Enumeration" resource="maps/MySql/Enumeration.xml"/>
- <sqlMap name="Other" resource="maps/MySql/Other.xml"/>
- <sqlMap name="ResultClass" resource="maps/MySql/ResultClass.xml"/>
- <sqlMap name="Document" resource="maps/MySql/Document.xml"/>
- <sqlMap resource="maps/MySql/ActiveRecord.xml"/>
- </sqlMaps>
-
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMapConfig>
+
+ <properties>
+ <property name="selectKey" value="select @@IDENTITY as value" />
+ <property name="MyCategoryName" value="'Film'" />
+ <property name="accountName" value="'Joe'" />
+ </properties>
+
+ <typeHandlers>
+ <typeHandler dbType="Varchar" class="OuiNonBool"/>
+ <typeHandler dbType="date" class="TDateTimeHandler" />
+ </typeHandlers>
+
+ <sqlMaps>
+ <sqlMap name="Account" resource="maps/MySql/Account.xml"/>
+ <sqlMap name="DynamicAccount" resource="maps/MySql/DynamicAccount.xml"/>
+ <sqlMap name="Order" resource="maps/MySql/Order.xml"/>
+ <sqlMap name="Category" resource="maps/MySql/Category.xml"/>
+ <sqlMap name="Complex" resource="maps/MySql/Complex.xml"/>
+ <sqlMap name="LineItem" resource="maps/MySql/LineItem.xml"/>
+ <sqlMap name="Enumeration" resource="maps/MySql/Enumeration.xml"/>
+ <sqlMap name="Other" resource="maps/MySql/Other.xml"/>
+ <sqlMap name="ResultClass" resource="maps/MySql/ResultClass.xml"/>
+ <sqlMap name="Document" resource="maps/MySql/Document.xml"/>
+ <sqlMap resource="maps/MySql/ActiveRecord.xml"/>
+ </sqlMaps>
+
</sqlMapConfig> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/properties.config b/tests/unit/Data/SqlMap/properties.config
index 2c46e756..4906531e 100644
--- a/tests/simple_unit/SqlMap/properties.config
+++ b/tests/unit/Data/SqlMap/properties.config
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<settings>
-
- <add key="selectKey" value="select @@IDENTITY as value" />
- <add key="MyCategoryName" value="'Film'" />
- <add key="accountName" value="'Joe'" />
-
-</settings>
+<?xml version="1.0" encoding="utf-8" ?>
+<settings>
+
+ <add key="selectKey" value="select @@IDENTITY as value" />
+ <add key="MyCategoryName" value="'Film'" />
+ <add key="accountName" value="'Joe'" />
+
+</settings>
diff --git a/tests/simple_unit/SqlMap/queryForListLimitTest.php b/tests/unit/Data/SqlMap/queryForListLimitTest.php
index af550dcb..7038dc68 100644
--- a/tests/simple_unit/SqlMap/queryForListLimitTest.php
+++ b/tests/unit/Data/SqlMap/queryForListLimitTest.php
@@ -3,7 +3,7 @@
require_once(dirname(__FILE__).'/BaseCase.php');
/**
- * @package System.DataAccess.SQLMap
+ * @package System.Data.SqlMap
*/
class queryForListLimitTest extends BaseCase
{
diff --git a/tests/simple_unit/SqlMap/resources/data.db b/tests/unit/Data/SqlMap/resources/data.db
index b8c158cc..b8c158cc 100644
--- a/tests/simple_unit/SqlMap/resources/data.db
+++ b/tests/unit/Data/SqlMap/resources/data.db
Binary files differ
diff --git a/tests/simple_unit/SqlMap/resources/person.xml b/tests/unit/Data/SqlMap/resources/person.xml
index f5db33f9..b4d93960 100644
--- a/tests/simple_unit/SqlMap/resources/person.xml
+++ b/tests/unit/Data/SqlMap/resources/person.xml
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<sqlMap namespace="Person" >
-
- <typeAlias alias="Person" type="Person" />
-
- <resultMap id="SelectResult" class="Person">
- <result property="ID" column="per_id" />
- <result property="FirstName" column="per_first_name" />
- <result property="LastName" column="per_last_name" />
- <result property="BirthDate" column="per_birth_date" />
- <result property="WeightInKilograms" column="per_weight_kg" />
- <result property="HeightInMeters" column="per_height_m" />
- </resultMap>
-
- <select id="Person.SelectAll" resultMap="SelectResult">
- SELECT
- per_id,
- per_first_name,
- per_last_name,
- per_birth_date,
- per_weight_kg,
- per_height_m
- FROM
- person
- </select>
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="Person" >
+
+ <typeAlias alias="Person" type="Person" />
+
+ <resultMap id="SelectResult" class="Person">
+ <result property="ID" column="per_id" />
+ <result property="FirstName" column="per_first_name" />
+ <result property="LastName" column="per_last_name" />
+ <result property="BirthDate" column="per_birth_date" />
+ <result property="WeightInKilograms" column="per_weight_kg" />
+ <result property="HeightInMeters" column="per_height_m" />
+ </resultMap>
+
+ <select id="Person.SelectAll" resultMap="SelectResult">
+ SELECT
+ per_id,
+ per_first_name,
+ per_last_name,
+ per_birth_date,
+ per_weight_kg,
+ per_height_m
+ FROM
+ person
+ </select>
</sqlMap> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/resources/sqlmap.xml b/tests/unit/Data/SqlMap/resources/sqlmap.xml
index 3d20321d..ee24a3ef 100644
--- a/tests/simple_unit/SqlMap/resources/sqlmap.xml
+++ b/tests/unit/Data/SqlMap/resources/sqlmap.xml
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<sqlMapConfig>
-
- <provider class="TAdodb">
- <datasource driver="sqlite" host="resources/test.db" />
- </provider>
-
- <sqlMaps>
- <sqlMap id="Person" resource="person.xml"/>
- </sqlMaps>
-
+<?xml version="1.0" encoding="UTF-8" ?>
+<sqlMapConfig>
+
+ <provider class="TAdodb">
+ <datasource driver="sqlite" host="resources/test.db" />
+ </provider>
+
+ <sqlMaps>
+ <sqlMap id="Person" resource="person.xml"/>
+ </sqlMaps>
+
</sqlMapConfig> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/resources/test.db b/tests/unit/Data/SqlMap/resources/test.db
index b8c158cc..b8c158cc 100644
--- a/tests/simple_unit/SqlMap/resources/test.db
+++ b/tests/unit/Data/SqlMap/resources/test.db
Binary files differ
diff --git a/tests/simple_unit/SqlMap/resources/tests.db b/tests/unit/Data/SqlMap/resources/tests.db
index e69de29b..e69de29b 100644
--- a/tests/simple_unit/SqlMap/resources/tests.db
+++ b/tests/unit/Data/SqlMap/resources/tests.db
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/DBCreation.sql b/tests/unit/Data/SqlMap/scripts/mssql/DBCreation.sql
index c5ed9517..b4e017d7 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/DBCreation.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/DBCreation.sql
@@ -1,89 +1,89 @@
--- MSQL DATABASE
-
-IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'IBatisNet')
- DROP DATABASE [IBatisNet]
-GO
-
-CREATE DATABASE [IBatisNet]
- COLLATE Latin1_General_CI_AS
-GO
-
-exec sp_dboption N'IBatisNet', N'autoclose', N'true'
-GO
-
-exec sp_dboption N'IBatisNet', N'bulkcopy', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'trunc. log', N'true'
-GO
-
-exec sp_dboption N'IBatisNet', N'torn page detection', N'true'
-GO
-
-exec sp_dboption N'IBatisNet', N'read only', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'dbo use', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'single', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'autoshrink', N'true'
-GO
-
-exec sp_dboption N'IBatisNet', N'ANSI null default', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'recursive triggers', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'ANSI nulls', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'concat null yields null', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'cursor close on commit', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'default to local cursor', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'quoted identifier', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'ANSI warnings', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'auto create statistics', N'true'
-GO
-
-exec sp_dboption N'IBatisNet', N'auto update statistics', N'true'
-GO
-
-if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
- exec sp_dboption N'IBatisNet', N'db chaining', N'false'
-GO
-
-if exists (select * from master.dbo.syslogins where loginname = N'IBatisNet')
- exec sp_droplogin N'IBatisNet'
-GO
-
-use [IBatisNet]
-GO
-
-if not exists (select * from master.dbo.syslogins where loginname = N'IBatisNet')
-BEGIN
- declare @logindb nvarchar(132), @loginpass nvarchar(132), @loginlang nvarchar(132)
- select @logindb = N'IBatisNet', @loginpass=N'test', @loginlang = N'us_english'
- exec sp_addlogin N'IBatisNet', @loginpass, @logindb, @loginlang
-END
-GO
-
-if not exists (select * from dbo.sysusers where name = N'IBatisNet' and uid < 16382)
- EXEC sp_grantdbaccess N'IBatisNet', N'IBatisNet'
-GO
-
-exec sp_addrolemember N'db_owner', N'IBatisNet'
+-- MSQL DATABASE
+
+IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'IBatisNet')
+ DROP DATABASE [IBatisNet]
+GO
+
+CREATE DATABASE [IBatisNet]
+ COLLATE Latin1_General_CI_AS
+GO
+
+exec sp_dboption N'IBatisNet', N'autoclose', N'true'
+GO
+
+exec sp_dboption N'IBatisNet', N'bulkcopy', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'trunc. log', N'true'
+GO
+
+exec sp_dboption N'IBatisNet', N'torn page detection', N'true'
+GO
+
+exec sp_dboption N'IBatisNet', N'read only', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'dbo use', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'single', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'autoshrink', N'true'
+GO
+
+exec sp_dboption N'IBatisNet', N'ANSI null default', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'recursive triggers', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'ANSI nulls', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'concat null yields null', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'cursor close on commit', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'default to local cursor', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'quoted identifier', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'ANSI warnings', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'auto create statistics', N'true'
+GO
+
+exec sp_dboption N'IBatisNet', N'auto update statistics', N'true'
+GO
+
+if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
+ exec sp_dboption N'IBatisNet', N'db chaining', N'false'
+GO
+
+if exists (select * from master.dbo.syslogins where loginname = N'IBatisNet')
+ exec sp_droplogin N'IBatisNet'
+GO
+
+use [IBatisNet]
+GO
+
+if not exists (select * from master.dbo.syslogins where loginname = N'IBatisNet')
+BEGIN
+ declare @logindb nvarchar(132), @loginpass nvarchar(132), @loginlang nvarchar(132)
+ select @logindb = N'IBatisNet', @loginpass=N'test', @loginlang = N'us_english'
+ exec sp_addlogin N'IBatisNet', @loginpass, @logindb, @loginlang
+END
+GO
+
+if not exists (select * from dbo.sysusers where name = N'IBatisNet' and uid < 16382)
+ EXEC sp_grantdbaccess N'IBatisNet', N'IBatisNet'
+GO
+
+exec sp_addrolemember N'db_owner', N'IBatisNet'
GO \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/DataBase.sql b/tests/unit/Data/SqlMap/scripts/mssql/DataBase.sql
index 733e2f99..75a1f974 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/DataBase.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/DataBase.sql
@@ -1,179 +1,179 @@
--- MSQL DATABASE 'IBatisNet'
-
-IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'IBatisNet')
- DROP DATABASE [IBatisNet]
-GO
-
-CREATE DATABASE [IBatisNet]
- COLLATE Latin1_General_CI_AS
-GO
-
-exec sp_dboption N'IBatisNet', N'autoclose', N'true'
-GO
-
-exec sp_dboption N'IBatisNet', N'bulkcopy', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'trunc. log', N'true'
-GO
-
-exec sp_dboption N'IBatisNet', N'torn page detection', N'true'
-GO
-
-exec sp_dboption N'IBatisNet', N'read only', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'dbo use', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'single', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'autoshrink', N'true'
-GO
-
-exec sp_dboption N'IBatisNet', N'ANSI null default', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'recursive triggers', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'ANSI nulls', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'concat null yields null', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'cursor close on commit', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'default to local cursor', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'quoted identifier', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'ANSI warnings', N'false'
-GO
-
-exec sp_dboption N'IBatisNet', N'auto create statistics', N'true'
-GO
-
-exec sp_dboption N'IBatisNet', N'auto update statistics', N'true'
-GO
-
-if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
- exec sp_dboption N'IBatisNet', N'db chaining', N'false'
-GO
-
-if exists (select * from master.dbo.syslogins where loginname = N'IBatisNet')
- exec sp_droplogin N'IBatisNet'
-GO
-
-use [IBatisNet]
-GO
-
-if not exists (select * from master.dbo.syslogins where loginname = N'IBatisNet')
-BEGIN
- declare @logindb nvarchar(132), @loginpass nvarchar(132), @loginlang nvarchar(132)
- select @logindb = N'IBatisNet', @loginpass=N'test', @loginlang = N'us_english'
- exec sp_addlogin N'IBatisNet', @loginpass, @logindb, @loginlang
-END
-GO
-
-if not exists (select * from dbo.sysusers where name = N'IBatisNet' and uid < 16382)
- EXEC sp_grantdbaccess N'IBatisNet', N'IBatisNet'
-GO
-
-exec sp_addrolemember N'db_owner', N'IBatisNet'
-GO
-
--- MSQL DATABASE 'NHibernate'
-
-IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'NHibernate')
- DROP DATABASE [NHibernate]
-GO
-
-CREATE DATABASE [NHibernate]
- COLLATE Latin1_General_CI_AS
-GO
-
-exec sp_dboption N'NHibernate', N'autoclose', N'true'
-GO
-
-exec sp_dboption N'NHibernate', N'bulkcopy', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'trunc. log', N'true'
-GO
-
-exec sp_dboption N'NHibernate', N'torn page detection', N'true'
-GO
-
-exec sp_dboption N'NHibernate', N'read only', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'dbo use', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'single', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'autoshrink', N'true'
-GO
-
-exec sp_dboption N'NHibernate', N'ANSI null default', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'recursive triggers', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'ANSI nulls', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'concat null yields null', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'cursor close on commit', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'default to local cursor', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'quoted identifier', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'ANSI warnings', N'false'
-GO
-
-exec sp_dboption N'NHibernate', N'auto create statistics', N'true'
-GO
-
-exec sp_dboption N'NHibernate', N'auto update statistics', N'true'
-GO
-
-if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
- exec sp_dboption N'NHibernate', N'db chaining', N'false'
-GO
-
-if exists (select * from master.dbo.syslogins where loginname = N'NHibernate')
- exec sp_droplogin N'NHibernate'
-GO
-
-use [NHibernate]
-GO
-
-if not exists (select * from master.dbo.syslogins where loginname = N'NHibernate')
-BEGIN
- declare @logindb nvarchar(132), @loginpass nvarchar(132), @loginlang nvarchar(132)
- select @logindb = N'NHibernate', @loginpass=N'test', @loginlang = N'us_english'
- exec sp_addlogin N'NHibernate', @loginpass, @logindb, @loginlang
-END
-GO
-
-if not exists (select * from dbo.sysusers where name = N'NHibernate' and uid < 16382)
- EXEC sp_grantdbaccess N'NHibernate', N'NHibernate'
-GO
-
-exec sp_addrolemember N'db_owner', N'NHibernate'
+-- MSQL DATABASE 'IBatisNet'
+
+IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'IBatisNet')
+ DROP DATABASE [IBatisNet]
+GO
+
+CREATE DATABASE [IBatisNet]
+ COLLATE Latin1_General_CI_AS
+GO
+
+exec sp_dboption N'IBatisNet', N'autoclose', N'true'
+GO
+
+exec sp_dboption N'IBatisNet', N'bulkcopy', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'trunc. log', N'true'
+GO
+
+exec sp_dboption N'IBatisNet', N'torn page detection', N'true'
+GO
+
+exec sp_dboption N'IBatisNet', N'read only', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'dbo use', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'single', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'autoshrink', N'true'
+GO
+
+exec sp_dboption N'IBatisNet', N'ANSI null default', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'recursive triggers', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'ANSI nulls', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'concat null yields null', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'cursor close on commit', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'default to local cursor', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'quoted identifier', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'ANSI warnings', N'false'
+GO
+
+exec sp_dboption N'IBatisNet', N'auto create statistics', N'true'
+GO
+
+exec sp_dboption N'IBatisNet', N'auto update statistics', N'true'
+GO
+
+if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
+ exec sp_dboption N'IBatisNet', N'db chaining', N'false'
+GO
+
+if exists (select * from master.dbo.syslogins where loginname = N'IBatisNet')
+ exec sp_droplogin N'IBatisNet'
+GO
+
+use [IBatisNet]
+GO
+
+if not exists (select * from master.dbo.syslogins where loginname = N'IBatisNet')
+BEGIN
+ declare @logindb nvarchar(132), @loginpass nvarchar(132), @loginlang nvarchar(132)
+ select @logindb = N'IBatisNet', @loginpass=N'test', @loginlang = N'us_english'
+ exec sp_addlogin N'IBatisNet', @loginpass, @logindb, @loginlang
+END
+GO
+
+if not exists (select * from dbo.sysusers where name = N'IBatisNet' and uid < 16382)
+ EXEC sp_grantdbaccess N'IBatisNet', N'IBatisNet'
+GO
+
+exec sp_addrolemember N'db_owner', N'IBatisNet'
+GO
+
+-- MSQL DATABASE 'NHibernate'
+
+IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'NHibernate')
+ DROP DATABASE [NHibernate]
+GO
+
+CREATE DATABASE [NHibernate]
+ COLLATE Latin1_General_CI_AS
+GO
+
+exec sp_dboption N'NHibernate', N'autoclose', N'true'
+GO
+
+exec sp_dboption N'NHibernate', N'bulkcopy', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'trunc. log', N'true'
+GO
+
+exec sp_dboption N'NHibernate', N'torn page detection', N'true'
+GO
+
+exec sp_dboption N'NHibernate', N'read only', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'dbo use', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'single', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'autoshrink', N'true'
+GO
+
+exec sp_dboption N'NHibernate', N'ANSI null default', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'recursive triggers', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'ANSI nulls', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'concat null yields null', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'cursor close on commit', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'default to local cursor', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'quoted identifier', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'ANSI warnings', N'false'
+GO
+
+exec sp_dboption N'NHibernate', N'auto create statistics', N'true'
+GO
+
+exec sp_dboption N'NHibernate', N'auto update statistics', N'true'
+GO
+
+if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion & 0xffff >= 724) ) or ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
+ exec sp_dboption N'NHibernate', N'db chaining', N'false'
+GO
+
+if exists (select * from master.dbo.syslogins where loginname = N'NHibernate')
+ exec sp_droplogin N'NHibernate'
+GO
+
+use [NHibernate]
+GO
+
+if not exists (select * from master.dbo.syslogins where loginname = N'NHibernate')
+BEGIN
+ declare @logindb nvarchar(132), @loginpass nvarchar(132), @loginlang nvarchar(132)
+ select @logindb = N'NHibernate', @loginpass=N'test', @loginlang = N'us_english'
+ exec sp_addlogin N'NHibernate', @loginpass, @logindb, @loginlang
+END
+GO
+
+if not exists (select * from dbo.sysusers where name = N'NHibernate' and uid < 16382)
+ EXEC sp_grantdbaccess N'NHibernate', N'NHibernate'
+GO
+
+exec sp_addrolemember N'db_owner', N'NHibernate'
GO \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/README-embed-param.txt b/tests/unit/Data/SqlMap/scripts/mssql/README-embed-param.txt
index 355ebf42..639e61a8 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/README-embed-param.txt
+++ b/tests/unit/Data/SqlMap/scripts/mssql/README-embed-param.txt
@@ -1,8 +1,8 @@
-Technique for creating large sample test data from:
-
-http://www.sql-server-performance.com/jc_large_data_operations.asp
-
-Make sure you have enough space and have either enough processing power or
-enough patience to run the Embed Parameters in Statement tests.
-
-Run embed-parameters-setup-init.sql prior to running tests.
+Technique for creating large sample test data from:
+
+http://www.sql-server-performance.com/jc_large_data_operations.asp
+
+Make sure you have enough space and have either enough processing power or
+enough patience to run the Embed Parameters in Statement tests.
+
+Run embed-parameters-setup-init.sql prior to running tests.
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/account-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/account-init.sql
index 8334798b..4b8e3ece 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/account-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/account-init.sql
@@ -1,47 +1,47 @@
--- Creating Table
-
-use [IBatisNet]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Accounts]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Orders_Accounts]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
- ALTER TABLE [dbo].[Orders] DROP CONSTRAINT FK_Orders_Accounts
-
- drop table [dbo].[Accounts]
-END
-
-CREATE TABLE [dbo].[Accounts] (
- [Account_ID] [int] NOT NULL ,
- [Account_FirstName] [varchar] (32) NOT NULL ,
- [Account_LastName] [varchar] (32) NOT NULL ,
- [Account_Email] [varchar] (128) NULL,
- [Account_Banner_Option] [varchar] (255),
- [Account_Cart_Option] [int]
-) ON [PRIMARY]
-
-ALTER TABLE [dbo].[Accounts] WITH NOCHECK ADD
- CONSTRAINT [PK_Account] PRIMARY KEY CLUSTERED
- (
- [Account_ID]
- ) ON [PRIMARY]
-
--- Creating Test Data
-
-INSERT INTO [dbo].[Accounts] VALUES(1,'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', 200);
-INSERT INTO [dbo].[Accounts] VALUES(2,'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', 200);
-INSERT INTO [dbo].[Accounts] VALUES(3,'William', 'Dalton', null, 'Non', 100);
-INSERT INTO [dbo].[Accounts] VALUES(4,'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', 100);
-INSERT INTO [dbo].[Accounts] VALUES(5,'Gilles', 'Bayon', null, 'Oui', 100);
-
--- Store procedure
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_InsertAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
-drop procedure [dbo].[ps_InsertAccount]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_SelectAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
-drop procedure [dbo].[ps_SelectAccount]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_swap_email_address]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
-drop procedure [dbo].[ps_swap_email_address]
-
-
+-- Creating Table
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Accounts]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Orders_Accounts]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
+ ALTER TABLE [dbo].[Orders] DROP CONSTRAINT FK_Orders_Accounts
+
+ drop table [dbo].[Accounts]
+END
+
+CREATE TABLE [dbo].[Accounts] (
+ [Account_ID] [int] NOT NULL ,
+ [Account_FirstName] [varchar] (32) NOT NULL ,
+ [Account_LastName] [varchar] (32) NOT NULL ,
+ [Account_Email] [varchar] (128) NULL,
+ [Account_Banner_Option] [varchar] (255),
+ [Account_Cart_Option] [int]
+) ON [PRIMARY]
+
+ALTER TABLE [dbo].[Accounts] WITH NOCHECK ADD
+ CONSTRAINT [PK_Account] PRIMARY KEY CLUSTERED
+ (
+ [Account_ID]
+ ) ON [PRIMARY]
+
+-- Creating Test Data
+
+INSERT INTO [dbo].[Accounts] VALUES(1,'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', 200);
+INSERT INTO [dbo].[Accounts] VALUES(2,'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', 200);
+INSERT INTO [dbo].[Accounts] VALUES(3,'William', 'Dalton', null, 'Non', 100);
+INSERT INTO [dbo].[Accounts] VALUES(4,'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', 100);
+INSERT INTO [dbo].[Accounts] VALUES(5,'Gilles', 'Bayon', null, 'Oui', 100);
+
+-- Store procedure
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_InsertAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
+drop procedure [dbo].[ps_InsertAccount]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_SelectAccount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
+drop procedure [dbo].[ps_SelectAccount]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_swap_email_address]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
+drop procedure [dbo].[ps_swap_email_address]
+
+
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/account-procedure.sql b/tests/unit/Data/SqlMap/scripts/mssql/account-procedure.sql
index a18e1522..fdb5c3d9 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/account-procedure.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/account-procedure.sql
@@ -1,12 +1,12 @@
-CREATE PROCEDURE dbo.[ps_InsertAccount]
-@Account_ID [int],
-@Account_FirstName [nvarchar] (40),
-@Account_LastName [varchar] (32),
-@Account_Email [varchar] (128),
-@Account_Banner_Option [varchar] (255),
-@Account_Cart_Option [int]
-AS
-insert into Accounts
- (Account_ID, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option)
-values
- (@Account_ID, @Account_FirstName, @Account_LastName, @Account_Email, @Account_Banner_Option, @Account_Cart_Option)
+CREATE PROCEDURE dbo.[ps_InsertAccount]
+@Account_ID [int],
+@Account_FirstName [nvarchar] (40),
+@Account_LastName [varchar] (32),
+@Account_Email [varchar] (128),
+@Account_Banner_Option [varchar] (255),
+@Account_Cart_Option [int]
+AS
+insert into Accounts
+ (Account_ID, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option)
+values
+ (@Account_ID, @Account_FirstName, @Account_LastName, @Account_Email, @Account_Banner_Option, @Account_Cart_Option)
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/category-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/category-init.sql
index c0d20603..d7a7cfa5 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/category-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/category-init.sql
@@ -1,17 +1,17 @@
--- Creating Table
-
-use [IBatisNet]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Categories]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-drop table [dbo].[Categories]
-
-CREATE TABLE [dbo].[Categories] (
- [Category_Id] [int] IDENTITY (1, 1) NOT NULL ,
- [Category_Name] [varchar] (32) NULL,
- [Category_Guid] [uniqueidentifier] NULL
-) ON [PRIMARY]
-
--- Store procedure
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_InsertCategorie]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
-drop procedure [dbo].[ps_InsertCategorie]
+-- Creating Table
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Categories]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+drop table [dbo].[Categories]
+
+CREATE TABLE [dbo].[Categories] (
+ [Category_Id] [int] IDENTITY (1, 1) NOT NULL ,
+ [Category_Name] [varchar] (32) NULL,
+ [Category_Guid] [uniqueidentifier] NULL
+) ON [PRIMARY]
+
+-- Store procedure
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_InsertCategorie]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
+drop procedure [dbo].[ps_InsertCategorie]
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/category-procedure.sql b/tests/unit/Data/SqlMap/scripts/mssql/category-procedure.sql
index 45fcda2c..bf565e87 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/category-procedure.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/category-procedure.sql
@@ -1,10 +1,10 @@
-CREATE PROCEDURE dbo.[ps_InsertCategorie]
-@Category_Id [int] output,
-@Category_Name [varchar] (32),
-@Category_Guid [uniqueidentifier]
-AS
-insert into Categories
- (Category_Name, Category_Guid )
-values
- (@Category_Name, @Category_Guid)
+CREATE PROCEDURE dbo.[ps_InsertCategorie]
+@Category_Id [int] output,
+@Category_Name [varchar] (32),
+@Category_Guid [uniqueidentifier]
+AS
+insert into Categories
+ (Category_Name, Category_Guid )
+values
+ (@Category_Name, @Category_Guid)
SELECT @Category_Id = SCOPE_IDENTITY() \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/documents-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/documents-init.sql
index 686a80ad..b268c258 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/documents-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/documents-init.sql
@@ -1,34 +1,34 @@
--- Creating Table
-
-use [IBatisNet]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Documents]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_LineItems_Orders]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
- ALTER TABLE [dbo].[LineItems] DROP CONSTRAINT FK_LineItems_Orders
-
- drop table [dbo].[Documents]
-END
-
-CREATE TABLE [dbo].[Documents] (
- [Document_ID] [int] NOT NULL ,
- [Document_Title] [varchar] (32) NULL ,
- [Document_Type] [varchar] (32) NULL ,
- [Document_PageNumber] [int] NULL ,
- [Document_City] [varchar] (32) NULL
-) ON [PRIMARY]
-
-ALTER TABLE [dbo].[Documents] WITH NOCHECK ADD
- CONSTRAINT [PK_Documents] PRIMARY KEY CLUSTERED
- (
- [Document_ID]
- ) ON [PRIMARY]
-
--- Creating Test Data
-
-INSERT INTO [dbo].[Documents] VALUES (1, 'The World of Null-A', 'Book', 55, null);
-INSERT INTO [dbo].[Documents] VALUES (2, 'Le Progres de Lyon', 'Newspaper', null , 'Lyon');
-INSERT INTO [dbo].[Documents] VALUES (3, 'Lord of the Rings', 'Book', 3587, null);
-INSERT INTO [dbo].[Documents] VALUES (4, 'Le Canard enchaine', 'Tabloid', null , 'Paris');
-INSERT INTO [dbo].[Documents] VALUES (5, 'Le Monde', 'Broadsheet', null , 'Paris');
-INSERT INTO [dbo].[Documents] VALUES (6, 'Foundation', 'Monograph', 557, null);
+-- Creating Table
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Documents]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_LineItems_Orders]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
+ ALTER TABLE [dbo].[LineItems] DROP CONSTRAINT FK_LineItems_Orders
+
+ drop table [dbo].[Documents]
+END
+
+CREATE TABLE [dbo].[Documents] (
+ [Document_ID] [int] NOT NULL ,
+ [Document_Title] [varchar] (32) NULL ,
+ [Document_Type] [varchar] (32) NULL ,
+ [Document_PageNumber] [int] NULL ,
+ [Document_City] [varchar] (32) NULL
+) ON [PRIMARY]
+
+ALTER TABLE [dbo].[Documents] WITH NOCHECK ADD
+ CONSTRAINT [PK_Documents] PRIMARY KEY CLUSTERED
+ (
+ [Document_ID]
+ ) ON [PRIMARY]
+
+-- Creating Test Data
+
+INSERT INTO [dbo].[Documents] VALUES (1, 'The World of Null-A', 'Book', 55, null);
+INSERT INTO [dbo].[Documents] VALUES (2, 'Le Progres de Lyon', 'Newspaper', null , 'Lyon');
+INSERT INTO [dbo].[Documents] VALUES (3, 'Lord of the Rings', 'Book', 3587, null);
+INSERT INTO [dbo].[Documents] VALUES (4, 'Le Canard enchaine', 'Tabloid', null , 'Paris');
+INSERT INTO [dbo].[Documents] VALUES (5, 'Le Monde', 'Broadsheet', null , 'Paris');
+INSERT INTO [dbo].[Documents] VALUES (6, 'Foundation', 'Monograph', 557, null);
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/embed-param-setup-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/embed-param-setup-init.sql
index de2c3f7b..c0bf20e8 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/embed-param-setup-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/embed-param-setup-init.sql
@@ -1,94 +1,94 @@
--- Technique for creating large sample test data from
--- http://www.sql-server-performance.com/jc_large_data_operations.asp
-
-use [IBatisNet]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ManyRecords]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-drop table [dbo].[ManyRecords]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ManyRecordsTest]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-drop table [dbo].[ManyRecordsTest]
-
-
-
--- Create Data Storage Table
-CREATE TABLE [dbo].[ManyRecords] (
- [Many_FirstID] [int] NOT NULL,
- [Many_SecondID] [int] NOT NULL,
- [Many_ThirdID] [int] NOT NULL,
- [Many_FourthID] [int] NOT NULL,
- [Many_FifthID] [int] NOT NULL,
- [Many_SequenceID] [int] NOT NULL,
- [Many_DistributedID] [int] NOT NULL,
- [Many_SampleCharValue] [char] (10) NOT NULL,
- [Many_SampleDecimal] [decimal] (9,4) NOT NULL,
- [Many_SampleMoney] [money] NOT NULL,
- [Many_SampleDate] [datetime] NOT NULL,
- [Many_SequenceDate] [datetime] NOT NULL )
-ON [PRIMARY]
-
-
-
--- Create Sample Data of 1 million records (increase if needed)
-BEGIN TRANSACTION
- DECLARE @intIndex int, @rowCount int, @seqCount int, @distValue int
- SELECT @intIndex = 1, @rowCount = 1000000, @seqCount = 10000
- SELECT @distValue = @rowCount/10000
-
- WHILE @intIndex <= @rowCount
- BEGIN
- INSERT INTO [dbo].[ManyRecords] (
- [Many_FirstID],
- [Many_SecondID],
- [Many_ThirdID],
- [Many_FourthID],
- [Many_FifthID],
- [Many_SequenceID],
- [Many_DistributedID],
- [Many_SampleCharValue],
- [Many_SampleDecimal],
- [Many_SampleMoney],
- [Many_SampleDate],
- [Many_SequenceDate] )
- VALUES (
- @intIndex, -- First
- @intIndex/2, -- Second
- @intIndex/4, -- Third
- @intIndex/10, -- Fourth
- @intIndex/20, -- Fifth
- (@intIndex-1)/@seqCount + 1, -- Sequential value
- (@intIndex-1)%(@distValue) + 1, -- Distributed value
- CHAR(65 + 26*rand())+CHAR(65 + 26*rand())+CHAR(65 + 26*rand())+CONVERT(char(6),CONVERT(int,100000*(9.0*rand()+1.0)))+CHAR(65 + 26*rand()), -- Char Value
- 10000*rand(), -- Decimal value
- 10000*rand(), -- Money value
- DATEADD(hour,100000*rand(),'1990-01-01'), -- Date value
- DATEADD(hour,@intIndex/5,'1990-01-01') ) -- Sequential date value
-
- SET @intIndex = @intIndex + 1
- END
-COMMIT TRANSACTION
-
-
-
--- Create Test table using storage table sample data
-SELECT
- [Many_FirstID],
- [Many_SecondID],
- [Many_ThirdID],
- [Many_FourthID],
- [Many_FifthID],
- [Many_SequenceID],
- [Many_DistributedID],
- [Many_SampleCharValue],
- [Many_SampleDecimal],
- [Many_SampleMoney],
- [Many_SampleDate],
- [Many_SequenceDate]
-INTO [dbo].[ManyRecordsTest]
-FROM [dbo].[ManyRecords]
-
-
-
--- Create Test table indexes
-CREATE INDEX [IDX_ManyRecordsTest_Seq] ON [dbo].[ManyRecordsTest] ([Many_SequenceID]) WITH SORT_IN_TEMPDB
+-- Technique for creating large sample test data from
+-- http://www.sql-server-performance.com/jc_large_data_operations.asp
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ManyRecords]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+drop table [dbo].[ManyRecords]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ManyRecordsTest]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+drop table [dbo].[ManyRecordsTest]
+
+
+
+-- Create Data Storage Table
+CREATE TABLE [dbo].[ManyRecords] (
+ [Many_FirstID] [int] NOT NULL,
+ [Many_SecondID] [int] NOT NULL,
+ [Many_ThirdID] [int] NOT NULL,
+ [Many_FourthID] [int] NOT NULL,
+ [Many_FifthID] [int] NOT NULL,
+ [Many_SequenceID] [int] NOT NULL,
+ [Many_DistributedID] [int] NOT NULL,
+ [Many_SampleCharValue] [char] (10) NOT NULL,
+ [Many_SampleDecimal] [decimal] (9,4) NOT NULL,
+ [Many_SampleMoney] [money] NOT NULL,
+ [Many_SampleDate] [datetime] NOT NULL,
+ [Many_SequenceDate] [datetime] NOT NULL )
+ON [PRIMARY]
+
+
+
+-- Create Sample Data of 1 million records (increase if needed)
+BEGIN TRANSACTION
+ DECLARE @intIndex int, @rowCount int, @seqCount int, @distValue int
+ SELECT @intIndex = 1, @rowCount = 1000000, @seqCount = 10000
+ SELECT @distValue = @rowCount/10000
+
+ WHILE @intIndex <= @rowCount
+ BEGIN
+ INSERT INTO [dbo].[ManyRecords] (
+ [Many_FirstID],
+ [Many_SecondID],
+ [Many_ThirdID],
+ [Many_FourthID],
+ [Many_FifthID],
+ [Many_SequenceID],
+ [Many_DistributedID],
+ [Many_SampleCharValue],
+ [Many_SampleDecimal],
+ [Many_SampleMoney],
+ [Many_SampleDate],
+ [Many_SequenceDate] )
+ VALUES (
+ @intIndex, -- First
+ @intIndex/2, -- Second
+ @intIndex/4, -- Third
+ @intIndex/10, -- Fourth
+ @intIndex/20, -- Fifth
+ (@intIndex-1)/@seqCount + 1, -- Sequential value
+ (@intIndex-1)%(@distValue) + 1, -- Distributed value
+ CHAR(65 + 26*rand())+CHAR(65 + 26*rand())+CHAR(65 + 26*rand())+CONVERT(char(6),CONVERT(int,100000*(9.0*rand()+1.0)))+CHAR(65 + 26*rand()), -- Char Value
+ 10000*rand(), -- Decimal value
+ 10000*rand(), -- Money value
+ DATEADD(hour,100000*rand(),'1990-01-01'), -- Date value
+ DATEADD(hour,@intIndex/5,'1990-01-01') ) -- Sequential date value
+
+ SET @intIndex = @intIndex + 1
+ END
+COMMIT TRANSACTION
+
+
+
+-- Create Test table using storage table sample data
+SELECT
+ [Many_FirstID],
+ [Many_SecondID],
+ [Many_ThirdID],
+ [Many_FourthID],
+ [Many_FifthID],
+ [Many_SequenceID],
+ [Many_DistributedID],
+ [Many_SampleCharValue],
+ [Many_SampleDecimal],
+ [Many_SampleMoney],
+ [Many_SampleDate],
+ [Many_SequenceDate]
+INTO [dbo].[ManyRecordsTest]
+FROM [dbo].[ManyRecords]
+
+
+
+-- Create Test table indexes
+CREATE INDEX [IDX_ManyRecordsTest_Seq] ON [dbo].[ManyRecordsTest] ([Many_SequenceID]) WITH SORT_IN_TEMPDB
CREATE INDEX [IDX_ManyRecordsTest_Dist] ON [dbo].[ManyRecordsTest] ([Many_DistributedID]) WITH SORT_IN_TEMPDB \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/embed-param-test-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/embed-param-test-init.sql
index 17affd8e..f776b158 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/embed-param-test-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/embed-param-test-init.sql
@@ -1,32 +1,32 @@
--- Technique for creating large sample test data from
--- http://www.sql-server-performance.com/jc_large_data_operations.asp
-
-use [IBatisNet]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ManyRecordsTest]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-drop table [dbo].[ManyRecordsTest]
-
-
-
--- Create Test table using storage table sample data
-SELECT
- [Many_FirstID],
- [Many_SecondID],
- [Many_ThirdID],
- [Many_FourthID],
- [Many_FifthID],
- [Many_SequenceID],
- [Many_DistributedID],
- [Many_SampleCharValue],
- [Many_SampleDecimal],
- [Many_SampleMoney],
- [Many_SampleDate],
- [Many_SequenceDate]
-INTO [dbo].[ManyRecordsTest]
-FROM [dbo].[ManyRecords]
-
-
-
--- Create Test table indexes
-CREATE INDEX [IDX_ManyRecordsTest_Seq] ON [dbo].[ManyRecordsTest] ([Many_SequenceID]) WITH SORT_IN_TEMPDB
+-- Technique for creating large sample test data from
+-- http://www.sql-server-performance.com/jc_large_data_operations.asp
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ManyRecordsTest]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+drop table [dbo].[ManyRecordsTest]
+
+
+
+-- Create Test table using storage table sample data
+SELECT
+ [Many_FirstID],
+ [Many_SecondID],
+ [Many_ThirdID],
+ [Many_FourthID],
+ [Many_FifthID],
+ [Many_SequenceID],
+ [Many_DistributedID],
+ [Many_SampleCharValue],
+ [Many_SampleDecimal],
+ [Many_SampleMoney],
+ [Many_SampleDate],
+ [Many_SequenceDate]
+INTO [dbo].[ManyRecordsTest]
+FROM [dbo].[ManyRecords]
+
+
+
+-- Create Test table indexes
+CREATE INDEX [IDX_ManyRecordsTest_Seq] ON [dbo].[ManyRecordsTest] ([Many_SequenceID]) WITH SORT_IN_TEMPDB
CREATE INDEX [IDX_ManyRecordsTest_Dist] ON [dbo].[ManyRecordsTest] ([Many_DistributedID]) WITH SORT_IN_TEMPDB \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/enumeration-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/enumeration-init.sql
index f5ed9af1..65b1e26f 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/enumeration-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/enumeration-init.sql
@@ -1,30 +1,30 @@
--- Creating Table
-
-use [IBatisNet]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Enumerations]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- drop table [dbo].[Enumerations]
-END
-
-CREATE TABLE [dbo].[Enumerations] (
- [Enum_ID] [int] NOT NULL ,
- [Enum_Day] [int] NOT NULL ,
- [Enum_Color] [int] NOT NULL,
- [Enum_Month] [int] NULL
-) ON [PRIMARY]
-
-ALTER TABLE [dbo].[Enumerations] WITH NOCHECK ADD
- CONSTRAINT [PK_Enum] PRIMARY KEY CLUSTERED
- (
- [Enum_ID]
- ) ON [PRIMARY]
-
--- Creating Test Data
-
-INSERT INTO [dbo].[Enumerations] VALUES(1, 1, 1, 128);
-INSERT INTO [dbo].[Enumerations] VALUES(2, 2, 2, 2048);
-INSERT INTO [dbo].[Enumerations] VALUES(3, 3, 4, 256);
-INSERT INTO [dbo].[Enumerations] VALUES(4, 4, 8, null);
-
-
+-- Creating Table
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Enumerations]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ drop table [dbo].[Enumerations]
+END
+
+CREATE TABLE [dbo].[Enumerations] (
+ [Enum_ID] [int] NOT NULL ,
+ [Enum_Day] [int] NOT NULL ,
+ [Enum_Color] [int] NOT NULL,
+ [Enum_Month] [int] NULL
+) ON [PRIMARY]
+
+ALTER TABLE [dbo].[Enumerations] WITH NOCHECK ADD
+ CONSTRAINT [PK_Enum] PRIMARY KEY CLUSTERED
+ (
+ [Enum_ID]
+ ) ON [PRIMARY]
+
+-- Creating Test Data
+
+INSERT INTO [dbo].[Enumerations] VALUES(1, 1, 1, 128);
+INSERT INTO [dbo].[Enumerations] VALUES(2, 2, 2, 2048);
+INSERT INTO [dbo].[Enumerations] VALUES(3, 3, 4, 256);
+INSERT INTO [dbo].[Enumerations] VALUES(4, 4, 8, null);
+
+
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/line-item-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/line-item-init.sql
index c823667b..e25a49dd 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/line-item-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/line-item-init.sql
@@ -1,53 +1,53 @@
--- Creating Table
-
-use [IBatisNet]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[LineItems]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-drop table [dbo].[LineItems]
-
-CREATE TABLE [dbo].[LineItems] (
- [LineItem_ID] [int] NOT NULL ,
- [Order_ID] [int] NOT NULL ,
- [LineItem_Code] [varchar] (32) NOT NULL ,
- [LineItem_Quantity] [int] NOT NULL ,
- [LineItem_Price] [decimal](18, 2) NULL,
- [LineItem_Picture] [image] null
-) ON [PRIMARY]
-
-ALTER TABLE [dbo].[LineItems] WITH NOCHECK ADD
- CONSTRAINT [PK_LinesItem] PRIMARY KEY CLUSTERED
- (
- [LineItem_ID],
- [Order_ID]
- ) ON [PRIMARY]
-
-ALTER TABLE [dbo].[LineItems] ADD
- CONSTRAINT [FK_LineItems_Orders] FOREIGN KEY
- (
- [Order_ID]
- ) REFERENCES [dbo].[Orders] (
- [Order_ID]
- )
--- Creating Test Data
-
-INSERT INTO [dbo].[LineItems] VALUES (1, 10, 'ESM-34', 1, 45.43, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 10, 'QSM-98', 8, 8.40, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 9, 'DSM-78', 2, 45.40, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 9, 'TSM-12', 2, 32.12, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 8, 'DSM-16', 4, 41.30, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 8, 'GSM-65', 1, 2.20, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 7, 'WSM-27', 7, 52.10, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 7, 'ESM-23', 2, 123.34, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 6, 'QSM-39', 9, 12.12, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 6, 'ASM-45', 6, 78.77, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 5, 'ESM-48', 3, 43.87, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 5, 'WSM-98', 7, 5.40, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 4, 'RSM-57', 2, 78.90, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 4, 'XSM-78', 9, 2.34, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 3, 'DSM-59', 3, 5.70, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 3, 'DSM-53', 3, 98.78, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 2, 'DSM-37', 4, 7.80, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 2, 'FSM-12', 2, 55.78, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 1, 'ESM-48', 8, 87.60, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 1, 'ESM-23', 1, 55.40, null);
-
+-- Creating Table
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[LineItems]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+drop table [dbo].[LineItems]
+
+CREATE TABLE [dbo].[LineItems] (
+ [LineItem_ID] [int] NOT NULL ,
+ [Order_ID] [int] NOT NULL ,
+ [LineItem_Code] [varchar] (32) NOT NULL ,
+ [LineItem_Quantity] [int] NOT NULL ,
+ [LineItem_Price] [decimal](18, 2) NULL,
+ [LineItem_Picture] [image] null
+) ON [PRIMARY]
+
+ALTER TABLE [dbo].[LineItems] WITH NOCHECK ADD
+ CONSTRAINT [PK_LinesItem] PRIMARY KEY CLUSTERED
+ (
+ [LineItem_ID],
+ [Order_ID]
+ ) ON [PRIMARY]
+
+ALTER TABLE [dbo].[LineItems] ADD
+ CONSTRAINT [FK_LineItems_Orders] FOREIGN KEY
+ (
+ [Order_ID]
+ ) REFERENCES [dbo].[Orders] (
+ [Order_ID]
+ )
+-- Creating Test Data
+
+INSERT INTO [dbo].[LineItems] VALUES (1, 10, 'ESM-34', 1, 45.43, null);
+INSERT INTO [dbo].[LineItems] VALUES (2, 10, 'QSM-98', 8, 8.40, null);
+INSERT INTO [dbo].[LineItems] VALUES (1, 9, 'DSM-78', 2, 45.40, null);
+INSERT INTO [dbo].[LineItems] VALUES (2, 9, 'TSM-12', 2, 32.12, null);
+INSERT INTO [dbo].[LineItems] VALUES (1, 8, 'DSM-16', 4, 41.30, null);
+INSERT INTO [dbo].[LineItems] VALUES (2, 8, 'GSM-65', 1, 2.20, null);
+INSERT INTO [dbo].[LineItems] VALUES (1, 7, 'WSM-27', 7, 52.10, null);
+INSERT INTO [dbo].[LineItems] VALUES (2, 7, 'ESM-23', 2, 123.34, null);
+INSERT INTO [dbo].[LineItems] VALUES (1, 6, 'QSM-39', 9, 12.12, null);
+INSERT INTO [dbo].[LineItems] VALUES (2, 6, 'ASM-45', 6, 78.77, null);
+INSERT INTO [dbo].[LineItems] VALUES (1, 5, 'ESM-48', 3, 43.87, null);
+INSERT INTO [dbo].[LineItems] VALUES (2, 5, 'WSM-98', 7, 5.40, null);
+INSERT INTO [dbo].[LineItems] VALUES (1, 4, 'RSM-57', 2, 78.90, null);
+INSERT INTO [dbo].[LineItems] VALUES (2, 4, 'XSM-78', 9, 2.34, null);
+INSERT INTO [dbo].[LineItems] VALUES (1, 3, 'DSM-59', 3, 5.70, null);
+INSERT INTO [dbo].[LineItems] VALUES (2, 3, 'DSM-53', 3, 98.78, null);
+INSERT INTO [dbo].[LineItems] VALUES (1, 2, 'DSM-37', 4, 7.80, null);
+INSERT INTO [dbo].[LineItems] VALUES (2, 2, 'FSM-12', 2, 55.78, null);
+INSERT INTO [dbo].[LineItems] VALUES (1, 1, 'ESM-48', 8, 87.60, null);
+INSERT INTO [dbo].[LineItems] VALUES (2, 1, 'ESM-23', 1, 55.40, null);
+
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/more-account-records.sql b/tests/unit/Data/SqlMap/scripts/mssql/more-account-records.sql
index d4b2199f..e526309d 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/more-account-records.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/more-account-records.sql
@@ -1,11 +1,11 @@
-
-
-
--- Creating Test Data
-
-INSERT INTO [dbo].[Accounts] VALUES(6,'Jane', 'Calamity', 'Jane.Calamity@somewhere.com', 'Oui', 200);
-INSERT INTO [dbo].[Accounts] VALUES(7,'Lucky', 'Luke', 'Lucky.Luke@somewhere.com', 'Oui', 200);
-INSERT INTO [dbo].[Accounts] VALUES(8,'Ming', 'Li Foo', null, 'Non', 100);
-INSERT INTO [dbo].[Accounts] VALUES(9,'O''Hara', 'Steve', 'Jack.OHara@somewhere.com', 'Oui', 200);
-INSERT INTO [dbo].[Accounts] VALUES(10,'Robert', 'O''Timmins', null, 'Non', 100);
-
+
+
+
+-- Creating Test Data
+
+INSERT INTO [dbo].[Accounts] VALUES(6,'Jane', 'Calamity', 'Jane.Calamity@somewhere.com', 'Oui', 200);
+INSERT INTO [dbo].[Accounts] VALUES(7,'Lucky', 'Luke', 'Lucky.Luke@somewhere.com', 'Oui', 200);
+INSERT INTO [dbo].[Accounts] VALUES(8,'Ming', 'Li Foo', null, 'Non', 100);
+INSERT INTO [dbo].[Accounts] VALUES(9,'O''Hara', 'Steve', 'Jack.OHara@somewhere.com', 'Oui', 200);
+INSERT INTO [dbo].[Accounts] VALUES(10,'Robert', 'O''Timmins', null, 'Non', 100);
+
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/order-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/order-init.sql
index b81b16ad..0f1e2438 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/order-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/order-init.sql
@@ -1,54 +1,54 @@
--- Creating Table
-
-use [IBatisNet]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Orders]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_LineItems_Orders]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
- ALTER TABLE [dbo].[LineItems] DROP CONSTRAINT FK_LineItems_Orders
-
- drop table [dbo].[Orders]
-END
-
-CREATE TABLE [dbo].[Orders] (
- [Order_ID] [int] NOT NULL ,
- [Account_ID] [int] NULL ,
- [Order_Date] [datetime] NULL ,
- [Order_CardType] [varchar] (32) NULL ,
- [Order_CardNumber] [varchar] (32) NULL ,
- [Order_CardExpiry] [varchar] (32) NULL ,
- [Order_Street] [varchar] (32) NULL ,
- [Order_City] [varchar] (32) NULL ,
- [Order_Province] [varchar] (32) NULL ,
- [Order_PostalCode] [varchar] (32) NULL ,
- [Order_FavouriteLineItem] [int] NULL
-) ON [PRIMARY]
-
-ALTER TABLE [dbo].[Orders] WITH NOCHECK ADD
- CONSTRAINT [PK_Orders] PRIMARY KEY CLUSTERED
- (
- [Order_ID]
- ) ON [PRIMARY]
-
-
-ALTER TABLE [dbo].[Orders] ADD
- CONSTRAINT [FK_Orders_Accounts] FOREIGN KEY
- (
- [Account_ID]
- ) REFERENCES [dbo].[Accounts] (
- [Account_ID]
- )
--- Creating Test Data -- 2003-02-15 8:15:00/ 2003-02-15 8:15:00
-
-INSERT INTO [dbo].[Orders] VALUES (1, 1, '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4',2);
-INSERT INTO [dbo].[Orders] VALUES (2, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4',1);
-INSERT INTO [dbo].[Orders] VALUES (3, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4',2);
-INSERT INTO [dbo].[Orders] VALUES (4, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4',1);
-INSERT INTO [dbo].[Orders] VALUES (5, 5, '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4',2);
-INSERT INTO [dbo].[Orders] VALUES (6, 5, '2003-02-15 8:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4',1);
-INSERT INTO [dbo].[Orders] VALUES (7, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4',2);
-INSERT INTO [dbo].[Orders] VALUES (8, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4',1);
-INSERT INTO [dbo].[Orders] VALUES (9, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4',2);
-INSERT INTO [dbo].[Orders] VALUES (10, 1, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4',1);
-INSERT INTO [dbo].[Orders] VALUES (11, null, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY',1);
-
+-- Creating Table
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Orders]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_LineItems_Orders]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
+ ALTER TABLE [dbo].[LineItems] DROP CONSTRAINT FK_LineItems_Orders
+
+ drop table [dbo].[Orders]
+END
+
+CREATE TABLE [dbo].[Orders] (
+ [Order_ID] [int] NOT NULL ,
+ [Account_ID] [int] NULL ,
+ [Order_Date] [datetime] NULL ,
+ [Order_CardType] [varchar] (32) NULL ,
+ [Order_CardNumber] [varchar] (32) NULL ,
+ [Order_CardExpiry] [varchar] (32) NULL ,
+ [Order_Street] [varchar] (32) NULL ,
+ [Order_City] [varchar] (32) NULL ,
+ [Order_Province] [varchar] (32) NULL ,
+ [Order_PostalCode] [varchar] (32) NULL ,
+ [Order_FavouriteLineItem] [int] NULL
+) ON [PRIMARY]
+
+ALTER TABLE [dbo].[Orders] WITH NOCHECK ADD
+ CONSTRAINT [PK_Orders] PRIMARY KEY CLUSTERED
+ (
+ [Order_ID]
+ ) ON [PRIMARY]
+
+
+ALTER TABLE [dbo].[Orders] ADD
+ CONSTRAINT [FK_Orders_Accounts] FOREIGN KEY
+ (
+ [Account_ID]
+ ) REFERENCES [dbo].[Accounts] (
+ [Account_ID]
+ )
+-- Creating Test Data -- 2003-02-15 8:15:00/ 2003-02-15 8:15:00
+
+INSERT INTO [dbo].[Orders] VALUES (1, 1, '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4',2);
+INSERT INTO [dbo].[Orders] VALUES (2, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4',1);
+INSERT INTO [dbo].[Orders] VALUES (3, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4',2);
+INSERT INTO [dbo].[Orders] VALUES (4, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4',1);
+INSERT INTO [dbo].[Orders] VALUES (5, 5, '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4',2);
+INSERT INTO [dbo].[Orders] VALUES (6, 5, '2003-02-15 8:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4',1);
+INSERT INTO [dbo].[Orders] VALUES (7, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4',2);
+INSERT INTO [dbo].[Orders] VALUES (8, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4',1);
+INSERT INTO [dbo].[Orders] VALUES (9, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4',2);
+INSERT INTO [dbo].[Orders] VALUES (10, 1, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4',1);
+INSERT INTO [dbo].[Orders] VALUES (11, null, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY',1);
+
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/other-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/other-init.sql
index 93ad5201..645a6eea 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/other-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/other-init.sql
@@ -1,145 +1,145 @@
--- Creating Table
-
-use [IBatisNet]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Others]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- drop table [dbo].[Others]
-END
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[A]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- drop table [dbo].[A]
-END
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[B]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- drop table [dbo].[B]
-END
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[C]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- drop table [dbo].[C]
-END
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[D]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- drop table [dbo].[D]
-END
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[E]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- drop table [dbo].[E]
-END
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[F]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- drop table [dbo].[F]
-END
-
-
-CREATE TABLE [dbo].[Others] (
- [Other_Int] [int] NULL ,
- [Other_Long] [BigInt] NULL,
- [Other_Bit] [Bit] NOT NULL DEFAULT (0),
- [Other_String] [varchar] (32) NOT NULL
-) ON [PRIMARY]
-
-CREATE TABLE [dbo].[F] (
- [ID] [varchar] (50) NOT NULL ,
- [F_Libelle] [varchar] (50) NULL ,
- CONSTRAINT [PK_F] PRIMARY KEY CLUSTERED
- (
- [ID]
- ) ON [PRIMARY]
-) ON [PRIMARY]
-
-CREATE TABLE [dbo].[E] (
- [ID] [varchar] (50) NOT NULL ,
- [E_Libelle] [varchar] (50) NULL ,
- CONSTRAINT [PK_E] PRIMARY KEY CLUSTERED
- (
- [ID]
- ) ON [PRIMARY]
-) ON [PRIMARY]
-
-CREATE TABLE [dbo].[D] (
- [ID] [varchar] (50) NOT NULL ,
- [D_Libelle] [varchar] (50) NULL ,
- CONSTRAINT [PK_D] PRIMARY KEY CLUSTERED
- (
- [ID]
- ) ON [PRIMARY]
-) ON [PRIMARY]
-
-CREATE TABLE [dbo].[C] (
- [ID] [varchar] (50) NOT NULL ,
- [C_Libelle] [varchar] (50) NULL ,
- CONSTRAINT [PK_C] PRIMARY KEY CLUSTERED
- (
- [ID]
- ) ON [PRIMARY]
-) ON [PRIMARY]
-
-
-CREATE TABLE [dbo].[B] (
- [ID] [varchar] (50) NOT NULL ,
- [C_ID] [varchar] (50) NULL ,
- [D_ID] [varchar] (50) NULL ,
- [B_Libelle] [varchar] (50) NULL ,
- CONSTRAINT [PK_B] PRIMARY KEY CLUSTERED
- (
- [ID]
- ) ON [PRIMARY] ,
- CONSTRAINT [FK_B_C] FOREIGN KEY
- (
- [C_ID]
- ) REFERENCES [C] (
- [ID]
- ),
- CONSTRAINT [FK_B_D] FOREIGN KEY
- (
- [D_ID]
- ) REFERENCES [D] (
- [ID]
- )
-) ON [PRIMARY]
-
-
-CREATE TABLE [dbo].[A] (
- [Id] [varchar] (50) NOT NULL ,
- [B_ID] [varchar] (50) NULL ,
- [E_ID] [varchar] (50) NULL ,
- [F_ID] [varchar] (50) NULL ,
- [A_Libelle] [varchar] (50) NULL
- CONSTRAINT [PK_A] PRIMARY KEY CLUSTERED
- (
- [Id]
- ) ON [PRIMARY] ,
- CONSTRAINT [FK_A_B] FOREIGN KEY
- (
- [B_ID]
- ) REFERENCES [B] (
- [ID]
- ),
- CONSTRAINT [FK_A_E] FOREIGN KEY
- (
- [E_ID]
- ) REFERENCES [E] (
- [ID]
- ),
- CONSTRAINT [FK_A_F] FOREIGN KEY
- (
- [F_ID]
- ) REFERENCES [F] (
- [ID]
- )
-) ON [PRIMARY]
-
-
--- Creating Test Data
-
-INSERT INTO [dbo].[Others] VALUES(1, 8888888, 0, 'Oui');
-INSERT INTO [dbo].[Others] VALUES(2, 9999999999, 1, 'Non');
-
-INSERT INTO [dbo].[F] VALUES('f', 'fff');
-INSERT INTO [dbo].[E] VALUES('e', 'eee');
-INSERT INTO [dbo].[D] VALUES('d', 'ddd');
-INSERT INTO [dbo].[C] VALUES('c', 'ccc');
-INSERT INTO [dbo].[B] VALUES('b', 'c', null, 'bbb');
+-- Creating Table
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Others]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ drop table [dbo].[Others]
+END
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[A]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ drop table [dbo].[A]
+END
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[B]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ drop table [dbo].[B]
+END
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[C]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ drop table [dbo].[C]
+END
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[D]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ drop table [dbo].[D]
+END
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[E]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ drop table [dbo].[E]
+END
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[F]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ drop table [dbo].[F]
+END
+
+
+CREATE TABLE [dbo].[Others] (
+ [Other_Int] [int] NULL ,
+ [Other_Long] [BigInt] NULL,
+ [Other_Bit] [Bit] NOT NULL DEFAULT (0),
+ [Other_String] [varchar] (32) NOT NULL
+) ON [PRIMARY]
+
+CREATE TABLE [dbo].[F] (
+ [ID] [varchar] (50) NOT NULL ,
+ [F_Libelle] [varchar] (50) NULL ,
+ CONSTRAINT [PK_F] PRIMARY KEY CLUSTERED
+ (
+ [ID]
+ ) ON [PRIMARY]
+) ON [PRIMARY]
+
+CREATE TABLE [dbo].[E] (
+ [ID] [varchar] (50) NOT NULL ,
+ [E_Libelle] [varchar] (50) NULL ,
+ CONSTRAINT [PK_E] PRIMARY KEY CLUSTERED
+ (
+ [ID]
+ ) ON [PRIMARY]
+) ON [PRIMARY]
+
+CREATE TABLE [dbo].[D] (
+ [ID] [varchar] (50) NOT NULL ,
+ [D_Libelle] [varchar] (50) NULL ,
+ CONSTRAINT [PK_D] PRIMARY KEY CLUSTERED
+ (
+ [ID]
+ ) ON [PRIMARY]
+) ON [PRIMARY]
+
+CREATE TABLE [dbo].[C] (
+ [ID] [varchar] (50) NOT NULL ,
+ [C_Libelle] [varchar] (50) NULL ,
+ CONSTRAINT [PK_C] PRIMARY KEY CLUSTERED
+ (
+ [ID]
+ ) ON [PRIMARY]
+) ON [PRIMARY]
+
+
+CREATE TABLE [dbo].[B] (
+ [ID] [varchar] (50) NOT NULL ,
+ [C_ID] [varchar] (50) NULL ,
+ [D_ID] [varchar] (50) NULL ,
+ [B_Libelle] [varchar] (50) NULL ,
+ CONSTRAINT [PK_B] PRIMARY KEY CLUSTERED
+ (
+ [ID]
+ ) ON [PRIMARY] ,
+ CONSTRAINT [FK_B_C] FOREIGN KEY
+ (
+ [C_ID]
+ ) REFERENCES [C] (
+ [ID]
+ ),
+ CONSTRAINT [FK_B_D] FOREIGN KEY
+ (
+ [D_ID]
+ ) REFERENCES [D] (
+ [ID]
+ )
+) ON [PRIMARY]
+
+
+CREATE TABLE [dbo].[A] (
+ [Id] [varchar] (50) NOT NULL ,
+ [B_ID] [varchar] (50) NULL ,
+ [E_ID] [varchar] (50) NULL ,
+ [F_ID] [varchar] (50) NULL ,
+ [A_Libelle] [varchar] (50) NULL
+ CONSTRAINT [PK_A] PRIMARY KEY CLUSTERED
+ (
+ [Id]
+ ) ON [PRIMARY] ,
+ CONSTRAINT [FK_A_B] FOREIGN KEY
+ (
+ [B_ID]
+ ) REFERENCES [B] (
+ [ID]
+ ),
+ CONSTRAINT [FK_A_E] FOREIGN KEY
+ (
+ [E_ID]
+ ) REFERENCES [E] (
+ [ID]
+ ),
+ CONSTRAINT [FK_A_F] FOREIGN KEY
+ (
+ [F_ID]
+ ) REFERENCES [F] (
+ [ID]
+ )
+) ON [PRIMARY]
+
+
+-- Creating Test Data
+
+INSERT INTO [dbo].[Others] VALUES(1, 8888888, 0, 'Oui');
+INSERT INTO [dbo].[Others] VALUES(2, 9999999999, 1, 'Non');
+
+INSERT INTO [dbo].[F] VALUES('f', 'fff');
+INSERT INTO [dbo].[E] VALUES('e', 'eee');
+INSERT INTO [dbo].[D] VALUES('d', 'ddd');
+INSERT INTO [dbo].[C] VALUES('c', 'ccc');
+INSERT INTO [dbo].[B] VALUES('b', 'c', null, 'bbb');
INSERT INTO [dbo].[A] VALUES('a', 'b', 'e', null, 'aaa'); \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/ps_SelectAccount.sql b/tests/unit/Data/SqlMap/scripts/mssql/ps_SelectAccount.sql
index 668913ce..bf3ae13d 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/ps_SelectAccount.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/ps_SelectAccount.sql
@@ -1,10 +1,10 @@
-CREATE PROCEDURE dbo.[ps_SelectAccount]
-@Account_ID [int]
-AS
-select
- Account_ID as Id,
- Account_FirstName as FirstName,
- Account_LastName as LastName,
- Account_Email as EmailAddress
-from Accounts
+CREATE PROCEDURE dbo.[ps_SelectAccount]
+@Account_ID [int]
+AS
+select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+from Accounts
where Account_ID = @Account_ID \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/swap-procedure.sql b/tests/unit/Data/SqlMap/scripts/mssql/swap-procedure.sql
index 203ab60d..981ffc5f 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/swap-procedure.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/swap-procedure.sql
@@ -1,34 +1,34 @@
-CREATE PROCEDURE dbo.[ps_swap_email_address]
-@First_Email [nvarchar] (64) output,
-@Second_Email [nvarchar] (64) output
-AS
-
-Declare @ID1 int
-Declare @ID2 int
-
-Declare @Email1 [nvarchar] (64)
-Declare @Email2 [nvarchar] (64)
-
- SELECT @ID1 = Account_ID, @Email1 = Account_Email
- from Accounts
- where Account_Email = @First_Email
-
- SELECT @ID2 = Account_ID, @Email2 = Account_Email
- from Accounts
- where Account_Email = @Second_Email
-
- UPDATE Accounts
- set Account_Email = @Email2
- where Account_ID = @ID1
-
- UPDATE Accounts
- set Account_Email = @Email1
- where Account_ID = @ID2
-
- SELECT @First_Email = Account_Email
- from Accounts
- where Account_ID = @ID1
-
- SELECT @Second_Email = Account_Email
- from Accounts
- where Account_ID = @ID2
+CREATE PROCEDURE dbo.[ps_swap_email_address]
+@First_Email [nvarchar] (64) output,
+@Second_Email [nvarchar] (64) output
+AS
+
+Declare @ID1 int
+Declare @ID2 int
+
+Declare @Email1 [nvarchar] (64)
+Declare @Email2 [nvarchar] (64)
+
+ SELECT @ID1 = Account_ID, @Email1 = Account_Email
+ from Accounts
+ where Account_Email = @First_Email
+
+ SELECT @ID2 = Account_ID, @Email2 = Account_Email
+ from Accounts
+ where Account_Email = @Second_Email
+
+ UPDATE Accounts
+ set Account_Email = @Email2
+ where Account_ID = @ID1
+
+ UPDATE Accounts
+ set Account_Email = @Email1
+ where Account_ID = @ID2
+
+ SELECT @First_Email = Account_Email
+ from Accounts
+ where Account_ID = @ID1
+
+ SELECT @Second_Email = Account_Email
+ from Accounts
+ where Account_ID = @ID2
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/user-init.sql b/tests/unit/Data/SqlMap/scripts/mssql/user-init.sql
index 02268f3c..7551da42 100644
--- a/tests/simple_unit/SqlMap/scripts/mssql/user-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mssql/user-init.sql
@@ -1,17 +1,17 @@
--- Creating Table
-
-use [NHibernate]
-
-if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Users]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
-BEGIN
- drop table [dbo].[Users]
-END
-
-CREATE TABLE [dbo].[Users] (
- LogonID nvarchar(20) NOT NULL default '0',
- Name nvarchar(40) default NULL,
- Password nvarchar(20) default NULL,
- EmailAddress nvarchar(40) default NULL,
- LastLogon datetime default NULL,
- PRIMARY KEY (LogonID)
-)
+-- Creating Table
+
+use [NHibernate]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Users]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+ drop table [dbo].[Users]
+END
+
+CREATE TABLE [dbo].[Users] (
+ LogonID nvarchar(20) NOT NULL default '0',
+ Name nvarchar(40) default NULL,
+ Password nvarchar(20) default NULL,
+ EmailAddress nvarchar(40) default NULL,
+ LastLogon datetime default NULL,
+ PRIMARY KEY (LogonID)
+)
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/DataBase.sql b/tests/unit/Data/SqlMap/scripts/mysql/DataBase.sql
index 2cf1e502..159b1f4a 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/DataBase.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/DataBase.sql
@@ -1,356 +1,356 @@
---
--- Table structure for table `A`
---
-
-DROP TABLE IF EXISTS `A`;
-CREATE TABLE `A` (
- `ID` varchar(50) NOT NULL,
- `B_ID` varchar(50) default NULL,
- `E_ID` varchar(50) default NULL,
- `F_ID` varchar(50) default NULL,
- `A_Libelle` varchar(50) default NULL,
- PRIMARY KEY (`ID`),
- KEY `FK_A_B` (`B_ID`),
- KEY `FK_A_E` (`E_ID`),
- KEY `FK_A_F` (`F_ID`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `A`
---
-
-INSERT INTO `A` (`ID`, `B_ID`, `E_ID`, `F_ID`, `A_Libelle`) VALUES ('a', 'b', 'e', NULL, 'aaa');
-
--- --------------------------------------------------------
-
---
--- Table structure for table `Accounts`
---
-
-DROP TABLE IF EXISTS `Accounts`;
-CREATE TABLE `Accounts` (
- `Account_Id` int(11) NOT NULL,
- `Account_FirstName` varchar(32) NOT NULL,
- `Account_LastName` varchar(32) NOT NULL,
- `Account_Email` varchar(128) default NULL,
- `Account_Banner_Option` varchar(255) default NULL,
- `Account_Cart_Option` int(11) default NULL,
- PRIMARY KEY (`Account_Id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `Accounts`
---
-
-INSERT INTO `Accounts` (`Account_Id`, `Account_FirstName`, `Account_LastName`, `Account_Email`, `Account_Banner_Option`, `Account_Cart_Option`) VALUES (1, 'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', 200),
-(2, 'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', 200),
-(3, 'William', 'Dalton', NULL, 'Non', 100),
-(4, 'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', 100),
-(5, 'Gilles', 'Bayon', NULL, 'Oui', 100);
-
--- --------------------------------------------------------
-
---
--- Table structure for table `B`
---
-
-DROP TABLE IF EXISTS `B`;
-CREATE TABLE `B` (
- `ID` varchar(50) NOT NULL,
- `C_ID` varchar(50) default NULL,
- `D_ID` varchar(50) default NULL,
- `B_Libelle` varchar(50) default NULL,
- PRIMARY KEY (`ID`),
- KEY `FK_B_C` (`C_ID`),
- KEY `FK_B_D` (`D_ID`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `B`
---
-
-INSERT INTO `B` (`ID`, `C_ID`, `D_ID`, `B_Libelle`) VALUES ('b', 'c', NULL, 'bbb');
-
--- --------------------------------------------------------
-
---
--- Table structure for table `C`
---
-
-DROP TABLE IF EXISTS `C`;
-CREATE TABLE `C` (
- `ID` varchar(50) NOT NULL,
- `C_Libelle` varchar(50) default NULL,
- PRIMARY KEY (`ID`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `C`
---
-
-INSERT INTO `C` (`ID`, `C_Libelle`) VALUES ('c', 'ccc');
-
--- --------------------------------------------------------
-
---
--- Table structure for table `Categories`
---
-
-DROP TABLE IF EXISTS `Categories`;
-CREATE TABLE `Categories` (
- `Category_Id` int(11) NOT NULL auto_increment,
- `Category_Name` varchar(32) default NULL,
- `Category_Guid` varchar(36) default NULL,
- PRIMARY KEY (`Category_Id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-
---
--- Dumping data for table `Categories`
---
-
-
--- --------------------------------------------------------
-
---
--- Table structure for table `D`
---
-
-DROP TABLE IF EXISTS `D`;
-CREATE TABLE `D` (
- `ID` varchar(50) NOT NULL,
- `D_Libelle` varchar(50) default NULL,
- PRIMARY KEY (`ID`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `D`
---
-
-INSERT INTO `D` (`ID`, `D_Libelle`) VALUES ('d', 'ddd');
-
--- --------------------------------------------------------
-
---
--- Table structure for table `Documents`
---
-
-DROP TABLE IF EXISTS `Documents`;
-CREATE TABLE `Documents` (
- `Document_Id` int(11) NOT NULL,
- `Document_Title` varchar(32) default NULL,
- `Document_Type` varchar(32) default NULL,
- `Document_PageNumber` int(11) default NULL,
- `Document_City` varchar(32) default NULL,
- PRIMARY KEY (`Document_Id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `Documents`
---
-
-INSERT INTO `Documents` (`Document_Id`, `Document_Title`, `Document_Type`, `Document_PageNumber`, `Document_City`) VALUES (1, 'The World of Null-A', 'Book', 55, NULL),
-(2, 'Le Progres de Lyon', 'Newspaper', NULL, 'Lyon'),
-(3, 'Lord of the Rings', 'Book', 3587, NULL),
-(4, 'Le Canard enchaine', 'Tabloid', NULL, 'Paris'),
-(5, 'Le Monde', 'Broadsheet', NULL, 'Paris'),
-(6, 'Foundation', 'Monograph', 557, NULL);
-
--- --------------------------------------------------------
-
---
--- Table structure for table `E`
---
-
-DROP TABLE IF EXISTS `E`;
-CREATE TABLE `E` (
- `ID` varchar(50) NOT NULL,
- `E_Libelle` varchar(50) default NULL,
- PRIMARY KEY (`ID`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `E`
---
-
-INSERT INTO `E` (`ID`, `E_Libelle`) VALUES ('e', 'eee');
-
--- --------------------------------------------------------
-
---
--- Table structure for table `Enumerations`
---
-
-DROP TABLE IF EXISTS `Enumerations`;
-CREATE TABLE `Enumerations` (
- `Enum_Id` int(11) NOT NULL,
- `Enum_Day` int(11) NOT NULL,
- `Enum_Color` int(11) NOT NULL,
- `Enum_Month` int(11) default NULL,
- PRIMARY KEY (`Enum_Id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `Enumerations`
---
-
-
--- --------------------------------------------------------
-
---
--- Table structure for table `F`
---
-
-DROP TABLE IF EXISTS `F`;
-CREATE TABLE `F` (
- `ID` varchar(50) NOT NULL,
- `F_Libelle` varchar(50) default NULL,
- PRIMARY KEY (`ID`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `F`
---
-
-INSERT INTO `F` (`ID`, `F_Libelle`) VALUES ('f', 'fff');
-
--- --------------------------------------------------------
-
---
--- Table structure for table `LineItems`
---
-
-DROP TABLE IF EXISTS `LineItems`;
-CREATE TABLE `LineItems` (
- `LineItem_Id` int(11) NOT NULL,
- `Order_Id` int(11) NOT NULL,
- `LineItem_Code` varchar(32) NOT NULL,
- `LineItem_Quantity` int(11) NOT NULL,
- `LineItem_Price` decimal(18,2) default NULL,
- `LineItem_Picture` blob,
- PRIMARY KEY (`Order_Id`,`LineItem_Id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `LineItems`
---
-
-INSERT INTO `LineItems` (`LineItem_Id`, `Order_Id`, `LineItem_Code`, `LineItem_Quantity`, `LineItem_Price`, `LineItem_Picture`) VALUES (1, 1, 'ESM-48', 8, 87.60, NULL),
-(2, 1, 'ESM-23', 1, 55.40, NULL),
-(1, 2, 'DSM-37', 4, 7.80, NULL),
-(2, 2, 'FSM-12', 2, 55.78, NULL),
-(1, 3, 'DSM-59', 3, 5.70, NULL),
-(2, 3, 'DSM-53', 3, 98.78, NULL),
-(1, 4, 'RSM-57', 2, 78.90, NULL),
-(2, 4, 'XSM-78', 9, 2.34, NULL),
-(1, 5, 'ESM-48', 3, 43.87, NULL),
-(2, 5, 'WSM-98', 7, 5.40, NULL),
-(1, 6, 'QSM-39', 9, 12.12, NULL),
-(2, 6, 'ASM-45', 6, 78.77, NULL),
-(1, 7, 'WSM-27', 7, 52.10, NULL),
-(2, 7, 'ESM-23', 2, 123.34, NULL),
-(1, 8, 'DSM-16', 4, 41.30, NULL),
-(2, 8, 'GSM-65', 1, 2.20, NULL),
-(1, 9, 'DSM-78', 2, 45.40, NULL),
-(2, 9, 'TSM-12', 2, 32.12, NULL),
-(1, 10, 'ESM-34', 1, 45.43, NULL),
-(2, 10, 'QSM-98', 8, 8.40, NULL);
-
--- --------------------------------------------------------
-
---
--- Table structure for table `Orders`
---
-
-DROP TABLE IF EXISTS `Orders`;
-CREATE TABLE `Orders` (
- `Order_Id` int(11) NOT NULL,
- `Account_Id` int(11) default NULL,
- `Order_Date` datetime default NULL,
- `Order_CardType` varchar(32) default NULL,
- `Order_CardNumber` varchar(32) default NULL,
- `Order_CardExpiry` varchar(32) default NULL,
- `Order_Street` varchar(32) default NULL,
- `Order_City` varchar(32) default NULL,
- `Order_Province` varchar(32) default NULL,
- `Order_PostalCode` varchar(32) default NULL,
- `Order_FavouriteLineItem` int(11) default NULL,
- PRIMARY KEY (`Order_Id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `Orders`
---
-
-INSERT INTO `Orders` (`Order_Id`, `Account_Id`, `Order_Date`, `Order_CardType`, `Order_CardNumber`, `Order_CardExpiry`, `Order_Street`, `Order_City`, `Order_Province`, `Order_PostalCode`, `Order_FavouriteLineItem`) VALUES (1, 1, '2003-02-15 08:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4', 2),
-(2, 4, '2003-02-15 08:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4', 1),
-(3, 3, '2003-02-15 08:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4', 2),
-(4, 2, '2003-02-15 08:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4', 1),
-(5, 5, '2003-02-15 08:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4', 2),
-(6, 5, '2003-02-15 08:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4', 1),
-(7, 4, '2003-02-15 08:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4', 2),
-(8, 3, '2003-02-15 08:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4', 1),
-(9, 2, '2003-02-15 08:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4', 2),
-(10, 1, '2003-02-15 08:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4', 1),
-(11, NULL, '2003-02-15 08:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY', 1);
-
--- --------------------------------------------------------
-
---
--- Table structure for table `Others`
---
-
-DROP TABLE IF EXISTS `Others`;
-CREATE TABLE `Others` (
- `Other_Int` int(11) default NULL,
- `Other_Long` bigint(20) default NULL,
- `Other_Bit` bit(1) NOT NULL default '\0',
- `Other_String` varchar(32) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `Others`
---
-
-INSERT INTO `Others` (`Other_Int`, `Other_Long`, `Other_Bit`, `Other_String`) VALUES (1, 8888888, '\0', 'Oui'),
-(2, 9999999999, '', 'Non'),
-(99, 1966, '', 'Non');
-
--- --------------------------------------------------------
-
---
--- Table structure for table `Users`
---
-
-DROP TABLE IF EXISTS `Users`;
-CREATE TABLE `Users` (
- `LogonId` varchar(20) NOT NULL default '0',
- `Name` varchar(40) default NULL,
- `Password` varchar(20) default NULL,
- `EmailAddress` varchar(40) default NULL,
- `LastLogon` datetime default NULL,
- PRIMARY KEY (`LogonId`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `Users`
---
-
-
---
--- Constraints for dumped tables
---
-
---
--- Constraints for table `A`
---
-ALTER TABLE `A`
- ADD CONSTRAINT `FK_A_B` FOREIGN KEY (`B_ID`) REFERENCES `B` (`ID`),
- ADD CONSTRAINT `FK_A_E` FOREIGN KEY (`E_ID`) REFERENCES `E` (`ID`),
- ADD CONSTRAINT `FK_A_F` FOREIGN KEY (`F_ID`) REFERENCES `F` (`ID`);
-
---
--- Constraints for table `B`
---
-ALTER TABLE `B`
- ADD CONSTRAINT `FK_B_C` FOREIGN KEY (`C_ID`) REFERENCES `C` (`ID`),
- ADD CONSTRAINT `FK_B_D` FOREIGN KEY (`D_ID`) REFERENCES `D` (`ID`);
+--
+-- Table structure for table `A`
+--
+
+DROP TABLE IF EXISTS `A`;
+CREATE TABLE `A` (
+ `ID` varchar(50) NOT NULL,
+ `B_ID` varchar(50) default NULL,
+ `E_ID` varchar(50) default NULL,
+ `F_ID` varchar(50) default NULL,
+ `A_Libelle` varchar(50) default NULL,
+ PRIMARY KEY (`ID`),
+ KEY `FK_A_B` (`B_ID`),
+ KEY `FK_A_E` (`E_ID`),
+ KEY `FK_A_F` (`F_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `A`
+--
+
+INSERT INTO `A` (`ID`, `B_ID`, `E_ID`, `F_ID`, `A_Libelle`) VALUES ('a', 'b', 'e', NULL, 'aaa');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `Accounts`
+--
+
+DROP TABLE IF EXISTS `Accounts`;
+CREATE TABLE `Accounts` (
+ `Account_Id` int(11) NOT NULL,
+ `Account_FirstName` varchar(32) NOT NULL,
+ `Account_LastName` varchar(32) NOT NULL,
+ `Account_Email` varchar(128) default NULL,
+ `Account_Banner_Option` varchar(255) default NULL,
+ `Account_Cart_Option` int(11) default NULL,
+ PRIMARY KEY (`Account_Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `Accounts`
+--
+
+INSERT INTO `Accounts` (`Account_Id`, `Account_FirstName`, `Account_LastName`, `Account_Email`, `Account_Banner_Option`, `Account_Cart_Option`) VALUES (1, 'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', 200),
+(2, 'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', 200),
+(3, 'William', 'Dalton', NULL, 'Non', 100),
+(4, 'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', 100),
+(5, 'Gilles', 'Bayon', NULL, 'Oui', 100);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `B`
+--
+
+DROP TABLE IF EXISTS `B`;
+CREATE TABLE `B` (
+ `ID` varchar(50) NOT NULL,
+ `C_ID` varchar(50) default NULL,
+ `D_ID` varchar(50) default NULL,
+ `B_Libelle` varchar(50) default NULL,
+ PRIMARY KEY (`ID`),
+ KEY `FK_B_C` (`C_ID`),
+ KEY `FK_B_D` (`D_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `B`
+--
+
+INSERT INTO `B` (`ID`, `C_ID`, `D_ID`, `B_Libelle`) VALUES ('b', 'c', NULL, 'bbb');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `C`
+--
+
+DROP TABLE IF EXISTS `C`;
+CREATE TABLE `C` (
+ `ID` varchar(50) NOT NULL,
+ `C_Libelle` varchar(50) default NULL,
+ PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `C`
+--
+
+INSERT INTO `C` (`ID`, `C_Libelle`) VALUES ('c', 'ccc');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `Categories`
+--
+
+DROP TABLE IF EXISTS `Categories`;
+CREATE TABLE `Categories` (
+ `Category_Id` int(11) NOT NULL auto_increment,
+ `Category_Name` varchar(32) default NULL,
+ `Category_Guid` varchar(36) default NULL,
+ PRIMARY KEY (`Category_Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
+
+--
+-- Dumping data for table `Categories`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `D`
+--
+
+DROP TABLE IF EXISTS `D`;
+CREATE TABLE `D` (
+ `ID` varchar(50) NOT NULL,
+ `D_Libelle` varchar(50) default NULL,
+ PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `D`
+--
+
+INSERT INTO `D` (`ID`, `D_Libelle`) VALUES ('d', 'ddd');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `Documents`
+--
+
+DROP TABLE IF EXISTS `Documents`;
+CREATE TABLE `Documents` (
+ `Document_Id` int(11) NOT NULL,
+ `Document_Title` varchar(32) default NULL,
+ `Document_Type` varchar(32) default NULL,
+ `Document_PageNumber` int(11) default NULL,
+ `Document_City` varchar(32) default NULL,
+ PRIMARY KEY (`Document_Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `Documents`
+--
+
+INSERT INTO `Documents` (`Document_Id`, `Document_Title`, `Document_Type`, `Document_PageNumber`, `Document_City`) VALUES (1, 'The World of Null-A', 'Book', 55, NULL),
+(2, 'Le Progres de Lyon', 'Newspaper', NULL, 'Lyon'),
+(3, 'Lord of the Rings', 'Book', 3587, NULL),
+(4, 'Le Canard enchaine', 'Tabloid', NULL, 'Paris'),
+(5, 'Le Monde', 'Broadsheet', NULL, 'Paris'),
+(6, 'Foundation', 'Monograph', 557, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `E`
+--
+
+DROP TABLE IF EXISTS `E`;
+CREATE TABLE `E` (
+ `ID` varchar(50) NOT NULL,
+ `E_Libelle` varchar(50) default NULL,
+ PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `E`
+--
+
+INSERT INTO `E` (`ID`, `E_Libelle`) VALUES ('e', 'eee');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `Enumerations`
+--
+
+DROP TABLE IF EXISTS `Enumerations`;
+CREATE TABLE `Enumerations` (
+ `Enum_Id` int(11) NOT NULL,
+ `Enum_Day` int(11) NOT NULL,
+ `Enum_Color` int(11) NOT NULL,
+ `Enum_Month` int(11) default NULL,
+ PRIMARY KEY (`Enum_Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `Enumerations`
+--
+
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `F`
+--
+
+DROP TABLE IF EXISTS `F`;
+CREATE TABLE `F` (
+ `ID` varchar(50) NOT NULL,
+ `F_Libelle` varchar(50) default NULL,
+ PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `F`
+--
+
+INSERT INTO `F` (`ID`, `F_Libelle`) VALUES ('f', 'fff');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `LineItems`
+--
+
+DROP TABLE IF EXISTS `LineItems`;
+CREATE TABLE `LineItems` (
+ `LineItem_Id` int(11) NOT NULL,
+ `Order_Id` int(11) NOT NULL,
+ `LineItem_Code` varchar(32) NOT NULL,
+ `LineItem_Quantity` int(11) NOT NULL,
+ `LineItem_Price` decimal(18,2) default NULL,
+ `LineItem_Picture` blob,
+ PRIMARY KEY (`Order_Id`,`LineItem_Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `LineItems`
+--
+
+INSERT INTO `LineItems` (`LineItem_Id`, `Order_Id`, `LineItem_Code`, `LineItem_Quantity`, `LineItem_Price`, `LineItem_Picture`) VALUES (1, 1, 'ESM-48', 8, 87.60, NULL),
+(2, 1, 'ESM-23', 1, 55.40, NULL),
+(1, 2, 'DSM-37', 4, 7.80, NULL),
+(2, 2, 'FSM-12', 2, 55.78, NULL),
+(1, 3, 'DSM-59', 3, 5.70, NULL),
+(2, 3, 'DSM-53', 3, 98.78, NULL),
+(1, 4, 'RSM-57', 2, 78.90, NULL),
+(2, 4, 'XSM-78', 9, 2.34, NULL),
+(1, 5, 'ESM-48', 3, 43.87, NULL),
+(2, 5, 'WSM-98', 7, 5.40, NULL),
+(1, 6, 'QSM-39', 9, 12.12, NULL),
+(2, 6, 'ASM-45', 6, 78.77, NULL),
+(1, 7, 'WSM-27', 7, 52.10, NULL),
+(2, 7, 'ESM-23', 2, 123.34, NULL),
+(1, 8, 'DSM-16', 4, 41.30, NULL),
+(2, 8, 'GSM-65', 1, 2.20, NULL),
+(1, 9, 'DSM-78', 2, 45.40, NULL),
+(2, 9, 'TSM-12', 2, 32.12, NULL),
+(1, 10, 'ESM-34', 1, 45.43, NULL),
+(2, 10, 'QSM-98', 8, 8.40, NULL);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `Orders`
+--
+
+DROP TABLE IF EXISTS `Orders`;
+CREATE TABLE `Orders` (
+ `Order_Id` int(11) NOT NULL,
+ `Account_Id` int(11) default NULL,
+ `Order_Date` datetime default NULL,
+ `Order_CardType` varchar(32) default NULL,
+ `Order_CardNumber` varchar(32) default NULL,
+ `Order_CardExpiry` varchar(32) default NULL,
+ `Order_Street` varchar(32) default NULL,
+ `Order_City` varchar(32) default NULL,
+ `Order_Province` varchar(32) default NULL,
+ `Order_PostalCode` varchar(32) default NULL,
+ `Order_FavouriteLineItem` int(11) default NULL,
+ PRIMARY KEY (`Order_Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `Orders`
+--
+
+INSERT INTO `Orders` (`Order_Id`, `Account_Id`, `Order_Date`, `Order_CardType`, `Order_CardNumber`, `Order_CardExpiry`, `Order_Street`, `Order_City`, `Order_Province`, `Order_PostalCode`, `Order_FavouriteLineItem`) VALUES (1, 1, '2003-02-15 08:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4', 2),
+(2, 4, '2003-02-15 08:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4', 1),
+(3, 3, '2003-02-15 08:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4', 2),
+(4, 2, '2003-02-15 08:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4', 1),
+(5, 5, '2003-02-15 08:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4', 2),
+(6, 5, '2003-02-15 08:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4', 1),
+(7, 4, '2003-02-15 08:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4', 2),
+(8, 3, '2003-02-15 08:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4', 1),
+(9, 2, '2003-02-15 08:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4', 2),
+(10, 1, '2003-02-15 08:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4', 1),
+(11, NULL, '2003-02-15 08:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY', 1);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `Others`
+--
+
+DROP TABLE IF EXISTS `Others`;
+CREATE TABLE `Others` (
+ `Other_Int` int(11) default NULL,
+ `Other_Long` bigint(20) default NULL,
+ `Other_Bit` bit(1) NOT NULL default '\0',
+ `Other_String` varchar(32) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `Others`
+--
+
+INSERT INTO `Others` (`Other_Int`, `Other_Long`, `Other_Bit`, `Other_String`) VALUES (1, 8888888, '\0', 'Oui'),
+(2, 9999999999, '', 'Non'),
+(99, 1966, '', 'Non');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `Users`
+--
+
+DROP TABLE IF EXISTS `Users`;
+CREATE TABLE `Users` (
+ `LogonId` varchar(20) NOT NULL default '0',
+ `Name` varchar(40) default NULL,
+ `Password` varchar(20) default NULL,
+ `EmailAddress` varchar(40) default NULL,
+ `LastLogon` datetime default NULL,
+ PRIMARY KEY (`LogonId`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `Users`
+--
+
+
+--
+-- Constraints for dumped tables
+--
+
+--
+-- Constraints for table `A`
+--
+ALTER TABLE `A`
+ ADD CONSTRAINT `FK_A_B` FOREIGN KEY (`B_ID`) REFERENCES `B` (`ID`),
+ ADD CONSTRAINT `FK_A_E` FOREIGN KEY (`E_ID`) REFERENCES `E` (`ID`),
+ ADD CONSTRAINT `FK_A_F` FOREIGN KEY (`F_ID`) REFERENCES `F` (`ID`);
+
+--
+-- Constraints for table `B`
+--
+ALTER TABLE `B`
+ ADD CONSTRAINT `FK_B_C` FOREIGN KEY (`C_ID`) REFERENCES `C` (`ID`),
+ ADD CONSTRAINT `FK_B_D` FOREIGN KEY (`D_ID`) REFERENCES `D` (`ID`);
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/account-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/account-init.sql
index afe8dab1..6b102597 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/account-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/account-init.sql
@@ -1,7 +1,7 @@
-TRUNCATE `Accounts`;
-
-INSERT INTO Accounts VALUES(1,'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', 200);
-INSERT INTO Accounts VALUES(2,'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', 200);
-INSERT INTO Accounts VALUES(3,'William', 'Dalton', null, 'Non', 100);
-INSERT INTO Accounts VALUES(4,'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', 100);
+TRUNCATE `Accounts`;
+
+INSERT INTO Accounts VALUES(1,'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', 200);
+INSERT INTO Accounts VALUES(2,'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', 200);
+INSERT INTO Accounts VALUES(3,'William', 'Dalton', null, 'Non', 100);
+INSERT INTO Accounts VALUES(4,'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', 100);
INSERT INTO Accounts VALUES(5,'Gilles', 'Bayon', null, 'Oui', 100); \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/account-procedure.sql b/tests/unit/Data/SqlMap/scripts/mysql/account-procedure.sql
index d3f5a12f..8b137891 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/account-procedure.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/account-procedure.sql
@@ -1 +1 @@
-
+
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/category-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/category-init.sql
index 2030181d..0c2b447f 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/category-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/category-init.sql
@@ -1 +1 @@
-TRUNCATE `Categories`;
+TRUNCATE `Categories`;
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/category-procedure.sql b/tests/unit/Data/SqlMap/scripts/mysql/category-procedure.sql
index e69de29b..e69de29b 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/category-procedure.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/category-procedure.sql
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/documents-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/documents-init.sql
index 5a1cdb2a..258ae532 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/documents-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/documents-init.sql
@@ -1,8 +1,8 @@
-TRUNCATE `Documents`;
-
-INSERT INTO Documents VALUES (1, 'The World of Null-A', 'Book', 55, null);
-INSERT INTO Documents VALUES (2, 'Le Progres de Lyon', 'Newspaper', null , 'Lyon');
-INSERT INTO Documents VALUES (3, 'Lord of the Rings', 'Book', 3587, null);
-INSERT INTO Documents VALUES (4, 'Le Canard enchaine', 'Tabloid', null , 'Paris');
-INSERT INTO Documents VALUES (5, 'Le Monde', 'Broadsheet', null , 'Paris');
-INSERT INTO Documents VALUES (6, 'Foundation', 'Monograph', 557, null);
+TRUNCATE `Documents`;
+
+INSERT INTO Documents VALUES (1, 'The World of Null-A', 'Book', 55, null);
+INSERT INTO Documents VALUES (2, 'Le Progres de Lyon', 'Newspaper', null , 'Lyon');
+INSERT INTO Documents VALUES (3, 'Lord of the Rings', 'Book', 3587, null);
+INSERT INTO Documents VALUES (4, 'Le Canard enchaine', 'Tabloid', null , 'Paris');
+INSERT INTO Documents VALUES (5, 'Le Monde', 'Broadsheet', null , 'Paris');
+INSERT INTO Documents VALUES (6, 'Foundation', 'Monograph', 557, null);
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/enumeration-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/enumeration-init.sql
index bc296957..4c0a7dee 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/enumeration-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/enumeration-init.sql
@@ -1,6 +1,6 @@
-TRUNCATE `Enumerations`;
-
-INSERT INTO Enumerations VALUES(1, 1, 1, 128);
-INSERT INTO Enumerations VALUES(2, 2, 2, 2048);
-INSERT INTO Enumerations VALUES(3, 3, 4, 256);
-INSERT INTO Enumerations VALUES(4, 4, 8, null);
+TRUNCATE `Enumerations`;
+
+INSERT INTO Enumerations VALUES(1, 1, 1, 128);
+INSERT INTO Enumerations VALUES(2, 2, 2, 2048);
+INSERT INTO Enumerations VALUES(3, 3, 4, 256);
+INSERT INTO Enumerations VALUES(4, 4, 8, null);
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/line-item-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/line-item-init.sql
index b0f7e424..9a96d525 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/line-item-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/line-item-init.sql
@@ -1,24 +1,24 @@
-
-TRUNCATE `LineItems`;
-
-INSERT INTO LineItems VALUES (1, 10, 'ESM-34', 1, 45.43, null);
-INSERT INTO LineItems VALUES (2, 10, 'QSM-98', 8, 8.40, null);
-INSERT INTO LineItems VALUES (1, 9, 'DSM-78', 2, 45.40, null);
-INSERT INTO LineItems VALUES (2, 9, 'TSM-12', 2, 32.12, null);
-INSERT INTO LineItems VALUES (1, 8, 'DSM-16', 4, 41.30, null);
-INSERT INTO LineItems VALUES (2, 8, 'GSM-65', 1, 2.20, null);
-INSERT INTO LineItems VALUES (1, 7, 'WSM-27', 7, 52.10, null);
-INSERT INTO LineItems VALUES (2, 7, 'ESM-23', 2, 123.34, null);
-INSERT INTO LineItems VALUES (1, 6, 'QSM-39', 9, 12.12, null);
-INSERT INTO LineItems VALUES (2, 6, 'ASM-45', 6, 78.77, null);
-INSERT INTO LineItems VALUES (1, 5, 'ESM-48', 3, 43.87, null);
-INSERT INTO LineItems VALUES (2, 5, 'WSM-98', 7, 5.40, null);
-INSERT INTO LineItems VALUES (1, 4, 'RSM-57', 2, 78.90, null);
-INSERT INTO LineItems VALUES (2, 4, 'XSM-78', 9, 2.34, null);
-INSERT INTO LineItems VALUES (1, 3, 'DSM-59', 3, 5.70, null);
-INSERT INTO LineItems VALUES (2, 3, 'DSM-53', 3, 98.78, null);
-INSERT INTO LineItems VALUES (1, 2, 'DSM-37', 4, 7.80, null);
-INSERT INTO LineItems VALUES (2, 2, 'FSM-12', 2, 55.78, null);
-INSERT INTO LineItems VALUES (1, 1, 'ESM-48', 8, 87.60, null);
-INSERT INTO LineItems VALUES (2, 1, 'ESM-23', 1, 55.40, null);
-
+
+TRUNCATE `LineItems`;
+
+INSERT INTO LineItems VALUES (1, 10, 'ESM-34', 1, 45.43, null);
+INSERT INTO LineItems VALUES (2, 10, 'QSM-98', 8, 8.40, null);
+INSERT INTO LineItems VALUES (1, 9, 'DSM-78', 2, 45.40, null);
+INSERT INTO LineItems VALUES (2, 9, 'TSM-12', 2, 32.12, null);
+INSERT INTO LineItems VALUES (1, 8, 'DSM-16', 4, 41.30, null);
+INSERT INTO LineItems VALUES (2, 8, 'GSM-65', 1, 2.20, null);
+INSERT INTO LineItems VALUES (1, 7, 'WSM-27', 7, 52.10, null);
+INSERT INTO LineItems VALUES (2, 7, 'ESM-23', 2, 123.34, null);
+INSERT INTO LineItems VALUES (1, 6, 'QSM-39', 9, 12.12, null);
+INSERT INTO LineItems VALUES (2, 6, 'ASM-45', 6, 78.77, null);
+INSERT INTO LineItems VALUES (1, 5, 'ESM-48', 3, 43.87, null);
+INSERT INTO LineItems VALUES (2, 5, 'WSM-98', 7, 5.40, null);
+INSERT INTO LineItems VALUES (1, 4, 'RSM-57', 2, 78.90, null);
+INSERT INTO LineItems VALUES (2, 4, 'XSM-78', 9, 2.34, null);
+INSERT INTO LineItems VALUES (1, 3, 'DSM-59', 3, 5.70, null);
+INSERT INTO LineItems VALUES (2, 3, 'DSM-53', 3, 98.78, null);
+INSERT INTO LineItems VALUES (1, 2, 'DSM-37', 4, 7.80, null);
+INSERT INTO LineItems VALUES (2, 2, 'FSM-12', 2, 55.78, null);
+INSERT INTO LineItems VALUES (1, 1, 'ESM-48', 8, 87.60, null);
+INSERT INTO LineItems VALUES (2, 1, 'ESM-23', 1, 55.40, null);
+
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/more-account-records.sql b/tests/unit/Data/SqlMap/scripts/mysql/more-account-records.sql
index e9fd4ac2..de33a256 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/more-account-records.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/more-account-records.sql
@@ -1,7 +1,7 @@
-
-INSERT INTO Accounts VALUES(6,'Jane', 'Calamity', 'Jane.Calamity@somewhere.com', 'Oui', 200);
-INSERT INTO Accounts VALUES(7,'Lucky', 'Luke', 'Lucky.Luke@somewhere.com', 'Oui', 200);
-INSERT INTO Accounts VALUES(8,'Ming', 'Li Foo', null, 'Non', 100);
-INSERT INTO Accounts VALUES(9,'O''Hara', 'Steve', 'Jack.OHara@somewhere.com', 'Oui', 200);
-INSERT INTO Accounts VALUES(10,'Robert', 'O''Timmins', null, 'Non', 100);
-
+
+INSERT INTO Accounts VALUES(6,'Jane', 'Calamity', 'Jane.Calamity@somewhere.com', 'Oui', 200);
+INSERT INTO Accounts VALUES(7,'Lucky', 'Luke', 'Lucky.Luke@somewhere.com', 'Oui', 200);
+INSERT INTO Accounts VALUES(8,'Ming', 'Li Foo', null, 'Non', 100);
+INSERT INTO Accounts VALUES(9,'O''Hara', 'Steve', 'Jack.OHara@somewhere.com', 'Oui', 200);
+INSERT INTO Accounts VALUES(10,'Robert', 'O''Timmins', null, 'Non', 100);
+
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/order-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/order-init.sql
index 5c23081f..2af33cb2 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/order-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/order-init.sql
@@ -1,15 +1,15 @@
-TRUNCATE `Orders`;
-
-
-INSERT INTO Orders VALUES (1, 1, '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4',2);
-INSERT INTO Orders VALUES (2, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4',1);
-INSERT INTO Orders VALUES (3, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4',2);
-INSERT INTO Orders VALUES (4, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4',1);
-INSERT INTO Orders VALUES (5, 5, '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4',2);
-INSERT INTO Orders VALUES (6, 5, '2003-02-15 8:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4',1);
-INSERT INTO Orders VALUES (7, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4',2);
-INSERT INTO Orders VALUES (8, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4',1);
-INSERT INTO Orders VALUES (9, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4',2);
-INSERT INTO Orders VALUES (10, 1, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4',1);
-INSERT INTO Orders VALUES (11, null, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY',1);
-
+TRUNCATE `Orders`;
+
+
+INSERT INTO Orders VALUES (1, 1, '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4',2);
+INSERT INTO Orders VALUES (2, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4',1);
+INSERT INTO Orders VALUES (3, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4',2);
+INSERT INTO Orders VALUES (4, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4',1);
+INSERT INTO Orders VALUES (5, 5, '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4',2);
+INSERT INTO Orders VALUES (6, 5, '2003-02-15 8:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4',1);
+INSERT INTO Orders VALUES (7, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4',2);
+INSERT INTO Orders VALUES (8, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4',1);
+INSERT INTO Orders VALUES (9, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4',2);
+INSERT INTO Orders VALUES (10, 1, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4',1);
+INSERT INTO Orders VALUES (11, null, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY',1);
+
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/other-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/other-init.sql
index e3ed6b32..409de6d3 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/other-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/other-init.sql
@@ -1,18 +1,18 @@
-
-TRUNCATE `Others`;
-TRUNCATE `A`;
-TRUNCATE `B`;
-TRUNCATE `C`;
-TRUNCATE `D`;
-TRUNCATE `E`;
-TRUNCATE `F`;
-
-INSERT INTO Others VALUES(1, 8888888, 0, 'Oui');
-INSERT INTO Others VALUES(2, 9999999999, 1, 'Non');
-
-INSERT INTO F VALUES('f', 'fff');
-INSERT INTO E VALUES('e', 'eee');
-INSERT INTO D VALUES('d', 'ddd');
-INSERT INTO C VALUES('c', 'ccc');
-INSERT INTO B VALUES('b', 'c', null, 'bbb');
+
+TRUNCATE `Others`;
+TRUNCATE `A`;
+TRUNCATE `B`;
+TRUNCATE `C`;
+TRUNCATE `D`;
+TRUNCATE `E`;
+TRUNCATE `F`;
+
+INSERT INTO Others VALUES(1, 8888888, 0, 'Oui');
+INSERT INTO Others VALUES(2, 9999999999, 1, 'Non');
+
+INSERT INTO F VALUES('f', 'fff');
+INSERT INTO E VALUES('e', 'eee');
+INSERT INTO D VALUES('d', 'ddd');
+INSERT INTO C VALUES('c', 'ccc');
+INSERT INTO B VALUES('b', 'c', null, 'bbb');
INSERT INTO A VALUES('a', 'b', 'e', null, 'aaa'); \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/swap-procedure.sql b/tests/unit/Data/SqlMap/scripts/mysql/swap-procedure.sql
index e69de29b..e69de29b 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/swap-procedure.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/swap-procedure.sql
diff --git a/tests/simple_unit/SqlMap/scripts/mysql/user-init.sql b/tests/unit/Data/SqlMap/scripts/mysql/user-init.sql
index 0bcd6a65..fe9c0c67 100644
--- a/tests/simple_unit/SqlMap/scripts/mysql/user-init.sql
+++ b/tests/unit/Data/SqlMap/scripts/mysql/user-init.sql
@@ -1,2 +1,2 @@
-
-TRUNCATE `users`;
+
+TRUNCATE `users`;
diff --git a/tests/simple_unit/SqlMap/scripts/sqlite/database.sql b/tests/unit/Data/SqlMap/scripts/sqlite/database.sql
index 477b4b16..6bef6f4c 100644
--- a/tests/simple_unit/SqlMap/scripts/sqlite/database.sql
+++ b/tests/unit/Data/SqlMap/scripts/sqlite/database.sql
@@ -1,242 +1,242 @@
-#
-# : A
-#
-DROP TABLE A;
-
-CREATE TABLE A
-(
- ID VARCHAR(50) NOT NULL PRIMARY KEY,
- B_ID VARCHAR(50),
- E_ID VARCHAR(50),
- F_ID VARCHAR(50),
- A_Libelle VARCHAR(50)
-);
-
-INSERT INTO A VALUES ('a', 'b', 'e', NULL, 'aaa');
-
-
-#
-# : Accounts
-#
-DROP TABLE Accounts;
-CREATE TABLE Accounts
-(
- Account_Id INTEGER NOT NULL PRIMARY KEY,
- Account_FirstName VARCHAR(32) NOT NULL,
- Account_LastName VARCHAR(32) NOT NULL,
- Account_Email VARCHAR(128),
- Account_Banner_Option VARCHAR(255),
- Account_Cart_Option INT
-);
-
-INSERT INTO Accounts VALUES ('1', 'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', '200');
-INSERT INTO Accounts VALUES ('2', 'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', '200');
-INSERT INTO Accounts VALUES ('3', 'William', 'Dalton', NULL, 'Non', '100');
-INSERT INTO Accounts VALUES ('4', 'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', '100');
-INSERT INTO Accounts VALUES ('5', 'Gilles', 'Bayon', NULL, 'Oui', '100');
-
-
-#
-# : B
-#
-DROP TABLE B;
-CREATE TABLE B
-(
- ID VARCHAR(50) NOT NULL PRIMARY KEY,
- C_ID VARCHAR(50),
- D_ID VARCHAR(50),
- B_Libelle VARCHAR(50)
-);
-
-INSERT INTO B VALUES ('b', 'c', NULL, 'bbb');
-
-
-#
-# : C
-#
-DROP TABLE C;
-CREATE TABLE C
-(
- ID VARCHAR(50) NOT NULL PRIMARY KEY,
- C_Libelle VARCHAR(50)
-);
-
-INSERT INTO C VALUES ('c', 'ccc');
-
-
-#
-# : Categories
-#
-DROP TABLE Categories;
-create table Categories
-(
- Category_Id INTEGER NOT NULL PRIMARY KEY,
- Category_Name varchar(32),
- Category_Guid varchar(36)
-);
-
-
-#
-# : D
-#
-DROP TABLE D;
-CREATE TABLE D
-(
- ID VARCHAR(50) NOT NULL PRIMARY KEY,
- D_Libelle VARCHAR(50)
-);
-
-INSERT INTO D VALUES ('d', 'ddd');
-
-
-#
-# : Documents
-#
-DROP TABLE Documents;
-CREATE TABLE Documents
-(
- Document_Id INT NOT NULL PRIMARY KEY,
- Document_Title VARCHAR(32),
- Document_Type VARCHAR(32),
- Document_PageNumber INT,
- Document_City VARCHAR(32)
-);
-
-INSERT INTO Documents VALUES ('1', 'The World of Null-A', 'Book', '55', NULL);
-INSERT INTO Documents VALUES ('2', 'Le Progres de Lyon', 'Newspaper', NULL, 'Lyon');
-INSERT INTO Documents VALUES ('3', 'Lord of the Rings', 'Book', '3587', NULL);
-INSERT INTO Documents VALUES ('4', 'Le Canard enchaine', 'Tabloid', NULL, 'Paris');
-INSERT INTO Documents VALUES ('5', 'Le Monde', 'Broadsheet', NULL, 'Paris');
-INSERT INTO Documents VALUES ('6', 'Foundation', 'Monograph', '557', NULL);
-
-
-#
-# : E
-#
-DROP TABLE E;
-CREATE TABLE E
-(
- ID VARCHAR(50) NOT NULL PRIMARY KEY,
- E_Libelle VARCHAR(50)
-);
-
-
-INSERT INTO E VALUES ('e', 'eee');
-
-
-#
-# : Enumerations
-#
-DROP TABLE Enumerations;
-create table Enumerations
-(
- Enum_Id int not null,
- Enum_Day int not null,
- Enum_Color int not null,
- Enum_Month int
-);
-
-
-INSERT INTO Enumerations VALUES ('1', '1', '1', '128');
-INSERT INTO Enumerations VALUES ('2', '2', '2', '2048');
-INSERT INTO Enumerations VALUES ('3', '3', '4', '256');
-INSERT INTO Enumerations VALUES ('4', '4', '8', NULL);
-
-
-#
-# : F
-#
-DROP TABLE F;
-CREATE TABLE F
-(
- ID VARCHAR(50) NOT NULL PRIMARY KEY,
- F_Libelle VARCHAR(50)
-);
-
-INSERT INTO F VALUES ('f', 'fff');
-
-
-#
-# : LineItems
-#
-DROP TABLE LineItems;
-CREATE TABLE LineItems
-(
- LineItem_Id INTEGER NOT NULL,
- Order_Id INT NOT NULL,
- LineItem_Code VARCHAR(32) NOT NULL,
- LineItem_Quantity INT NOT NULL,
- LineItem_Price DECIMAL(18,2),
- LineItem_Picture BLOB
-);
-
-
-INSERT INTO LineItems VALUES ('1', '10', 'ESM-34', '1', '45.43', NULL);
-INSERT INTO LineItems VALUES ('2', '10', 'QSM-98', '8', '8.40', NULL);
-INSERT INTO LineItems VALUES ('1', '9', 'DSM-78', '2', '45.40', NULL);
-INSERT INTO LineItems VALUES ('2', '9', 'TSM-12', '2', '32.12', NULL);
-INSERT INTO LineItems VALUES ('1', '8', 'DSM-16', '4', '41.30', NULL);
-INSERT INTO LineItems VALUES ('2', '8', 'GSM-65', '1', '2.20', NULL);
-INSERT INTO LineItems VALUES ('1', '7', 'WSM-27', '7', '52.10', NULL);
-INSERT INTO LineItems VALUES ('2', '7', 'ESM-23', '2', '123.34', NULL);
-INSERT INTO LineItems VALUES ('1', '6', 'QSM-39', '9', '12.12', NULL);
-INSERT INTO LineItems VALUES ('2', '6', 'ASM-45', '6', '78.77', NULL);
-INSERT INTO LineItems VALUES ('1', '5', 'ESM-48', '3', '43.87', NULL);
-INSERT INTO LineItems VALUES ('2', '5', 'WSM-98', '7', '5.40', NULL);
-INSERT INTO LineItems VALUES ('1', '4', 'RSM-57', '2', '78.90', NULL);
-INSERT INTO LineItems VALUES ('2', '4', 'XSM-78', '9', '2.34', NULL);
-INSERT INTO LineItems VALUES ('1', '3', 'DSM-59', '3', '5.70', NULL);
-INSERT INTO LineItems VALUES ('2', '3', 'DSM-53', '3', '98.78', NULL);
-INSERT INTO LineItems VALUES ('1', '2', 'DSM-37', '4', '7.80', NULL);
-INSERT INTO LineItems VALUES ('2', '2', 'FSM-12', '2', '55.78', NULL);
-INSERT INTO LineItems VALUES ('1', '1', 'ESM-48', '8', '87.60', NULL);
-INSERT INTO LineItems VALUES ('2', '1', 'ESM-23', '1', '55.40', NULL);
-
-
-#
-# : Orders
-#
-DROP TABLE Orders;
-CREATE TABLE Orders
-(
- Order_Id INTEGER NOT NULL PRIMARY KEY,
- Account_Id INT,
- Order_Date DATETIME,
- Order_CardType VARCHAR(32),
- Order_CardNumber VARCHAR(32),
- Order_CardExpiry VARCHAR(32),
- Order_Street VARCHAR(32),
- Order_City VARCHAR(32),
- Order_Province VARCHAR(32),
- Order_PostalCode VARCHAR(32),
- Order_FavouriteLineItem INT
-);
-
-INSERT INTO Orders VALUES ('1', '1', '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4', '2');
-INSERT INTO Orders VALUES ('2', '4', '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4', '1');
-INSERT INTO Orders VALUES ('3', '3', '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4', '2');
-INSERT INTO Orders VALUES ('4', '2', '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4', '1');
-INSERT INTO Orders VALUES ('5', '5', '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4', '2');
-INSERT INTO Orders VALUES ('6', '5', '2003-02-15 8:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4', '1');
-INSERT INTO Orders VALUES ('7', '4', '2003-02-15 8:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4', '2');
-INSERT INTO Orders VALUES ('8', '3', '2003-02-15 8:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4', '1');
-INSERT INTO Orders VALUES ('9', '2', '2003-02-15 8:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4', '2');
-INSERT INTO Orders VALUES ('10', '1', '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4', '1');
-INSERT INTO Orders VALUES ('11', NULL, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY', '1');
-
-
-#
-# : Others
-#
-DROP TABLE Others;
-create table Others
-(
- Other_Int int,
- Other_Long bigint,
- Other_Bit bit not null default 0,
- Other_String varchar(32) not null
-);
-
-INSERT INTO Others VALUES ('1', '8888888', '0', 'Oui');
-INSERT INTO Others VALUES ('2', '9999999999', '1', 'Non');
-
+#
+# : A
+#
+DROP TABLE A;
+
+CREATE TABLE A
+(
+ ID VARCHAR(50) NOT NULL PRIMARY KEY,
+ B_ID VARCHAR(50),
+ E_ID VARCHAR(50),
+ F_ID VARCHAR(50),
+ A_Libelle VARCHAR(50)
+);
+
+INSERT INTO A VALUES ('a', 'b', 'e', NULL, 'aaa');
+
+
+#
+# : Accounts
+#
+DROP TABLE Accounts;
+CREATE TABLE Accounts
+(
+ Account_Id INTEGER NOT NULL PRIMARY KEY,
+ Account_FirstName VARCHAR(32) NOT NULL,
+ Account_LastName VARCHAR(32) NOT NULL,
+ Account_Email VARCHAR(128),
+ Account_Banner_Option VARCHAR(255),
+ Account_Cart_Option INT
+);
+
+INSERT INTO Accounts VALUES ('1', 'Joe', 'Dalton', 'Joe.Dalton@somewhere.com', 'Oui', '200');
+INSERT INTO Accounts VALUES ('2', 'Averel', 'Dalton', 'Averel.Dalton@somewhere.com', 'Oui', '200');
+INSERT INTO Accounts VALUES ('3', 'William', 'Dalton', NULL, 'Non', '100');
+INSERT INTO Accounts VALUES ('4', 'Jack', 'Dalton', 'Jack.Dalton@somewhere.com', 'Non', '100');
+INSERT INTO Accounts VALUES ('5', 'Gilles', 'Bayon', NULL, 'Oui', '100');
+
+
+#
+# : B
+#
+DROP TABLE B;
+CREATE TABLE B
+(
+ ID VARCHAR(50) NOT NULL PRIMARY KEY,
+ C_ID VARCHAR(50),
+ D_ID VARCHAR(50),
+ B_Libelle VARCHAR(50)
+);
+
+INSERT INTO B VALUES ('b', 'c', NULL, 'bbb');
+
+
+#
+# : C
+#
+DROP TABLE C;
+CREATE TABLE C
+(
+ ID VARCHAR(50) NOT NULL PRIMARY KEY,
+ C_Libelle VARCHAR(50)
+);
+
+INSERT INTO C VALUES ('c', 'ccc');
+
+
+#
+# : Categories
+#
+DROP TABLE Categories;
+create table Categories
+(
+ Category_Id INTEGER NOT NULL PRIMARY KEY,
+ Category_Name varchar(32),
+ Category_Guid varchar(36)
+);
+
+
+#
+# : D
+#
+DROP TABLE D;
+CREATE TABLE D
+(
+ ID VARCHAR(50) NOT NULL PRIMARY KEY,
+ D_Libelle VARCHAR(50)
+);
+
+INSERT INTO D VALUES ('d', 'ddd');
+
+
+#
+# : Documents
+#
+DROP TABLE Documents;
+CREATE TABLE Documents
+(
+ Document_Id INT NOT NULL PRIMARY KEY,
+ Document_Title VARCHAR(32),
+ Document_Type VARCHAR(32),
+ Document_PageNumber INT,
+ Document_City VARCHAR(32)
+);
+
+INSERT INTO Documents VALUES ('1', 'The World of Null-A', 'Book', '55', NULL);
+INSERT INTO Documents VALUES ('2', 'Le Progres de Lyon', 'Newspaper', NULL, 'Lyon');
+INSERT INTO Documents VALUES ('3', 'Lord of the Rings', 'Book', '3587', NULL);
+INSERT INTO Documents VALUES ('4', 'Le Canard enchaine', 'Tabloid', NULL, 'Paris');
+INSERT INTO Documents VALUES ('5', 'Le Monde', 'Broadsheet', NULL, 'Paris');
+INSERT INTO Documents VALUES ('6', 'Foundation', 'Monograph', '557', NULL);
+
+
+#
+# : E
+#
+DROP TABLE E;
+CREATE TABLE E
+(
+ ID VARCHAR(50) NOT NULL PRIMARY KEY,
+ E_Libelle VARCHAR(50)
+);
+
+
+INSERT INTO E VALUES ('e', 'eee');
+
+
+#
+# : Enumerations
+#
+DROP TABLE Enumerations;
+create table Enumerations
+(
+ Enum_Id int not null,
+ Enum_Day int not null,
+ Enum_Color int not null,
+ Enum_Month int
+);
+
+
+INSERT INTO Enumerations VALUES ('1', '1', '1', '128');
+INSERT INTO Enumerations VALUES ('2', '2', '2', '2048');
+INSERT INTO Enumerations VALUES ('3', '3', '4', '256');
+INSERT INTO Enumerations VALUES ('4', '4', '8', NULL);
+
+
+#
+# : F
+#
+DROP TABLE F;
+CREATE TABLE F
+(
+ ID VARCHAR(50) NOT NULL PRIMARY KEY,
+ F_Libelle VARCHAR(50)
+);
+
+INSERT INTO F VALUES ('f', 'fff');
+
+
+#
+# : LineItems
+#
+DROP TABLE LineItems;
+CREATE TABLE LineItems
+(
+ LineItem_Id INTEGER NOT NULL,
+ Order_Id INT NOT NULL,
+ LineItem_Code VARCHAR(32) NOT NULL,
+ LineItem_Quantity INT NOT NULL,
+ LineItem_Price DECIMAL(18,2),
+ LineItem_Picture BLOB
+);
+
+
+INSERT INTO LineItems VALUES ('1', '10', 'ESM-34', '1', '45.43', NULL);
+INSERT INTO LineItems VALUES ('2', '10', 'QSM-98', '8', '8.40', NULL);
+INSERT INTO LineItems VALUES ('1', '9', 'DSM-78', '2', '45.40', NULL);
+INSERT INTO LineItems VALUES ('2', '9', 'TSM-12', '2', '32.12', NULL);
+INSERT INTO LineItems VALUES ('1', '8', 'DSM-16', '4', '41.30', NULL);
+INSERT INTO LineItems VALUES ('2', '8', 'GSM-65', '1', '2.20', NULL);
+INSERT INTO LineItems VALUES ('1', '7', 'WSM-27', '7', '52.10', NULL);
+INSERT INTO LineItems VALUES ('2', '7', 'ESM-23', '2', '123.34', NULL);
+INSERT INTO LineItems VALUES ('1', '6', 'QSM-39', '9', '12.12', NULL);
+INSERT INTO LineItems VALUES ('2', '6', 'ASM-45', '6', '78.77', NULL);
+INSERT INTO LineItems VALUES ('1', '5', 'ESM-48', '3', '43.87', NULL);
+INSERT INTO LineItems VALUES ('2', '5', 'WSM-98', '7', '5.40', NULL);
+INSERT INTO LineItems VALUES ('1', '4', 'RSM-57', '2', '78.90', NULL);
+INSERT INTO LineItems VALUES ('2', '4', 'XSM-78', '9', '2.34', NULL);
+INSERT INTO LineItems VALUES ('1', '3', 'DSM-59', '3', '5.70', NULL);
+INSERT INTO LineItems VALUES ('2', '3', 'DSM-53', '3', '98.78', NULL);
+INSERT INTO LineItems VALUES ('1', '2', 'DSM-37', '4', '7.80', NULL);
+INSERT INTO LineItems VALUES ('2', '2', 'FSM-12', '2', '55.78', NULL);
+INSERT INTO LineItems VALUES ('1', '1', 'ESM-48', '8', '87.60', NULL);
+INSERT INTO LineItems VALUES ('2', '1', 'ESM-23', '1', '55.40', NULL);
+
+
+#
+# : Orders
+#
+DROP TABLE Orders;
+CREATE TABLE Orders
+(
+ Order_Id INTEGER NOT NULL PRIMARY KEY,
+ Account_Id INT,
+ Order_Date DATETIME,
+ Order_CardType VARCHAR(32),
+ Order_CardNumber VARCHAR(32),
+ Order_CardExpiry VARCHAR(32),
+ Order_Street VARCHAR(32),
+ Order_City VARCHAR(32),
+ Order_Province VARCHAR(32),
+ Order_PostalCode VARCHAR(32),
+ Order_FavouriteLineItem INT
+);
+
+INSERT INTO Orders VALUES ('1', '1', '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4', '2');
+INSERT INTO Orders VALUES ('2', '4', '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4', '1');
+INSERT INTO Orders VALUES ('3', '3', '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4', '2');
+INSERT INTO Orders VALUES ('4', '2', '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4', '1');
+INSERT INTO Orders VALUES ('5', '5', '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4', '2');
+INSERT INTO Orders VALUES ('6', '5', '2003-02-15 8:15:00', 'VISA', '999999999999', '10/03', '6 Their Street', 'Victoria', 'BC', 'T4H 9G4', '1');
+INSERT INTO Orders VALUES ('7', '4', '2003-02-15 8:15:00', 'MC', '888888888888', '11/03', '77 Lucky Street', 'Edmonton', 'AB', 'R4A 0Z4', '2');
+INSERT INTO Orders VALUES ('8', '3', '2003-02-15 8:15:00', 'AMEX', '777777777777', '12/03', '888 Our Street', 'Regina', 'SK', 'S4S 7G4', '1');
+INSERT INTO Orders VALUES ('9', '2', '2003-02-15 8:15:00', 'MC', '666666666666', '01/04', '999 Your Street', 'Toronto', 'ON', 'G4D 9F4', '2');
+INSERT INTO Orders VALUES ('10', '1', '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', '99 Some Street', 'Calgary', 'AB', 'W4G 7A4', '1');
+INSERT INTO Orders VALUES ('11', NULL, '2003-02-15 8:15:00', 'VISA', '555555555555', '02/04', 'Null order', 'Calgary', 'ZZ', 'XXX YYY', '1');
+
+
+#
+# : Others
+#
+DROP TABLE Others;
+create table Others
+(
+ Other_Int int,
+ Other_Long bigint,
+ Other_Bit bit not null default 0,
+ Other_String varchar(32) not null
+);
+
+INSERT INTO Others VALUES ('1', '8888888', '0', 'Oui');
+INSERT INTO Others VALUES ('2', '9999999999', '1', 'Non');
+
diff --git a/tests/simple_unit/SqlMap/sqlite.xml b/tests/unit/Data/SqlMap/sqlite.xml
index 16aa8f61..ea5f3356 100644
--- a/tests/simple_unit/SqlMap/sqlite.xml
+++ b/tests/unit/Data/SqlMap/sqlite.xml
@@ -1,31 +1,31 @@
-<?xml version="1.0" encoding="utf-8"?>
-<sqlMapConfig>
-
- <!-- properties that replaces instanceof $name$ in the sqlmap files -->
- <properties>
- <property name="selectKey" value="select @@IDENTITY as value" />
- <property name="MyCategoryName" value="'Film'" />
- <property name="accountName" value="'Joe'" />
- </properties>
-
- <!-- type handlers -->
- <typeHandlers>
- <typeHandler class="OuiNonBool" dbType="Varchar" />
- </typeHandlers>
-
- <!-- sqlmap configurations -->
- <sqlMaps>
- <sqlMap resource="maps/sqlite/Account.xml"/>
- <sqlMap resource="maps/sqlite/DynamicAccount.xml"/>
- <sqlMap resource="maps/sqlite/Order.xml"/>
- <sqlMap resource="maps/sqlite/Category.xml"/>
- <sqlMap resource="maps/sqlite/Complex.xml"/>
- <sqlMap resource="maps/sqlite/LineItem.xml"/>
- <sqlMap resource="maps/sqlite/Enumeration.xml"/>
- <sqlMap resource="maps/sqlite/Other.xml"/>
- <sqlMap resource="maps/sqlite/ResultClass.xml"/>
- <sqlMap resource="maps/sqlite/Document.xml"/>
- <sqlMap resource="maps/sqlite/ActiveRecord.xml"/>
- </sqlMaps>
-
+<?xml version="1.0" encoding="utf-8"?>
+<sqlMapConfig>
+
+ <!-- properties that replaces instanceof $name$ in the sqlmap files -->
+ <properties>
+ <property name="selectKey" value="select @@IDENTITY as value" />
+ <property name="MyCategoryName" value="'Film'" />
+ <property name="accountName" value="'Joe'" />
+ </properties>
+
+ <!-- type handlers -->
+ <typeHandlers>
+ <typeHandler class="OuiNonBool" dbType="Varchar" />
+ </typeHandlers>
+
+ <!-- sqlmap configurations -->
+ <sqlMaps>
+ <sqlMap resource="maps/sqlite/Account.xml"/>
+ <sqlMap resource="maps/sqlite/DynamicAccount.xml"/>
+ <sqlMap resource="maps/sqlite/Order.xml"/>
+ <sqlMap resource="maps/sqlite/Category.xml"/>
+ <sqlMap resource="maps/sqlite/Complex.xml"/>
+ <sqlMap resource="maps/sqlite/LineItem.xml"/>
+ <sqlMap resource="maps/sqlite/Enumeration.xml"/>
+ <sqlMap resource="maps/sqlite/Other.xml"/>
+ <sqlMap resource="maps/sqlite/ResultClass.xml"/>
+ <sqlMap resource="maps/sqlite/Document.xml"/>
+ <sqlMap resource="maps/sqlite/ActiveRecord.xml"/>
+ </sqlMaps>
+
</sqlMapConfig> \ No newline at end of file
diff --git a/tests/simple_unit/SqlMap/sqlite/backup.db b/tests/unit/Data/SqlMap/sqlite/backup.db
index 4f5a353d..4f5a353d 100644
--- a/tests/simple_unit/SqlMap/sqlite/backup.db
+++ b/tests/unit/Data/SqlMap/sqlite/backup.db
Binary files differ
diff --git a/tests/simple_unit/SqlMap/sqlite/tests.db b/tests/unit/Data/SqlMap/sqlite/tests.db
index fce534dc..eabfcab5 100644
--- a/tests/simple_unit/SqlMap/sqlite/tests.db
+++ b/tests/unit/Data/SqlMap/sqlite/tests.db
Binary files differ
diff --git a/tests/simple_unit/Tickets/sqlmap.xml b/tests/unit/Data/SqlMap/sqlmap.xml
index 81918fbc..e6877f16 100644
--- a/tests/simple_unit/Tickets/sqlmap.xml
+++ b/tests/unit/Data/SqlMap/sqlmap.xml
@@ -1,21 +1,21 @@
-<sqlmap>
-
- <statement
- id="findNotVisitedWatchedTopicList"
- resultClass="TopicRecord"
- parametrClass="array"
- >
- <![CDATA[
- SELECT rt.*
- FROM rbx_watched_topic as rwt
- LEFT JOIN rbx_topic as rt
- ON rwt.topic_id = rt.topic_id
- WHERE user_id = #user_id# AND
- ( rt.created > #last_visit# OR
- rt.modified > #last_visit# OR
- rwt.visited = 0 )
- ORDER BY rt.title ASC
- ]]>
- </statement>
-
+<sqlmap>
+
+ <statement
+ id="findNotVisitedWatchedTopicList"
+ resultClass="TopicRecord"
+ parametrClass="array"
+ >
+ <![CDATA[
+ SELECT rt.*
+ FROM rbx_watched_topic as rwt
+ LEFT JOIN rbx_topic as rt
+ ON rwt.topic_id = rt.topic_id
+ WHERE user_id = #user_id# AND
+ ( rt.created > #last_visit# OR
+ rt.modified > #last_visit# OR
+ rwt.visited = 0 )
+ ORDER BY rt.title ASC
+ ]]>
+ </statement>
+
</sqlmap> \ No newline at end of file
diff --git a/tests/simple_unit/TableGateway/BaseGatewayTest.php b/tests/unit/Data/TableGateway/BaseGatewayTest.php
index f3117ed2..b97ef4a0 100644
--- a/tests/simple_unit/TableGateway/BaseGatewayTest.php
+++ b/tests/unit/Data/TableGateway/BaseGatewayTest.php
@@ -2,7 +2,10 @@
Prado::using('System.Data.*');
Prado::using('System.Data.DataGateway.TTableGateway');
-class BaseGatewayTest extends UnitTestCase
+/**
+ * @package System.Data.TableGateway
+ */
+class BaseGatewayTest extends PHPUnit_Framework_TestCase
{
protected $gateway1;
protected $gateway2;
diff --git a/tests/simple_unit/TableGateway/CountTest.php b/tests/unit/Data/TableGateway/CountTest.php
index 97211e3c..074d935b 100644
--- a/tests/simple_unit/TableGateway/CountTest.php
+++ b/tests/unit/Data/TableGateway/CountTest.php
@@ -2,6 +2,9 @@
require_once(dirname(__FILE__).'/BaseGatewayTest.php');
+/**
+ * @package System.Data.TableGateway
+ */
class CountTest extends BaseGatewayTest
{
function test_simple_count()
diff --git a/tests/simple_unit/TableGateway/MagicCallTest.php b/tests/unit/Data/TableGateway/MagicCallTest.php
index 87f9e785..56cc85b3 100644
--- a/tests/simple_unit/TableGateway/MagicCallTest.php
+++ b/tests/unit/Data/TableGateway/MagicCallTest.php
@@ -2,6 +2,9 @@
require_once(dirname(__FILE__).'/BaseGatewayTest.php');
+/**
+ * @package System.Data.TableGateway
+ */
class MagicCallTest extends BaseGatewayTest
{
function test_magic_call()
diff --git a/tests/simple_unit/TableGateway/DeleteByPkTest.php b/tests/unit/Data/TableGateway/TableGatewayDeleteByPkTest.php
index 49b2d86c..6bcaeb91 100644
--- a/tests/simple_unit/TableGateway/DeleteByPkTest.php
+++ b/tests/unit/Data/TableGateway/TableGatewayDeleteByPkTest.php
@@ -2,7 +2,10 @@
require_once(dirname(__FILE__).'/BaseGatewayTest.php');
-class DeleteByPkTest extends BaseGatewayTest
+/**
+ * @package System.Data.TableGateway
+ */
+class TableGatewayDeleteByPkTest extends BaseGatewayTest
{
function test_delete_by_1_pk()
{
diff --git a/tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php b/tests/unit/Data/TableGateway/TableGatewayPgsqlTest.php
index 96c9351d..234f70bd 100644
--- a/tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php
+++ b/tests/unit/Data/TableGateway/TableGatewayPgsqlTest.php
@@ -1,6 +1,9 @@
<?php
require_once(dirname(__FILE__).'/BaseGatewayTest.php');
+/**
+ * @package System.Data.TableGateway
+ */
class TableGatewayPgsqlTest extends BaseGatewayTest
{
diff --git a/tests/simple_unit/TableGateway/TableInfoGatewayTest.php b/tests/unit/Data/TableGateway/TableInfoGatewayTest.php
index 6c85248c..24b94690 100644
--- a/tests/simple_unit/TableGateway/TableInfoGatewayTest.php
+++ b/tests/unit/Data/TableGateway/TableInfoGatewayTest.php
@@ -2,6 +2,9 @@
require_once(dirname(__FILE__).'/BaseGatewayTest.php');
+/**
+ * @package System.Data.TableGateway
+ */
class TableInfoGatewayTest extends BaseGatewayTest
{
function test_table_info()
diff --git a/tests/simple_unit/TableGateway/TestFindByPk.php b/tests/unit/Data/TableGateway/TestFindByPk.php
index 3756d35a..f23fafa7 100644
--- a/tests/simple_unit/TableGateway/TestFindByPk.php
+++ b/tests/unit/Data/TableGateway/TestFindByPk.php
@@ -2,6 +2,9 @@
require_once(dirname(__FILE__).'/BaseGatewayTest.php');
+/**
+ * @package System.Data.TableGateway
+ */
class TestFindByPk extends BaseGatewayTest
{
function test_one_key()
diff --git a/tests/simple_unit/I18N/MysqlMessageSourceTestCase.php b/tests/unit/I18N/MysqlMessageSourceTest.php
index 0728baf7..2890244d 100644
--- a/tests/simple_unit/I18N/MysqlMessageSourceTestCase.php
+++ b/tests/unit/I18N/MysqlMessageSourceTest.php
@@ -3,7 +3,10 @@
Prado::using('System.I18N.core.MessageSource_MySQL');
Prado::using('System.I18N.core.MessageFormat');
-class MysqlMessageSourceTestCase extends UnitTestCase
+/**
+ * @package System.I18N
+ */
+class MysqlMessageSourceTestCase extends PHPUnit_Framework_TestCase
{
private $_source;
diff --git a/tests/unit/I18N/core/AllTests.php b/tests/unit/I18N/core/AllTests.php
deleted file mode 100644
index bf5fb813..00000000
--- a/tests/unit/I18N/core/AllTests.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'I18N_core_AllTests::main');
-}
-
-require_once 'CultureInfoTest.php';
-require_once 'DateFormatTest.php';
-require_once 'DateTimeFormatInfoTest.php';
-require_once 'NumberFormatInfoTest.php';
-require_once 'NumberFormatTest.php';
-
-class I18N_core_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.I18N.core');
-
- $suite->addTestSuite('CultureInfoTest');
- $suite->addTestSuite('DateFormatTest');
- $suite->addTestSuite('DateTimeFormatInfoTest');
- $suite->addTestSuite('NumberFormatInfoTest');
- $suite->addTestSuite('NumberFormatTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'I18N_core_AllTests::main') {
- I18N_core_AllTests::main();
-}
diff --git a/tests/unit/IO/AllTests.php b/tests/unit/IO/AllTests.php
deleted file mode 100644
index c789169f..00000000
--- a/tests/unit/IO/AllTests.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'IO_AllTests::main');
-}
-
-require_once 'TTarFileExtractorTest.php';
-require_once 'TTextWriterTest.php';
-
-class IO_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.IO');
-
- $suite->addTestSuite('TTarFileExtractorTest');
- $suite->addTestSuite('TTextWriterTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'IO_AllTests::main') {
- IO_AllTests::main();
-}
diff --git a/tests/unit/Security/AllTests.php b/tests/unit/Security/AllTests.php
deleted file mode 100644
index e71307a9..00000000
--- a/tests/unit/Security/AllTests.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Security_AllTests::main');
-}
-
-require_once 'TAuthManagerTest.php';
-require_once 'TAuthorizationRuleTest.php';
-require_once 'TSecurityManagerTest.php';
-require_once 'TUserManagerTest.php';
-require_once 'TUserTest.php';
-
-class Security_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Security');
-
- $suite->addTestSuite('TAuthManagerTest');
- $suite->addTestSuite('TAuthorizationRuleTest');
- $suite->addTestSuite('TSecurityManagerTest');
- $suite->addTestSuite('TUserManagerTest');
- $suite->addTestSuite('TUserTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Security_AllTests::main') {
- Security_AllTests::main();
-}
diff --git a/tests/simple_unit/Soap/ContactManager.php b/tests/unit/Soap/ContactManager.php
index 2fbeec48..2fbeec48 100644
--- a/tests/simple_unit/Soap/ContactManager.php
+++ b/tests/unit/Soap/ContactManager.php
diff --git a/tests/simple_unit/Soap/SoapTestCase.php b/tests/unit/Soap/SoapTest.php
index 3aaa60d3..6d4505d6 100644
--- a/tests/simple_unit/Soap/SoapTestCase.php
+++ b/tests/unit/Soap/SoapTest.php
@@ -4,7 +4,10 @@ ini_set("soap.wsdl_cache_enabled",0);
require_once(dirname(__FILE__).'/ContactManager.php');
-class SoapTestCase extends UnitTestCase
+/**
+ * @package System.Soap
+ */
+class SoapTestCase extends PHPUnit_Framework_TestCase
{
function getWsdlUri()
{
diff --git a/tests/simple_unit/application.xml b/tests/unit/Soap/mockapp/application.xml
index 971d5684..69961b84 100644
--- a/tests/simple_unit/application.xml
+++ b/tests/unit/Soap/mockapp/application.xml
@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<application id="simple_unit" mode="Debug">
- <services>
- <service id="soap" class="System.Web.Services.TSoapService">
- <soap id="contacts" provider="Application.Soap.ContactManager" ClassMaps="Contact, Address"/>
- </service>
- </services>
+<?xml version="1.0" encoding="utf-8"?>
+
+<application id="simple_unit" mode="Debug">
+ <services>
+ <service id="soap" class="System.Web.Services.TSoapService">
+ <soap id="contacts" provider="Application.Soap.ContactManager" ClassMaps="Contact, Address"/>
+ </service>
+ </services>
</application> \ No newline at end of file
diff --git a/tests/simple_unit/pages/.gitignore b/tests/unit/Soap/mockapp/pages/.gitignore
index e69de29b..e69de29b 100644
--- a/tests/simple_unit/pages/.gitignore
+++ b/tests/unit/Soap/mockapp/pages/.gitignore
diff --git a/tests/simple_unit/runtime/.gitignore b/tests/unit/Soap/mockapp/runtime/.gitignore
index d6b7ef32..d6b7ef32 100755
--- a/tests/simple_unit/runtime/.gitignore
+++ b/tests/unit/Soap/mockapp/runtime/.gitignore
diff --git a/tests/simple_unit/ws.php b/tests/unit/Soap/mockapp/ws.php
index 9096183e..9096183e 100644
--- a/tests/simple_unit/ws.php
+++ b/tests/unit/Soap/mockapp/ws.php
diff --git a/tests/unit/Util/AllTests.php b/tests/unit/Util/AllTests.php
deleted file mode 100644
index a6a217d7..00000000
--- a/tests/unit/Util/AllTests.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Util_AllTests::main');
-}
-
-require_once 'TDateTimeStampTest.php';
-require_once 'TLoggerTest.php';
-
-class Util_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Util');
-
- $suite->addTestSuite('TDateTimeStampTest');
- $suite->addTestSuite('TLoggerTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Util_AllTests::main') {
- Util_AllTests::main();
-}
diff --git a/tests/unit/Web/AllTests.php b/tests/unit/Web/AllTests.php
deleted file mode 100644
index ffd98978..00000000
--- a/tests/unit/Web/AllTests.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Web_AllTests::main');
-}
-
-require_once 'TAssetManagerTest.php';
-require_once 'TCacheHttpSessionTest.php';
-require_once 'THttpCookieCollectionTest.php';
-require_once 'THttpCookieTest.php';
-require_once 'THttpRequestTest.php';
-require_once 'THttpResponseTest.php';
-require_once 'THttpSessionTest.php';
-require_once 'THttpUtilityTest.php';
-require_once 'TUriTest.php';
-
-require_once 'UI/AllTests.php';
-
-class Web_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Web');
-
- $suite->addTestSuite('TAssetManagerTest');
- $suite->addTestSuite('TCacheHttpSessionTest');
- $suite->addTestSuite('THttpCookieCollectionTest');
- $suite->addTestSuite('THttpCookieTest');
- $suite->addTestSuite('THttpRequestTest');
- $suite->addTestSuite('THttpResponseTest');
- $suite->addTestSuite('THttpSessionTest');
- $suite->addTestSuite('THttpUtilityTest');
- $suite->addTestSuite('TUriTest');
-
- $suite->addTest(Web_UI_AllTests::suite());
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Web_AllTests::main') {
- Web_AllTests::main();
-}
diff --git a/tests/unit/Web/UI/ActiveControls/AllTests.php b/tests/unit/Web/UI/ActiveControls/AllTests.php
deleted file mode 100644
index 68989996..00000000
--- a/tests/unit/Web/UI/ActiveControls/AllTests.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Web_UI_ActiveControls_AllTests::main');
-}
-
-require_once 'TActiveHiddenFieldTest.php';
-
-class Web_UI_ActiveControls_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Web.UI.ActiveControls');
-
- $suite->addTestSuite('TActiveHiddenFieldTest');
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Web_UI_ActiveControls_AllTests::main') {
- Web_UI_ActiveControls_AllTests::main();
-}
diff --git a/tests/unit/Web/UI/AllTests.php b/tests/unit/Web/UI/AllTests.php
deleted file mode 100644
index 6885c337..00000000
--- a/tests/unit/Web/UI/AllTests.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Web_UI_AllTests::main');
-}
-
-require_once 'TClientScriptManagerTest.php';
-require_once 'TControlAdapterTest.php';
-require_once 'TControlTest.php';
-require_once 'TFormTest.php';
-require_once 'TPageTest.php';
-require_once 'TTemplateControlTest.php';
-require_once 'TTemplateManagerTest.php';
-require_once 'TTemplateTest.php';
-require_once 'TThemeManagerTest.php';
-require_once 'TThemeTest.php';
-require_once 'THtmlWriterTest.php';
-require_once 'TPageStatePersisterTest.php';
-require_once 'TSessionPageStatePersisterTest.php';
-
-class Web_UI_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Web.UI');
-
- $suite->addTestSuite('TClientScriptManagerTest');
- $suite->addTestSuite('TControlAdapterTest');
- $suite->addTestSuite('TControlTest');
- $suite->addTestSuite('TFormTest');
- $suite->addTestSuite('TPageTest');
- $suite->addTestSuite('TTemplateControlTest');
- $suite->addTestSuite('TTemplateManagerTest');
- $suite->addTestSuite('TTemplateTest');
- $suite->addTestSuite('TThemeManagerTest');
- $suite->addTestSuite('TThemeTest');
- $suite->addTestSuite('THtmlWriterTest');
- $suite->addTestSuite('TPageStatePersisterTest');
- $suite->addTestSuite('TSessionPageStatePersisterTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Web_UI_AllTests::main') {
- Web_UI_AllTests::main();
-}
diff --git a/tests/unit/Web/UI/WebControls/AllTests.php b/tests/unit/Web/UI/WebControls/AllTests.php
deleted file mode 100644
index 5ffa45a2..00000000
--- a/tests/unit/Web/UI/WebControls/AllTests.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Web_UI_WebControls_AllTests::main');
-}
-
-require_once 'TDropDownListTest.php';
-require_once 'TLabelTest.php';
-require_once 'TRequiredFieldValidatorTest.php';
-require_once 'TXmlTransformTest.php';
-
-class Web_UI_WebControls_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Web.UI.WebControls');
-
- $suite->addTestSuite('TDropDownListTest');
- $suite->addTestSuite('TLabelTest');
- $suite->addTestSuite('TRequiredFieldValidatorTest');
- $suite->addTestSuite('TXmlTransformTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Web_UI_WebControls_AllTests::main') {
- Web_UI_WebControls_AllTests::main();
-}
diff --git a/tests/unit/Xml/AllTests.php b/tests/unit/Xml/AllTests.php
deleted file mode 100644
index afb4c7a8..00000000
--- a/tests/unit/Xml/AllTests.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-if(!defined('PHPUnit_MAIN_METHOD')) {
- define('PHPUnit_MAIN_METHOD', 'Xml_AllTests::main');
-}
-
-require_once 'TXmlDocumentTest.php';
-require_once 'TXmlElementTest.php';
-require_once 'TXmlElementListTest.php';
-
-class Xml_AllTests {
- public static function main() {
- PHPUnit_TextUI_TestRunner::run(self::suite());
- }
-
- public static function suite() {
- $suite = new PHPUnit_Framework_TestSuite('System.Xml');
-
- $suite->addTestSuite('TXmlDocumentTest');
- $suite->addTestSuite('TXmlElementTest');
- $suite->addTestSuite('TXmlElementListTest');
-
- return $suite;
- }
-}
-
-if(PHPUnit_MAIN_METHOD == 'Xml_AllTests::main') {
- Xml_AllTests::main();
-}