[Catalyst-commits] r11931 - in
Catalyst-Runtime/5.80/branches/better_scripts: . lib
lib/Catalyst lib/Catalyst/Component lib/Catalyst/Engine
lib/Catalyst/Exception script t t/aggregate t/author t/lib
t/lib/ACLTestApp t/lib/ACLTestApp/Controller
t/lib/Catalyst/Plugin/Test t/lib/PluginTestApp
t/lib/PluginTestApp/Controller t/lib/TestApp/Controller
t/lib/TestApp/Controller/Action t/lib/TestAppDoubleAutoBug
t/lib/TestAppDoubleAutoBug/Controller
t/lib/TestAppPluginWithConstructor
t/lib/TestAppPluginWithConstructor/Controller
t/lib/TestAppStats t/lib/TestAppStats/Controller
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Fri Nov 20 01:09:14 GMT 2009
Author: t0m
Date: 2009-11-20 01:09:14 +0000 (Fri, 20 Nov 2009)
New Revision: 11931
Added:
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Basic.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Interface.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/c3_appclass_bug.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/c3_mro.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/caf_backcompat.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/custom_live_component_controller_action_auto_doublebug.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/custom_live_path_bug.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/meta_method_unneeded.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_actions.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_config.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_namespace.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_action.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_classdata.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component_loading.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component_mro.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_engine_fixenv-iis6.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_engine_fixenv-lighttpd.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_log.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_merge_config_hashes.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_mvc.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_path_to.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_plugin.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup_log.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup_stats.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_uri_for.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_uri_with.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_dispatcher_requestargs_restore.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_load_catalyst_test.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_non_moose.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_non_moose_controller.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_response.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_env_value.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_prefix.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_request.t
Catalyst-Runtime/5.80/branches/better_scripts/t/author/http-server.t
Catalyst-Runtime/5.80/branches/better_scripts/t/deprecated_appclass_action_warnings.t
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/ACLTestApp.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/ACLTestApp/
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/ACLTestApp/Controller/
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/ACLTestApp/Controller/Root.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/DeprecatedActionsInAppClassTestApp.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/PluginTestApp/
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/PluginTestApp/Controller/
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/PluginTestApp/Controller/Root.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppDoubleAutoBug/
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppDoubleAutoBug/Controller/
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppDoubleAutoBug/Controller/Root.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPluginWithConstructor/
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPluginWithConstructor/Controller/
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPluginWithConstructor/Controller/Root.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppStats/
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppStats/Controller/
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppStats/Controller/Root.pm
Removed:
Catalyst-Runtime/5.80/branches/better_scripts/t/author/optional_http-server.t
Catalyst-Runtime/5.80/branches/better_scripts/t/c3_appclass_bug.t
Catalyst-Runtime/5.80/branches/better_scripts/t/c3_mro.t
Catalyst-Runtime/5.80/branches/better_scripts/t/caf_backcompat.t
Catalyst-Runtime/5.80/branches/better_scripts/t/custom_live_component_controller_action_auto_doublebug.t
Catalyst-Runtime/5.80/branches/better_scripts/t/custom_live_path_bug.t
Catalyst-Runtime/5.80/branches/better_scripts/t/meta_method_unneeded.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_controller_config.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_controller_namespace.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_action.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_classdata.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component_loading.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component_mro.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_engine_fixenv-iis6.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_engine_fixenv-lighttpd.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_log.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_merge_config_hashes.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_mvc.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_path_to.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_plugin.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup_log.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup_stats.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_uri_for.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_uri_with.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_dispatcher_requestargs_restore.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_load_catalyst_test.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_extend_non_moose_controller.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_non_moose.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_non_moose_controller.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_response.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_env_value.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_prefix.t
Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_request.t
Modified:
Catalyst-Runtime/5.80/branches/better_scripts/
Catalyst-Runtime/5.80/branches/better_scripts/Changes
Catalyst-Runtime/5.80/branches/better_scripts/Makefile.PL
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/ClassData.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Component/ContextClosure.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Controller.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Dispatcher.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Engine/FastCGI.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Detach.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Go.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Request.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Response.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Runtime.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Test.pm
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Upgrading.pod
Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Utils.pm
Catalyst-Runtime/5.80/branches/better_scripts/script/catalyst.pl
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_auto.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_begin.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_chained.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_default.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_detach.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_forward.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_go.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_index.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_visit.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_engine_request_body.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_engine_request_escaped_path.t
Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_action_for.t
Catalyst-Runtime/5.80/branches/better_scripts/t/custom_exception_class_simple.t
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/Catalyst/Plugin/Test/Plugin.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/PluginTestApp.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Action/Chained.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Action/Private.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Dump.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Root.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppDoubleAutoBug.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPathBug.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPluginWithConstructor.pm
Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppStats.pm
Log:
r11361 at tomas-dorans-macbook-pro (orig r11331): t0m | 2009-09-07 15:45:01 +0100
Fix hash key name back to what it used to be for compat, keeping renamed accessor where it was. Tests for this breakage to follow
r11363 at tomas-dorans-macbook-pro (orig r11333): t0m | 2009-09-07 21:19:40 +0100
Test for r11331 + fix to only report each action name once from get_action_methods
r11364 at tomas-dorans-macbook-pro (orig r11334): t0m | 2009-09-07 21:21:52 +0100
I'm an idiot, that totally doesn't work. remove.
r11365 at tomas-dorans-macbook-pro (orig r11335): t0m | 2009-09-07 21:25:53 +0100
AGH. Too tired to be doing this, fucked it up again
r11366 at tomas-dorans-macbook-pro (orig r11336): t0m | 2009-09-07 21:33:31 +0100
Fix duplicate results from get_action_methods. Q. Why didn't I just do that first time round? A: Am idiot.
r11369 at tomas-dorans-macbook-pro (orig r11339): marcus | 2009-09-09 18:05:32 +0100
un-TODO passing TODO tests
r11370 at tomas-dorans-macbook-pro (orig r11340): marcus | 2009-09-09 18:08:03 +0100
Prepare for release
r11374 at tomas-dorans-macbook-pro (orig r11344): groditi | 2009-09-09 22:06:59 +0100
add myself to contributors
r11375 at tomas-dorans-macbook-pro (orig r11345): t0m | 2009-09-10 01:13:56 +0100
Fix warnings in upcoming moose
r11377 at tomas-dorans-macbook-pro (orig r11347): t0m | 2009-09-10 02:14:13 +0100
r11046 at t0mlaptop (orig r11045): yousef | 2009-08-07 00:07:07 +0100
Moved action methods from t/lib/TestApp.pm to t/lib/Test/Controller/Root.pm. Uncommented the if statement in lib/Catalyst/Controller.pm that checks for actions in the appclass.
r11378 at tomas-dorans-macbook-pro (orig r11348): t0m | 2009-09-10 02:20:55 +0100
Eat the merge mark, svk hates me.
r11379 at tomas-dorans-macbook-pro (orig r11349): t0m | 2009-09-10 03:13:04 +0100
Blargh. Merge branch deprecate_appclass_actions manually, with svn merge http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/5.80/trunk http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/5.80/branches/deprecate_appclass_actions . after I forgot -l on svk push, but ctrl-C after the first rev meant svk had already committed a merge mark and re-merging did nothing, and removing it didn't do the right thing. Fail cake..
r11380 at tomas-dorans-macbook-pro (orig r11350): hobbs | 2009-09-10 08:20:31 +0100
Rework the C<< $c->go >> documentation a little, hopefully it's more clear.
r11382 at tomas-dorans-macbook-pro (orig r11352): autarch | 2009-09-11 03:48:29 +0100
Preserve immutable_options when temporarily making a class mutable
r11383 at tomas-dorans-macbook-pro (orig r11353): t0m | 2009-09-11 09:18:09 +0100
Work with old and new Moose
r11393 at tomas-dorans-macbook-pro (orig r11363): autarch | 2009-09-14 19:37:25 +0100
The warning about a class having mutable ancestors has been removed (and was never in a non-dev Moose release)
r11396 at tomas-dorans-macbook-pro (orig r11366): t0m | 2009-09-15 21:48:19 +0100
Remove what is now lies from Changes. Bump all the deps which need to be bumped to not crap warnings everywhere
r11399 at tomas-dorans-macbook-pro (orig r11369): t0m | 2009-09-16 18:14:29 +0100
Changelog
r11400 at tomas-dorans-macbook-pro (orig r11370): t0m | 2009-09-16 18:15:52 +0100
Now we depend on latest Moose we are certain to have immutable options
r11401 at tomas-dorans-macbook-pro (orig r11371): t0m | 2009-09-17 09:52:34 +0100
-short is dead, RT#49771
r11402 at tomas-dorans-macbook-pro (orig r11372): t0m | 2009-09-17 09:52:52 +0100
Add note about actions in appclass being deprecated
r11403 at tomas-dorans-macbook-pro (orig r11373): t0m | 2009-09-17 09:54:45 +0100
Add note about ::[MVC]:: warnings
r11404 at tomas-dorans-macbook-pro (orig r11374): t0m | 2009-09-17 09:58:15 +0100
Re-space current release changelog to align with the rest. Move -short changelog to the right place.
r11405 at tomas-dorans-macbook-pro (orig r11375): rafl | 2009-09-17 10:33:28 +0100
Version 5.80013.
r11407 at tomas-dorans-macbook-pro (orig r11377): t0m | 2009-09-17 14:32:16 +0100
Well, that got forgotten, oops
r11426 at tomas-dorans-macbook-pro (orig r11396): rafl | 2009-09-20 15:01:45 +0100
Fix a syntax error in the ContextClosure pod.
r11427 at tomas-dorans-macbook-pro (orig r11397): rafl | 2009-09-20 15:01:51 +0100
Use clean instead of autoclean in the ContextClosure synopsis until we've fixed the issues with that and MXMA.
r11428 at tomas-dorans-macbook-pro (orig r11398): gbjk | 2009-09-21 15:05:17 +0100
- Fix go / visit expecting captures and arguments in reverse order.
r11429 at tomas-dorans-macbook-pro (orig r11399): mateu | 2009-09-21 19:57:14 +0100
Update $c->forward and $c->state documentation to address scalar context.
r11430 at tomas-dorans-macbook-pro (orig r11400): t0m | 2009-09-23 15:48:06 +0100
Dep bump
r11452 at tomas-dorans-macbook-pro (orig r11422): t0m | 2009-09-25 13:03:50 +0100
Remove warnings for using Catalyst::Dispatcher->dispatch_types
r11459 at tomas-dorans-macbook-pro (orig r11429): t0m | 2009-09-27 13:27:41 +0100
Optional test not optional for authors
r11460 at tomas-dorans-macbook-pro (orig r11430): t0m | 2009-09-27 13:33:05 +0100
Make r11422 not break stuff - idiot :(
r11487 at tomas-dorans-macbook-pro (orig r11457): t0m | 2009-10-05 22:59:47 +0100
r11483 at t0mlaptop (orig r11453): abraxxa | 2009-10-05 12:57:34 +0100
Improved the suggested fix warning when component resolution uses regex fallback for fully qualified component names.
Added disable_component_resolution_regex_fallback config option to switch off regex fallback for component resolution.
r11488 at tomas-dorans-macbook-pro (orig r11458): t0m | 2009-10-05 22:59:52 +0100
r11486 at t0mlaptop (orig r11456): t0m | 2009-10-05 22:59:01 +0100
Tidy up changelog/attribution
r11503 at tomas-dorans-macbook-pro (orig r11468): ilmari | 2009-10-06 16:30:41 +0100
Set ->request on the response object i Catalyst::Test::local_request--This line, and those below, will be ignored--
M t/unit_load_catalyst_test.t
M lib/Catalyst/Test.pm
M Changes
r11519 at tomas-dorans-macbook-pro (orig r11484): phaylon | 2009-10-07 18:21:47 +0100
added stub config section (incl TODO) to Cat.pm for things like 'current_view'
r11548 at tomas-dorans-macbook-pro (orig r11513): caelum | 2009-10-12 17:18:22 +0100
fix uninitialized warning in ACL
r11549 at tomas-dorans-macbook-pro (orig r11514): caelum | 2009-10-12 17:22:08 +0100
better fix for uninitialized warning
r11550 at tomas-dorans-macbook-pro (orig r11515): t0m | 2009-10-12 18:10:32 +0100
Less cargo cult madness
r11554 at tomas-dorans-macbook-pro (orig r11519): caelum | 2009-10-13 15:37:02 +0100
more correct fix for uninitialized warning from ACL
r11556 at tomas-dorans-macbook-pro (orig r11521): dhoss | 2009-10-14 01:14:42 +0100
Snow Leopard uses COPYFILE_DISABLE
r11557 at tomas-dorans-macbook-pro (orig r11522): dhoss | 2009-10-14 01:20:06 +0100
fixed regex for next mac codename/version, will have to actually figure out what the 10.7 codename is when it arrives
r11558 at tomas-dorans-macbook-pro (orig r11523): dhoss | 2009-10-14 01:23:45 +0100
Attempted to make the error message more obvious
r11561 at tomas-dorans-macbook-pro (orig r11526): dhoss | 2009-10-14 01:50:26 +0100
fixed error message for mac osx 10.7
r11568 at tomas-dorans-macbook-pro (orig r11533): hobbs | 2009-10-15 03:32:28 +0100
Give people a pointer to chase if they're looking for info on $c->req->user
r11574 at tomas-dorans-macbook-pro (orig r11539): t0m | 2009-10-15 22:19:26 +0100
Add docs I promised for r11484
r11622 at tomas-dorans-macbook-pro (orig r11587): jshirley | 2009-10-16 21:06:19 +0100
The longawaited nginx patch to support non-root apps, and some pod
r11623 at tomas-dorans-macbook-pro (orig r11588): jshirley | 2009-10-16 21:07:29 +0100
Changes for nginx patches
r11624 at tomas-dorans-macbook-pro (orig r11589): jshirley | 2009-10-16 21:08:55 +0100
My favorite color is clear and I like to eat rocks
r11670 at tomas-dorans-macbook-pro (orig r11635): t0m | 2009-10-19 18:02:59 +0100
Remove warnings from duplicate action declerations
r11675 at tomas-dorans-macbook-pro (orig r11640): poisonbit | 2009-10-20 21:12:46 +0100
Example added to #Actions_in_your_application_class
r11676 at tomas-dorans-macbook-pro (orig r11641): poisonbit | 2009-10-20 21:32:41 +0100
Formating (a lost space and line break)
r11677 at tomas-dorans-macbook-pro (orig r11642): poisonbit | 2009-10-20 21:34:45 +0100
More regresion from 11640, correcting parentheses and endpoint.
r11678 at tomas-dorans-macbook-pro (orig r11643): poisonbit | 2009-10-20 22:08:47 +0100
Change in actions inside roles.
http://bobtfish.livejournal.com/264317.html
r11679 at tomas-dorans-macbook-pro (orig r11644): poisonbit | 2009-10-20 23:16:03 +0100
Fixes to pass podchecker OK
r11714 at tomas-dorans-macbook-pro (orig r11679): rafl | 2009-10-28 23:54:56 +0000
Enable Catalyst::Utils::home() to find home within Dist::Zilla built dists.
Courtesy of nperez.
r11716 at tomas-dorans-macbook-pro (orig r11681): t0m | 2009-10-29 00:43:07 +0000
Make URI a link to make it super obvious
r11796 at tomas-dorans-macbook-pro (orig r11761): t0m | 2009-11-05 00:11:15 +0000
Need newer LWP for tests to pass as suggested on list by Jose Luis Martinez
r11811 at tomas-dorans-macbook-pro (orig r11776): altreus | 2009-11-06 17:09:51 +0000
Add doc for no-args call to ->uri_for
r11813 at tomas-dorans-macbook-pro (orig r11778): dhoss | 2009-11-06 17:13:27 +0000
fixed options passed to devel server so that author tests pass
r11814 at tomas-dorans-macbook-pro (orig r11779): altreus | 2009-11-06 17:14:49 +0000
Amend doc to not mention using undef in ->uri_for
r11816 at tomas-dorans-macbook-pro (orig r11781): t0m | 2009-11-07 16:50:59 +0000
Back out change from -port to -l - svn merge -r 11778:11777
r11823 at tomas-dorans-macbook-pro (orig r11788): rafl | 2009-11-09 22:21:19 +0000
Make request->body fail when used as a writer.
r11824 at tomas-dorans-macbook-pro (orig r11789): t0m | 2009-11-10 19:51:33 +0000
Fix changelog, me--
r11825 at tomas-dorans-macbook-pro (orig r11790): t0m | 2009-11-10 19:56:09 +0000
Warn on case_sensitive being set, remove documentation
r11827 at tomas-dorans-macbook-pro (orig r11792): t0m | 2009-11-10 21:36:06 +0000
Return 1, only currently works by chance
r11828 at tomas-dorans-macbook-pro (orig r11793): t0m | 2009-11-10 21:37:26 +0000
Also retarded
r11829 at tomas-dorans-macbook-pro (orig r11794): t0m | 2009-11-10 21:41:27 +0000
And lets not change behaviour with the log flush change..
r11836 at tomas-dorans-macbook-pro (orig r11801): t0m | 2009-11-12 01:12:05 +0000
Bring the changelog up to date.
r11839 at tomas-dorans-macbook-pro (orig r11804): t0m | 2009-11-12 01:44:46 +0000
r11462 at t0mlaptop (orig r11432): rafl | 2009-09-27 16:06:26 +0100
More aggregated tests.
r11463 at t0mlaptop (orig r11433): rafl | 2009-09-27 16:06:36 +0100
Fix a couple of aggregation warnings.
r11464 at t0mlaptop (orig r11434): rafl | 2009-09-27 16:06:51 +0100
More aggregation.
r11465 at t0mlaptop (orig r11435): rafl | 2009-09-27 16:28:04 +0100
Make things run again with aggregation disabled.
r11838 at t0mlaptop (orig r11803): t0m | 2009-11-12 01:39:56 +0000
Patch up changes to tests into new location. This merges parts of the following commits which were missed by svk:
-r11456:11457 http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/5.80/trunk
-r11467:11468 http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/5.80/trunk
r11841 at tomas-dorans-macbook-pro (orig r11806): bricas | 2009-11-12 17:58:02 +0000
remove duplicate changelog entry
r11847 at tomas-dorans-macbook-pro (orig r11812): t0m | 2009-11-12 23:57:15 +0000
r11668 at t0mlaptop (orig r11633): t0m | 2009-10-19 17:53:27 +0100
Branch for uri encoding things in uri_for in some way that means you can round trip path parts like '24/7', but without totally breaking backward compatibility this time hopefully.
r11669 at t0mlaptop (orig r11634): t0m | 2009-10-19 17:54:08 +0100
Well, this fixes my current issue, and doesn't seem to break any tests.. This likely means that the tests are still shit
r11769 at t0mlaptop (orig r11734): t0m | 2009-11-04 19:17:33 +0000
Needed for authors to run optional http test
r11833 at t0mlaptop (orig r11798): t0m | 2009-11-12 00:22:06 +0000
Tests, fix args as well as captureargs and be less violent - only encode /
r11840 at t0mlaptop (orig r11805): rafl | 2009-11-12 16:08:57 +0000
trailing whitespace
r11843 at t0mlaptop (orig r11808): t0m | 2009-11-12 23:41:17 +0000
Tidy up a bit
r11845 at t0mlaptop (orig r11810): t0m | 2009-11-12 23:46:28 +0000
Changelog
r11846 at t0mlaptop (orig r11811): t0m | 2009-11-12 23:56:36 +0000
Don't fail the live tests by only looking for http://localhost/etc..
r11858 at tomas-dorans-macbook-pro (orig r11823): t0m | 2009-11-14 17:26:04 +0000
Pod patch
r11860 at tomas-dorans-macbook-pro (orig r11825): t0m | 2009-11-14 17:30:26 +0000
Pod fixes re RT#51489
r11914 at tomas-dorans-macbook-pro (orig r11879): rafl | 2009-11-17 23:00:32 +0000
Merge branch 'exception_interface'
* exception_interface:
Use MooseX::Role::WithOverloading.
Add Exception::Interface and Exception::Basic. Make ::Base, ::Go and ::Detach use them.
Create branch exception_interface
r11953 at tomas-dorans-macbook-pro (orig r11918): t0m | 2009-11-19 21:58:59 +0000
Add Pod for all the new exception classes
r11954 at tomas-dorans-macbook-pro (orig r11919): t0m | 2009-11-19 22:00:27 +0000
Rename http server test as it is not optional for authors
Property changes on: Catalyst-Runtime/5.80/branches/better_scripts
___________________________________________________________________
Name: svk:merge
- 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/compres:7999
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/context_go:8001
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:8533
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/Catalyst-Test-Updates:8363
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/add_captures_to_visit:9546
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/index_default_fuckage:10646
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7911
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/namespace_handling_refactor:10655
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/trunk:11299
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
6d45476b-5895-46b8-b13a-8b969fa34c98:/local/Catalyst-Runtime-better_scripts:11331
8a9521aa-ff93-41d6-9f87-b05cafcdab40:/local/cat/Catalyst-Runtime/5.80/trunk:8157
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
+ 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/compres:7999
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/context_go:8001
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:8533
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/Catalyst-Test-Updates:8363
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/add_captures_to_visit:9546
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/aggregate_more:11803
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/disable_regex_fallback:11456
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/index_default_fuckage:10646
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7911
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/namespace_handling_refactor:10655
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/uri_encode_captures_andor_args_take2:11811
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/trunk:11919
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
6d45476b-5895-46b8-b13a-8b969fa34c98:/local/Catalyst-Runtime-better_scripts:11331
8a9521aa-ff93-41d6-9f87-b05cafcdab40:/local/cat/Catalyst-Runtime/5.80/trunk:8157
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
Modified: Catalyst-Runtime/5.80/branches/better_scripts/Changes
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/Changes 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/Changes 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,10 +1,94 @@
# This file documents the revision history for Perl extension Catalyst.
+ Bug fixes:
+ - Require MooseX::MethodAttributes 0.17. This in turn requires new
+ MooseX::Types to stop warnings in Moose 0.91, and correctly supports
+ role combination of roles containing attributed methods.
+ - Catalyst::Dispatcher::dispatch_types no longer throws deprecated warnings
+ as there is no recommended alternative.
+ - Improved the suggested fix warning when component resolution uses regex
+ fallback for fully qualified component names.
+ - Catalyst::Test::local_request sets ->request on the response.
+ - Require HTTP::Request 5.814 and HTTP::Response 5.813 from LWP 5.814
+ to avoid test fails.
+ - Log flush moved to the end of setup so that roles and plugins which
+ hook setup_finalize can log things and have them appear in application
+ startup, rather than with the first hit.
+ - Require a newer version of LWP to avoid failing tests.
+ - Stop warnings when actions are forwarded to during dispatch.
+ - Remove warnings for using Catalyst::Dispatcher->dispatch_types as this is a
+ valid method to publicly call on the dispatcher.
+ - Args ($c->request->args) and CaptureArgs ($c->request->captrues)
+ passed to $c->uri_for with an action object ($c->action) will now
+ correctly round-trip when args or captures contain / as it is now
+ correctly uri encoded to %2F.
+
+ Documentation:
+ - Document no-args call to $c->uri_for.
+ - Document all top level application configuration parameters.
+ - Clarify how to fix actions in your application class (which is
+ deprecated and causes warnings).
+ - Pod fixes for ContextClosure.
+ - Fix documentation for go/visit to reference captures and arguments
+ in the correct order.
+ - Update $c->forward and $c->state documentation to address scalar
+ context.
+ - Pod fix in Catalyst::Request (RT#51490)
+ - Pod fixes to refer to ::Controller:: rather than ::C:: as the latter
+ is deprecated (RT#51490)
+
+ New features:
+ - Added disable_component_resolution_regex_fallback config option to
+ switch off (deprecated) regex fallback for component resolution.
+ - Added an nginx-specific behavior to the FastCGI engine to allow
+ proper PATH_INFO and SCRIPT_NAME processing for non-root applications
+ - Enable Catalyst::Utils::home() to find home within Dist::Zilla built
+ distributions
+
+ Refactoring / cleanups:
+ - Remove documentation for the case_sensitive setting
+ - Warning is now emitted at application startup if the case_sensitive
+ setting is turned on. This setting is not used by anyone, not
+ believed to be useful and adds unnecessary complexity to controllers
+ and the dispatcher. If you are using this setting and have good reasons
+ why it should stay then you need to be shouting, now.
+ - Writing to $c->req->body now fails as doing this never makes sense.
+
+5.80013 2009-09-17 11:07:04
+
+ Bug fixes:
+ - Preserve immutable_options when temporarily making a class mutable in
+ Catalyst::ClassData as this is needed by new Class::MOP.
+ This could have potentially caused issues when using the deprecated runtime
+ plugins feature in an application with plugins which define their own new
+ method.
+ - Require new Moose version and new versions of various dependencies
+ to avoid warnings from newest Moose release.
+ - Fix go / visit expecting captures and arguments in reverse order.
+
+ Documentation:
+ - Rework the $c->go documentation to make it more clear.
+ - Additional documentation in Catalyst::Upgrading covering more deprecation
+ warnings.
+
+ Refactoring / cleanups:
+ - Action methods in the application class are deprecated and applications
+ using them will now generate a warning at startup.
+ - The -short option has been removed from catalyst.pl, stopping new
+ applications from being generated using the ::[MVC]:: naming scheme as
+ this is deprecated and generates warnings. RT#49771
+
+5.80012 2009-09-09 19:09:09
+
Bug fixes:
- Fix t/optional_http-server.t test.
- Fix t/optional_http-server-restart.t test.
- Fix duplicate components being loaded at setup time, each component is
now loaded at most once + tests.
+ - Fix backward compatibility - hash key configured actions are stored in
+ is returned to 'actions'.
+ - Fix get_action_methods returning duplicate methods when a method is both
+ decorated with method attributes and set as an action in config.
Refactoring / cleanups:
- Reduce minimum supported perl version from 5.8.6 to 5.8.4 as there are
Modified: Catalyst-Runtime/5.80/branches/better_scripts/Makefile.PL
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/Makefile.PL 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/Makefile.PL 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,27 +1,30 @@
use strict;
use warnings;
use inc::Module::Install 0.87;
-BEGIN { # Make it easy for newbies
- if ($Module::Install::AUTHOR) {
- require Module::Install::AuthorRequires;
- require Module::Install::CheckConflicts;
- require Module::Install::AuthorTests;
- }
+{ # Ensure that these get used - yes, M::I loads them for us, but if you're
+ # in author mode and don't have them installed, then the error is tres
+ # cryptic.
+ no warnings 'redefine';
+ use Module::Install::AuthorRequires;
+ use Module::Install::CheckConflicts;
+ use Module::Install::AuthorTests;
}
+
perl_version '5.008004';
name 'Catalyst-Runtime';
all_from 'lib/Catalyst/Runtime.pm';
requires 'List::MoreUtils';
-requires 'namespace::autoclean';
+requires 'namespace::autoclean' => '0.09';
requires 'namespace::clean';
requires 'namespace::autoclean';
requires 'B::Hooks::EndOfScope' => '0.08';
-requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00801';
+requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00903';
requires 'Class::MOP' => '0.83';
-requires 'Moose' => '0.78';
-requires 'MooseX::MethodAttributes::Inheritable' => '0.15';
+requires 'Moose' => '0.90';
+requires 'MooseX::MethodAttributes::Inheritable' => '0.17';
+requires 'MooseX::Role::WithOverloading';
requires 'Carp';
requires 'Class::C3::Adopt::NEXT' => '0.07';
requires 'CGI::Simple::Cookie';
@@ -29,8 +32,8 @@
requires 'HTML::Entities';
requires 'HTTP::Body' => '1.04'; # makes uploadtmp work
requires 'HTTP::Headers' => '1.64';
-requires 'HTTP::Request';
-requires 'HTTP::Response';
+requires 'HTTP::Request' => '5.814';
+requires 'HTTP::Response' => '5.813';
requires 'HTTP::Request::AsCGI' => '0.8';
requires 'LWP::UserAgent';
requires 'Module::Pluggable' => '3.9';
@@ -51,6 +54,7 @@
test_requires 'Class::Data::Inheritable';
test_requires 'Test::Exception';
+test_requires 'Test::More' => '0.88';
# aggregate tests if AGGREGATE_TESTS is set and a recent Test::Aggregate and a Test::Simple it works with is available
if ($ENV{AGGREGATE_TESTS} && can_use('Test::Simple', '0.88') && can_use('Test::Aggregate', '0.35_05')) {
@@ -62,6 +66,8 @@
grep { $_ ne 't/aggregate.t' }
map { glob } qw[t/*.t t/aggregate/*.t];
}
+author_requires 'CatalystX::LeakChecker', '0.03'; # Skipped if this isn't installed
+author_requires 'File::Copy::Recursive'; # For http server test
author_tests 't/author';
author_requires(map {; $_ => 0 } qw(
@@ -108,6 +114,7 @@
# NOTE - This is the version number of the _incompatible_ code,
# not the version number of the fixed version.
my %conflicts = (
+ 'Catalyst::Model::Akismet' => '0.02',
'Catalyst::Component::ACCEPT_CONTEXT' => '0.06',
'Catalyst::Plugin::ENV' => '9999', # This plugin is just stupid, full stop
# should have been a core fix.
@@ -146,8 +153,8 @@
# TAR on 10.4 wants COPY_EXTENDED_ATTRIBUTES_DISABLE
# On 10.5 (Leopard) it wants COPYFILE_DISABLE
- die("Oh, you got Snow Lepoard, snazzy. Please read the man page for tar to find out if Apple renamed COPYFILE_DISABLE again and fix this Makefile.PL please?\n") if $osx_ver =~ /^10.6/;
- my $attr = $osx_ver =~ /^10.5/ ? 'COPYFILE_DISABLE' : 'COPY_EXTENDED_ATTRIBUTES_DISABLE';
+ die("Oh, you got Ceiling Cat, snazzy. Please read the man page for tar or Google to find out if Apple renamed COPYFILE_DISABLE (it was COPY_EXTENDED_ATTRIBUTES_DISABLE originally) again and fix this Makefile.PL please?\n") if $osx_ver =~ /^10.7/;
+ my $attr = $osx_ver =~ /^10.(5|6)/ ? 'COPYFILE_DISABLE' : 'COPY_EXTENDED_ATTRIBUTES_DISABLE';
makemaker_args(dist => { PREOP => qq{\@if [ "\$\$$attr" != "true" ]; then}.
qq{ echo "You must set the ENV variable $attr to true,"; }.
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/ClassData.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/ClassData.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/ClassData.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -49,13 +49,15 @@
unless $meta->isa('Class::MOP::Class');
my $was_immutable = $meta->is_immutable;
+ my %immutable_options = $meta->immutable_options;
+
$meta->make_mutable if $was_immutable;
my $alias = "_${attribute}_accessor";
$meta->add_method($alias, $accessor);
$meta->add_method($attribute, $accessor);
- $meta->make_immutable if $was_immutable;
+ $meta->make_immutable(%immutable_options) if $was_immutable;
$class->$attribute($_[2]) if(@_ > 2);
return $accessor;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Component/ContextClosure.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Component/ContextClosure.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Component/ContextClosure.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -22,7 +22,7 @@
package MyApp::Controller::Foo;
use Moose;
- use namespace::autoclean;
+ use namespace::clean -except => 'meta';
BEGIN {
extends 'Catalyst::Controller';
with 'Catalyst::Component::ContextClosure';
@@ -33,7 +33,7 @@
$ctx->stash(a_closure => $self->make_context_closure(sub {
my ($ctx) = @_;
$ctx->response->body('body set from closure');
- }, $ctx);
+ }, $ctx));
}
=head1 DESCRIPTION
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Controller.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Controller.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -2,7 +2,7 @@
use Moose;
use Moose::Util qw/find_meta/;
-
+use List::MoreUtils qw/uniq/;
use namespace::clean -except => 'meta';
BEGIN { extends qw/Catalyst::Component MooseX::MethodAttributes::Inheritable/; }
@@ -29,9 +29,9 @@
predicate => 'has_action_namespace',
);
-has _controller_actions =>
+has actions =>
(
- is => 'rw',
+ accessor => '_controller_actions',
isa => 'HashRef',
init_arg => undef,
);
@@ -200,7 +200,7 @@
. ( ref $self ) )
} keys %{ $self->_controller_actions }
) if ( ref $self );
- return @methods;
+ return uniq @methods;
}
@@ -215,10 +215,13 @@
#this is still not correct for some reason.
my $namespace = $self->action_namespace($c);
- # Uncomment as soon as you fix the tests :)
- #if (!blessed($self) && $self eq $c && scalar(@methods)) {
- # $c->log->warn("Action methods found defined in your application class, $self. This is deprecated, please move them into a Root controller.");
- #}
+ # FIXME - fugly
+ if (!blessed($self) && $self eq $c && scalar(@methods)) {
+ my @really_bad_methods = grep { ! /^_(DISPATCH|BEGIN|AUTO|ACTION|END)$/ } map { $_->name } @methods;
+ if (scalar(@really_bad_methods)) {
+ $c->log->warn("Action methods (" . join(', ', @really_bad_methods) . ") found defined in your application class, $self. This is deprecated, please move them into a Root controller.");
+ }
+ }
foreach my $method (@methods) {
my $name = $method->name;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Dispatcher.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Dispatcher.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -29,7 +29,7 @@
# Note - see back-compat methods at end of file.
has _tree => (is => 'rw', builder => '_build__tree');
-has _dispatch_types => (is => 'rw', default => sub { [] }, required => 1, lazy => 1);
+has dispatch_types => (is => 'rw', default => sub { [] }, required => 1, lazy => 1);
has _registered_dispatch_types => (is => 'rw', default => sub { {} }, required => 1, lazy => 1);
has _method_action_class => (is => 'rw', default => 'Catalyst::Action');
has _action_hash => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
@@ -131,7 +131,7 @@
my (@args, @captures);
if ( ref( $extra_params[-2] ) eq 'ARRAY' ) {
- @captures = @{ pop @extra_params };
+ @captures = @{ splice @extra_params, -2, 1 };
}
if ( ref( $extra_params[-1] ) eq 'ARRAY' ) {
@@ -372,7 +372,7 @@
# Check out dispatch types to see if any will handle the path at
# this level
- foreach my $type ( @{ $self->_dispatch_types } ) {
+ foreach my $type ( @{ $self->dispatch_types } ) {
last DESCEND if $type->match( $c, $path );
}
@@ -470,7 +470,7 @@
sub uri_for_action {
my ( $self, $action, $captures) = @_;
$captures ||= [];
- foreach my $dispatch_type ( @{ $self->_dispatch_types } ) {
+ foreach my $dispatch_type ( @{ $self->dispatch_types } ) {
my $uri = $dispatch_type->uri_for_action( $action, $captures );
return( $uri eq '' ? '/' : $uri )
if defined($uri);
@@ -489,7 +489,7 @@
sub expand_action {
my ($self, $action) = @_;
- foreach my $dispatch_type (@{ $self->_dispatch_types }) {
+ foreach my $dispatch_type (@{ $self->dispatch_types }) {
my $expanded = $dispatch_type->expand_action($action);
return $expanded if $expanded;
}
@@ -518,12 +518,12 @@
# FIXME - Some error checking and re-throwing needed here, as
# we eat exceptions loading dispatch types.
eval { Class::MOP::load_class($class) };
- push( @{ $self->_dispatch_types }, $class->new ) unless $@;
+ push( @{ $self->dispatch_types }, $class->new ) unless $@;
$registered->{$class} = 1;
}
}
- my @dtypes = @{ $self->_dispatch_types };
+ my @dtypes = @{ $self->dispatch_types };
my @normal_dtypes;
my @low_precedence_dtypes;
@@ -647,7 +647,7 @@
if $has_private;
# List all public actions
- $_->list($c) for @{ $self->_dispatch_types };
+ $_->list($c) for @{ $self->dispatch_types };
}
sub _load_dispatch_types {
@@ -662,7 +662,7 @@
eval { Class::MOP::load_class($class) };
Catalyst::Exception->throw( message => qq/Couldn't load "$class"/ )
if $@;
- push @{ $self->_dispatch_types }, $class->new;
+ push @{ $self->dispatch_types }, $class->new;
push @loaded, $class;
}
@@ -684,7 +684,7 @@
# first param is undef because we cannot get the appclass
$name = Catalyst::Utils::resolve_namespace(undef, 'Catalyst::DispatchType', $name);
- for (@{ $self->_dispatch_types }) {
+ for (@{ $self->dispatch_types }) {
return $_ if ref($_) eq $name;
}
return undef;
@@ -722,7 +722,6 @@
# Alias _method_name to method_name, add a before modifier to warn..
foreach my $public_method_name (qw/
tree
- dispatch_types
registered_dispatch_types
method_action_class
action_hash
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Engine/FastCGI.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Engine/FastCGI.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Engine/FastCGI.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -234,7 +234,12 @@
if ( $env->{SERVER_SOFTWARE} =~ /lighttpd/ ) {
$env->{PATH_INFO} ||= delete $env->{SCRIPT_NAME};
}
- # Fix the environment variables PATH_INFO and SCRIPT_NAME when running under IIS
+ elsif ( $env->{SERVER_SOFTWARE} =~ /^nginx/ ) {
+ my $script_name = $env->{SCRIPT_NAME};
+ $env->{PATH_INFO} =~ s/^$script_name//g;
+ }
+ # Fix the environment variables PATH_INFO and SCRIPT_NAME when running
+ # under IIS
elsif ( $env->{SERVER_SOFTWARE} =~ /IIS\/[6-9]\.[0-9]/ ) {
my @script_name = split(m!/!, $env->{PATH_INFO});
my @path_translated = split(m!/|\\\\?!, $env->{PATH_TRANSLATED});
@@ -433,6 +438,76 @@
For more information on using FastCGI under Lighttpd, visit
L<http://www.lighttpd.net/documentation/fastcgi.html>
+=head2 nginx
+
+Catalyst runs under nginx via FastCGI in a similar fashion as the lighttpd
+standalone server as described above.
+
+nginx does not have its own internal FastCGI process manager, so you must run
+the FastCGI service separately.
+
+=head3 Configuration
+
+To configure nginx, you must configure the FastCGI parameters and also the
+socket your FastCGI daemon is listening on. It can be either a TCP socket
+or a Unix file socket.
+
+The server configuration block should look roughly like:
+
+ server {
+ listen $port;
+
+ location / {
+ fastcgi_param QUERY_STRING $query_string;
+ fastcgi_param REQUEST_METHOD $request_method;
+ fastcgi_param CONTENT_TYPE $content_type;
+ fastcgi_param CONTENT_LENGTH $content_length;
+
+ fastcgi_param PATH_INFO $fastcgi_script_name;
+ fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+ fastcgi_param REQUEST_URI $request_uri;
+ fastcgi_param DOCUMENT_URI $document_uri;
+ fastcgi_param DOCUMENT_ROOT $document_root;
+ fastcgi_param SERVER_PROTOCOL $server_protocol;
+
+ fastcgi_param GATEWAY_INTERFACE CGI/1.1;
+ fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
+
+ fastcgi_param REMOTE_ADDR $remote_addr;
+ fastcgi_param REMOTE_PORT $remote_port;
+ fastcgi_param SERVER_ADDR $server_addr;
+ fastcgi_param SERVER_PORT $server_port;
+ fastcgi_param SERVER_NAME $server_name;
+
+ # Adjust the socket for your applications!
+ fastcgi_pass unix:$docroot/myapp.socket;
+ }
+ }
+
+It is the standard convention of nginx to include the fastcgi_params in a
+separate file (usually something like C</etc/nginx/fastcgi_params>) and
+simply include that file.
+
+=head3 Non-root configuration
+
+If you properly specify the PATH_INFO and SCRIPT_NAME parameters your
+application will be accessible at any path. The SCRIPT_NAME variable is the
+prefix of your application, and PATH_INFO would be everything in addition.
+
+As an example, if your application is rooted at /myapp, you would configure:
+
+ fastcgi_param PATH_INFO /myapp/;
+ fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+
+C<$fastcgi_script_name> would be "/myapp/path/of/the/action". Catalyst will
+process this accordingly and setup the application base as expected.
+
+This behavior is somewhat different than Apache and Lighttpd, but is still
+functional.
+
+For more information on nginx, visit:
+L<http://nginx.net>
+
=head2 Microsoft IIS
It is possible to run Catalyst under IIS with FastCGI, but only on IIS 6.0
Added: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Basic.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Basic.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Basic.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,107 @@
+package Catalyst::Exception::Basic;
+
+use MooseX::Role::WithOverloading;
+use Carp;
+use namespace::clean -except => 'meta';
+
+with 'Catalyst::Exception::Interface';
+
+has message => (
+ is => 'ro',
+ isa => 'Str',
+ default => sub { $! || '' },
+);
+
+sub as_string {
+ my ($self) = @_;
+ return $self->message;
+}
+
+around BUILDARGS => sub {
+ my ($next, $class, @args) = @_;
+ if (@args == 1 && !ref $args[0]) {
+ @args = (message => $args[0]);
+ }
+
+ my $args = $class->$next(@args);
+ $args->{message} ||= $args->{error}
+ if exists $args->{error};
+
+ return $args;
+};
+
+sub throw {
+ my $class = shift;
+ my $error = $class->new(@_);
+ local $Carp::CarpLevel = 1;
+ croak $error;
+}
+
+sub rethrow {
+ my ($self) = @_;
+ croak $self;
+}
+
+1;
+
+=head1 NAME
+
+Catalyst::Exception::Basic - Basic Catalyst Exception Role
+
+=head1 SYNOPSIS
+
+ package My::Exception;
+ use Moose;
+ use namespace::clean -except => 'meta';
+
+ with 'Catalyst::Exception::Basic';
+
+ # Elsewhere..
+ My::Exception::Basic->throw( qq/Fatal exception/ );
+
+See also L<Catalyst> and L<Catalyst::Exception>.
+
+=head1 DESCRIPTION
+
+This is the basic Catalyst Exception role which implements all of
+L<Catalyst::Exception::Interface>.
+
+=head1 ATTRIBUTES
+
+=head2 message
+
+Holds the exception message.
+
+=head1 METHODS
+
+=head2 as_string
+
+Stringifies the exception's message attribute.
+Called when the object is stringified by overloading.
+
+=head2 throw( $message )
+
+=head2 throw( message => $message )
+
+=head2 throw( error => $error )
+
+Throws a fatal exception.
+
+=head2 rethrow( $exception )
+
+Rethrows a caught exception.
+
+=head2 meta
+
+Provided by Moose
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Detach.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Detach.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Detach.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -3,7 +3,7 @@
use Moose;
use namespace::clean -except => 'meta';
-extends 'Catalyst::Exception';
+with 'Catalyst::Exception::Basic';
has '+message' => (
default => "catalyst_detach\n",
@@ -19,4 +19,35 @@
Catalyst::Exception::Detach - Exception for redispatching using $ctx->detach()
+=head1 SYNOPSIS
+
+ Do not use this class directly, instead you should use the singleton instance
+ found in $Catalyst::DETACH;
+
+ E.g. die $Catalyst::DETACH
+
+See also L<Catalyst> and L<Catalyst::Exception>.
+
+=head1 DESCRIPTION
+
+This is the class for the Catalyst Exception which is thrown then you call
+C<< $c->detach() >>. There should be a singleton instance of this class in the
+C<< $Catalyst::DETACH >> global variable.
+
+Users should never need to know or care about this exception, please just use
+C<< $c->detach >>
+
+=head2 meta
+
+Provided by Moose
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
=cut
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Go.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Go.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Go.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -3,7 +3,7 @@
use Moose;
use namespace::clean -except => 'meta';
-extends 'Catalyst::Exception';
+with 'Catalyst::Exception::Basic';
has '+message' => (
default => "catalyst_go\n",
@@ -19,4 +19,35 @@
Catalyst::Exception::Go - Exception for redispatching using $ctx->go()
+=head1 SYNOPSIS
+
+ Do not use this class directly, instead you should use the singleton instance
+ found in $Catalyst::GO;
+
+ E.g. die $Catalyst::GO;
+
+See also L<Catalyst> and L<Catalyst::Exception>.
+
+=head1 DESCRIPTION
+
+This is the class for the Catalyst Exception which is thrown then you call
+C<< $c->go() >>. There should be a singleton instance of this class in the
+C<< $Catalyst::DETACH >> global variable.
+
+Users should never need to know or care about this exception, please just use
+C<< $c->detach >>
+
+=head2 meta
+
+Provided by Moose
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
=cut
Added: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Interface.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Interface.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception/Interface.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,69 @@
+package Catalyst::Exception::Interface;
+
+use MooseX::Role::WithOverloading;
+use namespace::clean -except => 'meta';
+
+use overload
+ q{""} => sub { $_[0]->as_string },
+ fallback => 1;
+
+requires qw/as_string throw rethrow/;
+
+1;
+
+__END__
+
+=head1 NAME
+
+Catalyst::Exception::Interface - Exception for redispatching using $ctx->detach()
+
+=head1 SYNOPSIS
+
+ package My::Catalyst::Like::Exception;
+ use Moose;
+ use namespace::clean -except => 'meta';
+
+ # This comprises the required interface.
+ sub as_string { 'the exception text for stringification' }
+ sub die { shift; die @_ }
+ sub die { shift; die @_ }
+
+ with 'Catalyst::Exception::Interface';
+
+See also L<Catalyst> and L<Catalyst::Exception>.
+
+=head1 DESCRIPTION
+
+This is a role for the required interface for Catalyst exceptions.
+
+It ensures that all exceptions follow the expected interface,
+and adds overloading for stringification when composed onto a
+class.
+
+Note that if you compose this role onto another role, that role
+must use L<MooseX::Role::WithOverloading>.
+
+=head1 REQUIRED METHODS
+
+=head2 as_string
+
+=head2 throw
+
+=head2 rethrow
+
+=head1 METHODS
+
+=head2 meta
+
+Provided by Moose
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Exception.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -2,12 +2,6 @@
# XXX: See bottom of file for Exception implementation
-package Catalyst::Exception::Base;
-
-use Moose;
-use Carp;
-use namespace::clean -except => 'meta';
-
=head1 NAME
Catalyst::Exception - Catalyst Exception Class
@@ -32,48 +26,6 @@
Throws a fatal exception.
-=cut
-
-has message => (
- is => 'ro',
- isa => 'Str',
- default => sub { $! || '' },
-);
-
-use overload
- q{""} => \&as_string,
- fallback => 1;
-
-sub as_string {
- my ($self) = @_;
- return $self->message;
-}
-
-around BUILDARGS => sub {
- my ($next, $class, @args) = @_;
- if (@args == 1 && !ref $args[0]) {
- @args = (message => $args[0]);
- }
-
- my $args = $class->$next(@args);
- $args->{message} ||= $args->{error}
- if exists $args->{error};
-
- return $args;
-};
-
-sub throw {
- my $class = shift;
- my $error = $class->new(@_);
- local $Carp::CarpLevel = 1;
- croak $error;
-}
-
-sub rethrow {
- my ($self) = @_;
- croak $self;
-}
-
=head2 meta
Provided by Moose
@@ -89,19 +41,30 @@
=cut
-Catalyst::Exception::Base->meta->make_immutable;
+{
+ package Catalyst::Exception::Base;
-package Catalyst::Exception;
+ use Moose;
+ use namespace::clean -except => 'meta';
-use Moose;
-use namespace::clean -except => 'meta';
+ with 'Catalyst::Exception::Basic';
-use vars qw[$CATALYST_EXCEPTION_CLASS];
-
-BEGIN {
- extends($CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base');
+ __PACKAGE__->meta->make_immutable;
}
-__PACKAGE__->meta->make_immutable;
+{
+ package Catalyst::Exception;
+ use Moose;
+ use namespace::clean -except => 'meta';
+
+ use vars qw[$CATALYST_EXCEPTION_CLASS];
+
+ BEGIN {
+ extends($CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base');
+ }
+
+ __PACKAGE__->meta->make_immutable;
+}
+
1;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Request.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Request.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Request.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -110,7 +110,7 @@
sub body {
my $self = shift;
$self->_context->prepare_body();
- $self->_body(@_) if scalar @_;
+ croak 'body is a reader' if scalar @_;
return blessed $self->_body ? $self->_body->body : $self->_body;
}
@@ -210,7 +210,7 @@
For example, if your action was
- package MyApp::C::Foo;
+ package MyApp::Controller::Foo;
sub moose : Local {
...
@@ -570,7 +570,7 @@
=head2 $req->uri
-Returns a URI object for the current request. Stringifies to the URI text.
+Returns a L<URI> object for the current request. Stringifies to the URI text.
=head2 $req->mangle_params( { key => 'value' }, $appendmode);
@@ -676,7 +676,10 @@
=head2 $req->user
Returns the currently logged in user. B<Highly deprecated>, do not call,
-this will be removed in version 5.81.
+this will be removed in version 5.81. To retrieve the currently authenticated
+user, see C<< $c->user >> and C<< $c->user_exists >> in
+L<Catalyst::Plugin::Authentication>. For the C<REMOTE_USER> provided by the
+webserver, see C<< $req->remote_user >> below.
=head2 $req->remote_user
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Response.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Response.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Response.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -65,7 +65,7 @@
=head1 METHODS
-=head2 $res->body(<$text|$fh|$iohandle_object)
+=head2 $res->body( $text | $fh | $iohandle_object )
$c->response->body('Catalyst rocks!');
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Runtime.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Runtime.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Runtime.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -7,7 +7,7 @@
# Remember to update this in Catalyst as well!
-our $VERSION='5.80011';
+our $VERSION='5.80013';
$VERSION = eval $VERSION;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Test.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Test.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Test.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -228,7 +228,9 @@
$class->handle_request( env => \%ENV );
- return $cgi->restore->response;
+ my $response = $cgi->restore->response;
+ $response->request( $request );
+ return $response;
}
my $agent;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Upgrading.pod
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Upgrading.pod 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Upgrading.pod 2009-11-20 01:09:14 UTC (rev 11931)
@@ -32,7 +32,8 @@
=head2 Controller actions in Moose roles
-Declaring actions in Roles is currently unsupported.
+You can use L<MooseX::MethodAttributes::Role> if you want to declare actions
+inside Moose roles.
=head2 Using Moose in Components
@@ -304,6 +305,43 @@
=head1 WARNINGS
+=head2 Actions in your application class
+
+Having actions in your application class will now emit a warning at application
+startup as this is deprecated. It is highly recommended that these actions are moved
+into a MyApp::Controller::Root (as demonstrated by the scaffold application
+generated by catalyst.pl).
+
+This warning, also affects tests. You should move actions in your test,
+creating a myTest::Controller::Root, like the following example:
+
+ package MyTest::Controller::Root;
+
+ use strict;
+ use warnings;
+
+ use parent 'Catalyst::Controller';
+
+ __PACKAGE__->config(namespace => '');
+
+ sub action : Local {
+ my ( $self, $c ) = @_;
+ $c->do_something;
+ }
+
+ 1;
+
+=head2 ::[MVC]:: naming scheme
+
+Having packages called MyApp::[MVC]::XX is deprecated and can no longer be generated
+by catalyst.pl
+
+This is still supported, but it is recommended that you rename your application
+components to Model/View/Controller.
+
+A warning will be issued at application startup if the ::[MVC]:: naming scheme is
+in use.
+
=head2 Catalyst::Base
Any code using L<Catalyst::Base> will now emit a warning; this
@@ -363,7 +401,7 @@
Calling the plugin method is deprecated, and calling it at run time is B<highly
deprecated>.
-Instead you are recommended to use L< Catalyst::Model::Adaptor > or similar to
+Instead you are recommended to use L<Catalyst::Model::Adaptor> or similar to
compose the functionality you need outside of the main application name space.
Calling the plugin method will not be supported past Catalyst 5.81.
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Utils.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Utils.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst/Utils.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -124,7 +124,7 @@
Returns a tempdir for a class. If create is true it will try to create the path.
My::App becomes /tmp/my/app
- My::App::C::Foo::Bar becomes /tmp/my/app/c/foo/bar
+ My::App::Controller::Foo::Bar becomes /tmp/my/app/c/foo/bar
=cut
@@ -172,8 +172,9 @@
# pop off /lib and /blib if they're there
$home = $home->parent while $home =~ /b?lib$/;
- # only return the dir if it has a Makefile.PL or Build.PL
- if (-f $home->file("Makefile.PL") or -f $home->file("Build.PL")) {
+ # only return the dir if it has a Makefile.PL or Build.PL or dist.ini
+ if (-f $home->file("Makefile.PL") or -f $home->file("Build.PL")
+ or -f $home->file("dist.ini")) {
# clean up relative path:
# MyApp/script/.. -> MyApp
Modified: Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/lib/Catalyst.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -79,7 +79,7 @@
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.80011';
+our $VERSION = '5.80013';
{
my $dev_version = $VERSION =~ /_\d{2}$/;
@@ -349,7 +349,22 @@
your code like this:
$c->forward('foo') || return;
+
+Another note is that C<< $c->forward >> always returns a scalar because it
+actually returns $c->state which operates in a scalar context.
+Thus, something like:
+ return @array;
+
+in an action that is forwarded to is going to return a scalar,
+i.e. how many items are in that array, which is probably not what you want.
+If you need to return an array then return a reference to it,
+or stash it like so:
+
+ $c->stash->{array} = \@array;
+
+and access it from the stash.
+
=cut
sub forward { my $c = shift; no warnings 'recursion'; $c->dispatcher->forward( $c, @_ ) }
@@ -403,13 +418,16 @@
=head2 $c->go( $class, $method, [, \@captures, \@arguments ] )
-Almost the same as L<< detach|/"$c->detach( $action [, \@arguments ] )" >>, but does a full dispatch like L</visit>,
-instead of just calling the new C<$action> /
-C<< $class->$method >>. This means that C<begin>, C<auto> and the
-method you visit are called, just like a new request.
+The relationship between C<go> and
+L<< visit|/"$c->visit( $action [, \@captures, \@arguments ] )" >> is the same as
+the relationship between
+L<< forward|/"$c->forward( $class, $method, [, \@arguments ] )" >> and
+L<< detach|/"$c->detach( $action [, \@arguments ] )" >>. Like C<< $c->visit >>,
+C<< $c->go >> will perform a full dispatch on the specified action or method,
+with localized C<< $c->action >> and C<< $c->namespace >>. Like C<detach>,
+C<go> escapes the processing of the current request chain on completion, and
+does not return to its caller.
-C<< $c->stash >> is kept unchanged.
-
=cut
sub go { my $c = shift; $c->dispatcher->go( $c, @_ ) }
@@ -487,7 +505,9 @@
=head2 $c->state
-Contains the return value of the last executed action.
+Contains the return value of the last executed action.
+Note that << $c->state >> operates in a scalar context which means that all
+values it returns are scalar.
=head2 $c->clear_errors
@@ -532,6 +552,10 @@
# if we were given a regexp to search against, we're done.
return if ref $name;
+ # skip regexp fallback if configured
+ return
+ if $appclass->config->{disable_component_resolution_regex_fallback};
+
# regexp fallback
$query = qr/$name/i;
@result = grep { $eligible{ $_ } =~ m{$query} } keys %eligible;
@@ -549,7 +573,8 @@
(join '", "', @result) . "'. Relying on regexp fallback behavior for " .
"component resolution is unreliable and unsafe.";
my $short = $result[0];
- $short =~ s/.*?Model:://;
+ # remove the component namespace prefix
+ $short =~ s/.*?(Model|Controller|View):://;
my $shortmess = Carp::shortmess('');
if ($shortmess =~ m#Catalyst/Plugin#) {
$msg .= " You probably need to set '$short' instead of '${name}' in this " .
@@ -558,7 +583,7 @@
$msg .= " You probably need to set '$short' instead of '${name}' in this " .
"component's config";
} else {
- $msg .= " You probably meant \$c->${warn_for}('$short') instead of \$c->${warn_for}({'${name}'}), " .
+ $msg .= " You probably meant \$c->${warn_for}('$short') instead of \$c->${warn_for}('${name}'), " .
"but if you really wanted to search, pass in a regexp as the argument " .
"like so: \$c->${warn_for}(qr/${name}/)";
}
@@ -775,6 +800,12 @@
If C<$name> is a regexp, a list of components matched against the full
component name will be returned.
+If Catalyst can't find a component by name, it will fallback to regex
+matching by default. To disable this behaviour set
+disable_component_resolution_regex_fallback to a true value.
+
+ __PACKAGE__->config( disable_component_resolution_regex_fallback => 1 );
+
=cut
sub component {
@@ -1114,7 +1145,6 @@
my $name = $class->config->{name} || 'Application';
$class->log->info("$name powered by Catalyst $Catalyst::VERSION");
}
- $class->log->_flush() if $class->log->can('_flush');
# Make sure that the application class becomes immutable at this point,
B::Hooks::EndOfScope::on_scope_end {
@@ -1134,11 +1164,21 @@
. "Class::Accessor(::Fast)?\nPlease pass "
. "(replace_constructor => 1)\nwhen making your class immutable.\n";
}
- $meta->make_immutable(replace_constructor => 1)
- unless $meta->is_immutable;
+ $meta->make_immutable(
+ replace_constructor => 1,
+ ) unless $meta->is_immutable;
};
+ if ($class->config->{case_sensitive}) {
+ $class->log->warn($class . "->config->{case_sensitive} is set.");
+ $class->log->warn("This setting is deprecated and planned to be removed in Catalyst 5.81.");
+ }
+
$class->setup_finalize;
+ # Should be the last thing we do so that user things hooking
+ # setup_finalize can log..
+ $class->log->_flush() if $class->log->can('_flush');
+ return 1; # Explicit return true as people have __PACKAGE__->setup as the last thing in their class. HATE.
}
@@ -1166,7 +1206,7 @@
$class->setup_finished(1);
}
-=head2 $c->uri_for( $path, @args?, \%query_values? )
+=head2 $c->uri_for( $path?, @args?, \%query_values? )
=head2 $c->uri_for( $action, \@captures?, @args?, \%query_values? )
@@ -1174,6 +1214,10 @@
provided path, and the additional arguments and query parameters provided.
When used as a string, provides a textual URI.
+If no arguments are provided, the URI for the current action is returned.
+To return the current action and also provide @args, use
+C<< $c->uri_for( $c->action, @args ) >>.
+
If the first argument is a string, it is taken as a public URI path relative
to C<< $c->namespace >> (if it doesn't begin with a forward slash) or
relative to the application root (if it does). It is then merged with
@@ -1215,9 +1259,10 @@
}
if ( blessed($path) ) { # action object
- my $captures = ( scalar @args && ref $args[0] eq 'ARRAY'
- ? shift(@args)
- : [] );
+ my $captures = [ map { s|/|%2F|; $_; }
+ ( scalar @args && ref $args[0] eq 'ARRAY'
+ ? @{ shift(@args) }
+ : ()) ];
my $action = $path;
$path = $c->dispatcher->uri_for_action($action, $captures);
if (not defined $path) {
@@ -1235,6 +1280,7 @@
carp "uri_for called with undef argument" if grep { ! defined $_ } @args;
s/([^$URI::uric])/$URI::Escape::escapes{$1}/go for @args;
+ s|/|%2F| for @args;
unshift(@args, $path);
@@ -1597,9 +1643,10 @@
# is this a root-level call or a forwarded call?
if ( $callsub =~ /forward$/ ) {
+ my $parent = $c->stack->[-1];
# forward, locate the caller
- if ( my $parent = $c->stack->[-1] ) {
+ if ( exists $c->counter->{"$parent"} ) {
$c->stats->profile(
begin => $action,
parent => "$parent" . $c->counter->{"$parent"},
@@ -2631,6 +2678,73 @@
sub version { return $Catalyst::VERSION }
+=head1 CONFIGURATION
+
+There are a number of 'base' config variables which can be set:
+
+=over
+
+=item *
+
+C<default_model> - The default model picked if you say C<< $c->model >>. See L</$c->model($name)>.
+
+=item *
+
+C<default_view> - The default view to be rendered or returned when C<< $c->view >>. See L</$c->view($name)>.
+is called.
+
+=item *
+
+C<disable_component_resolution_regex_fallback> - Turns
+off the deprecated component resolution functionality so
+that if any of the component methods (e.g. C<< $c->controller('Foo') >>)
+are called then regex search will not be attempted on string values and
+instead C<undef> will be returned.
+
+=item *
+
+C<home> - The application home directory. In an uninstalled application,
+this is the top level application directory. In an installed application,
+this will be the directory containing C<< MyApp.pm >>.
+
+=item *
+
+C<ignore_frontend_proxy> - See L</PROXY SUPPORT>
+
+=item *
+
+C<name> - The name of the application in debug messages and the debug and
+welcome screens
+
+=item *
+
+C<parse_on_demand> - The request body (for example file uploads) will not be parsed
+until it is accessed. This allows you to (for example) check authentication (and reject
+the upload) before actually recieving all the data. See L</ON-DEMAND PARSER>
+
+=item *
+
+C<root> - The root directory for templates. Usually this is just a
+subdirectory of the home directory, but you can set it to change the
+templates to a different directory.
+
+=item *
+
+C<search_extra> - Array reference passed to Module::Pluggable to for additional
+namespaces from which components will be loaded (and constructed and stored in
+C<< $c->components >>).
+
+=item *
+
+C<show_internal_actions> - If true, causes internal actions such as C<< _DISPATCH >>
+to be shown in hit debug tables in the test server.
+
+=item *
+
+C<using_frontend_proxy> - See L</PROXY SUPPORT>.
+
+=back
+
=head1 INTERNAL ACTIONS
Catalyst uses internal actions like C<_DISPATCH>, C<_BEGIN>, C<_AUTO>,
@@ -2639,16 +2753,6 @@
MyApp->config(show_internal_actions => 1);
-=head1 CASE SENSITIVITY
-
-By default Catalyst is not case sensitive, so C<MyApp::C::FOO::Bar> is
-mapped to C</foo/bar>. You can activate case sensitivity with a config
-parameter.
-
- MyApp->config(case_sensitive => 1);
-
-This causes C<MyApp::C::Foo::Bar> to map to C</Foo/Bar>.
-
=head1 ON-DEMAND PARSER
The request body is usually parsed at the beginning of a request,
@@ -2758,6 +2862,8 @@
acme: Leon Brocard <leon at astray.com>
+abraxxa: Alexander Hartmaier <abraxxa at cpan.org>
+
Andrew Bramble
Andrew Ford E<lt>A.Ford at ford-mason.co.ukE<gt>
@@ -2808,6 +2914,8 @@
Geoff Richards
+groditi: Guillermo Roditi <groditi at gmail.com>
+
hobbs: Andrew Rodland <andrew at cleverdomain.org>
ilmari: Dagfinn Ilmari Mannsåker <ilmari at ilmari.org>
Modified: Catalyst-Runtime/5.80/branches/better_scripts/script/catalyst.pl
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/script/catalyst.pl 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/script/catalyst.pl 2009-11-20 01:09:14 UTC (rev 11931)
@@ -26,14 +26,12 @@
my $help = 0;
my $makefile = 0;
my $scripts = 0;
-my $short = 0;
GetOptions(
'help|?' => \$help,
'force|nonew' => \$force,
'makefile' => \$makefile,
'scripts' => \$scripts,
- 'short' => \$short
);
pod2usage(1) if ( $help || !$ARGV[0] );
@@ -43,7 +41,7 @@
'.newfiles' => !$force,
'makefile' => $makefile,
'scripts' => $scripts,
- 'short' => $short,
+ 'short' => 0, # FIXME - to be removed.
}
);
pod2usage(1) unless $helper->mk_app( $ARGV[0] );
@@ -67,7 +65,6 @@
-help display this help and exit
-makefile only update Makefile.PL
-scripts only update helper scripts
- -short use short names, M/V/C instead of Model/View/Controller.
application-name must be a valid Perl module name and can include "::",
which will be converted to '-' in the project name.
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/c3_appclass_bug.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/c3_appclass_bug.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/c3_appclass_bug.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/c3_appclass_bug.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,30 @@
+use strict;
+use Test::More tests => 1;
+
+{
+ package TestPlugin;
+ use strict;
+
+ sub setup {
+ shift->maybe::next::method(@_);
+ }
+}
+{
+ package TestAppC3ErrorUseMoose;
+ use Moose;
+
+ use Catalyst::Runtime 5.80;
+
+ use base qw/Catalyst/;
+ use Catalyst qw/
+ +TestPlugin
+ /;
+}
+
+use Test::Exception;
+lives_ok {
+ TestAppC3ErrorUseMoose->setup();
+} 'No C3 error';
+
+1;
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/c3_mro.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/c3_mro.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/c3_mro.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/c3_mro.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,38 @@
+use strict;
+use warnings;
+
+use Test::More;
+require Catalyst;
+require Module::Pluggable::Object;
+use MRO::Compat;
+
+# Get a list of all Catalyst:: packages in blib via M::P::O
+my @cat_mods;
+{
+ # problem with @INC on win32, see:
+ # http://rt.cpan.org/Ticket/Display.html?id=26452
+ if ($^O eq 'MSWin32') { require Win32; Win32::GetCwd(); }
+
+ local @INC = grep {/blib/} @INC;
+ @cat_mods = (
+ 'Catalyst',
+ Module::Pluggable::Object->new(search_path => ['Catalyst'])->plugins,
+ );
+}
+
+# plan one test per found package name
+plan tests => scalar @cat_mods;
+
+# Try to calculate the C3 MRO for each package
+#
+# In the case that the initial require fails (as in
+# Catalyst::Engine::FastCGI when FCGI is not installed),
+# the calculateMRO eval will not error out, which is
+# effectively a test skip.
+#
+foreach my $cat_mod (@cat_mods) {
+ eval " require $cat_mod ";
+ eval { mro::get_linear_isa($cat_mod, 'c3') };
+ ok(!$@, "calculateMRO for $cat_mod: $@");
+}
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/caf_backcompat.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/caf_backcompat.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/caf_backcompat.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/caf_backcompat.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,28 @@
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+use Class::MOP ();
+use Moose::Util ();
+
+# List of everything which used Class::Accessor::Fast in 5.70.
+my @modules = qw/
+ Catalyst::Action
+ Catalyst::ActionContainer
+ Catalyst::Component
+ Catalyst::Dispatcher
+ Catalyst::DispatchType
+ Catalyst::Engine
+ Catalyst::Log
+ Catalyst::Request::Upload
+ Catalyst::Request
+ Catalyst::Response
+/;
+
+plan tests => scalar @modules;
+
+foreach my $module (@modules) {
+ Class::MOP::load_class($module);
+ ok Moose::Util::does_role($module => 'MooseX::Emulate::Class::Accessor::Fast'),
+ "$module has Class::Accessor::Fast back-compat";
+}
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/custom_live_component_controller_action_auto_doublebug.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/custom_live_component_controller_action_auto_doublebug.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/custom_live_component_controller_action_auto_doublebug.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/custom_live_component_controller_action_auto_doublebug.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,48 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 3*$iters;
+use Catalyst::Test 'TestAppDoubleAutoBug';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 3;
+ }
+
+ {
+ my @expected = qw[
+ TestAppDoubleAutoBug::Controller::Root->auto
+ TestAppDoubleAutoBug::Controller::Root->default
+ TestAppDoubleAutoBug::Controller::Root->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'default, auto=1', 'Content OK' );
+ }
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/custom_live_path_bug.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/custom_live_path_bug.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/custom_live_path_bug.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/custom_live_path_bug.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,39 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 2*$iters;
+use Catalyst::Test 'TestAppPathBug';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 2;
+ }
+
+ {
+ my $expected = 'This is the foo method.';
+ ok( my $response = request('http://localhost/'), 'response ok' );
+ is( $response->content, $expected, 'Content OK' );
+ }
+ }
+}
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_auto.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_auto.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_auto.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -35,7 +35,7 @@
TestApp::Controller::Action::Auto->begin
TestApp::Controller::Action::Auto->auto
TestApp::Controller::Action::Auto->one
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -52,7 +52,7 @@
TestApp::Controller::Action::Auto->begin
TestApp::Controller::Action::Auto->auto
TestApp::Controller::Action::Auto->default
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -70,7 +70,7 @@
TestApp::Controller::Action::Auto->auto
TestApp::Controller::Action::Auto::Deep->auto
TestApp::Controller::Action::Auto::Deep->one
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -88,7 +88,7 @@
TestApp::Controller::Action::Auto->auto
TestApp::Controller::Action::Auto::Deep->auto
TestApp::Controller::Action::Auto::Deep->default
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_begin.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_begin.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_begin.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -30,7 +30,7 @@
TestApp::Controller::Action::Begin->begin
TestApp::Controller::Action::Begin->default
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_chained.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_chained.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_chained.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -10,7 +10,7 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 148*$iters;
+use Test::More;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
@@ -815,7 +815,7 @@
my @expected = qw[
TestApp::Controller::Action::Chained::Root->rootsub
TestApp::Controller::Action::Chained::Root->endpointsub
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -1018,5 +1018,31 @@
'request with URI-encoded arg' );
like( $content, qr{foo/bar;\z}, 'args decoded' );
}
+
+ # Test round tripping, specifically the / character %2F in uri_for:
+ # not being able to feed it back action + captureargs and args into uri for
+ # and result in the original request uri is a major piece of suck ;)
+ foreach my $thing (
+ ['foo', 'bar'],
+ ['foo%2Fbar', 'baz'],
+ ['foo', 'bar%2Fbaz'],
+ ['foo%2Fbar', 'baz%2Fquux'],
+ ['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz' => 'quux%2Ffrood'}],
+ ['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz%2Ffnoo' => 'quux%2Ffrood'}],
+ ) {
+ my $path = '/chained/roundtrip_urifor/' .
+ $thing->[0] . '/' . $thing->[1];
+ $path .= '?' . join('&',
+ map { $_ .'='. $thing->[2]->{$_}}
+ sort keys %{$thing->[2]}) if $thing->[2];
+ ok( my $content =
+ get('http://localhost/' . $path),
+ 'request ' . $path . ' ok');
+ # Just check that the path matches, as who the hell knows or cares
+ # where the app is based (live tests etc)
+ ok( index($content, $path) > 1, 'uri can round trip through uri_for' );
+ }
}
+done_testing;
+
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_default.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_default.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_default.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -29,7 +29,7 @@
TestApp::Controller::Action::Default->begin
TestApp::Controller::Action::Default->default
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -76,7 +76,7 @@
my @expected = qw[
TestApp::Controller::Action->begin
TestApp::Controller::Action->default
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_detach.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_detach.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_detach.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -30,7 +30,7 @@
TestApp::Controller::Action::Detach->one
TestApp::Controller::Action::Detach->two
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -57,7 +57,7 @@
TestApp::Controller::Action::Detach->path
TestApp::Controller::Action::Detach->two
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_forward.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_forward.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_forward.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -33,7 +33,7 @@
TestApp::Controller::Action::Forward->four
TestApp::Controller::Action::Forward->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -81,7 +81,7 @@
TestApp::Controller::Action::Forward->four
TestApp::Controller::Action::Forward->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -156,7 +156,7 @@
TestApp::Controller::Action::Forward->four
TestApp::Controller::Action::Forward->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -191,7 +191,7 @@
TestApp::Controller::Action::Forward->four
TestApp::Controller::Action::Forward->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_go.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_go.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_go.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -43,7 +43,7 @@
TestApp::Controller::Action::Go->four
TestApp::Controller::Action::Go->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -74,7 +74,7 @@
my @expected = qw[
TestApp::Controller::Action::Go->go_die
TestApp::Controller::Action::Go->args
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -165,7 +165,7 @@
TestApp::Controller::Action::Go->four
TestApp::Controller::Action::Go->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -200,7 +200,7 @@
TestApp::Controller::Action::Go->four
TestApp::Controller::Action::Go->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -262,7 +262,7 @@
ok( my $response = request('http://localhost/action/go/go_chained'), 'go to chained + subcontroller endpoint' );
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
- is( $response->content, 'arg1, arg2; captureme', 'Content OK' );
+ is( $response->content, 'captureme; arg1, arg2', 'Content OK' );
}
}
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_index.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_index.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_index.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -27,8 +27,8 @@
# test root index
{
my @expected = qw[
- TestApp->index
- TestApp->end
+ TestApp::Controller::Root->index
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -45,7 +45,7 @@
{
my @expected = qw[
TestApp::Controller::Index->index
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -66,7 +66,7 @@
my @expected = qw[
TestApp::Controller::Action::Index->begin
TestApp::Controller::Action::Index->index
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -87,7 +87,7 @@
my @expected = qw[
TestApp::Controller::Action::Index->begin
TestApp::Controller::Action::Index->default
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_visit.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_visit.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_component_controller_action_visit.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -42,11 +42,11 @@
TestApp::Controller::Action::Visit->four
TestApp::Controller::Action::Visit->five
TestApp::View::Dump::Request->process
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -76,8 +76,8 @@
my @expected = qw[
TestApp::Controller::Action::Visit->visit_die
TestApp::Controller::Action::Visit->args
- TestApp->end
- TestApp->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -166,12 +166,12 @@
TestApp::Controller::Action::Visit->four
TestApp::Controller::Action::Visit->five
TestApp::View::Dump::Request->process
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -206,12 +206,12 @@
TestApp::Controller::Action::Visit->four
TestApp::Controller::Action::Visit->five
TestApp::View::Dump::Request->process
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -266,7 +266,7 @@
TestApp::Controller::Action::Chained->foo
TestApp::Controller::Action::Chained::Foo->spoon
TestApp::Controller::Action::Chained->end
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -276,7 +276,7 @@
"visit to chained + subcontroller endpoint for $i" );
is( $response->header('X-Catalyst-Executed'),
$expected, "Executed actions for $i" );
- is( $response->content, "arg1, arg2; becomescapture",
+ is( $response->content, "becomescapture; arg1, arg2",
"Content OK for $i" );
}
}
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_engine_request_body.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_engine_request_body.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_engine_request_body.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -80,13 +80,13 @@
# 5.80 regression, see note in Catalyst::Plugin::Test::Plugin
{
my $request = GET(
- 'http://localhost/have_req_body_in_prepare_action',
+ 'http://localhost/dump/response',
'Content-Type' => 'text/plain',
'Content' => 'x' x 100_000
);
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
- like( $response->content, qr/^[1-9]/, 'Has body' );
+ ok( $response->header('X-Have-Request-Body'), 'X-Have-Request-Body set' );
}
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_engine_request_escaped_path.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_engine_request_escaped_path.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/live_engine_request_escaped_path.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -54,8 +54,6 @@
}
# test that request with URL-escaped code works.
-TODO: {
- local $TODO = 'Actions should match when path parts are url encoded';
my $request = Catalyst::Utils::request( 'http://localhost/args/param%73/one/two' );
my $cgi = HTTP::Request::AsCGI->new( $request, %ENV )->setup;
@@ -67,6 +65,8 @@
TestApp->handle_request( env => \%ENV );
ok( my $response = $cgi->restore->response );
+TODO: {
+ local $TODO = 'Actions should match when path parts are url encoded';
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->content, 'onetwo' );
}
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/meta_method_unneeded.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/meta_method_unneeded.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/meta_method_unneeded.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/meta_method_unneeded.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,20 @@
+use strict;
+use warnings;
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+use Test::More tests => 1;
+use Test::Exception;
+use Carp ();
+
+# Doing various silly things, like for example
+# use CGI qw/:standard/ in your conrtoller / app
+# will overwrite your meta method, therefore Catalyst
+# can't depend on it being there correctly.
+
+# This is/was demonstrated by Catalyst::Controller::WrapCGI
+# and Catalyst::Plugin::Cache::Curried
+
+use Catalyst::Test 'TestAppWithMeta';
+
+ok( request('/')->is_success );
+
Added: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_actions.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_actions.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_actions.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+use Test::More tests => 4;
+
+use Catalyst ();
+{
+ package TestController;
+ use Moose;
+ BEGIN { extends 'Catalyst::Controller' }
+
+ sub action : Local {}
+
+ sub foo : Path {}
+
+ no Moose;
+}
+
+my $mock_app = Class::MOP::Class->create_anon_class( superclasses => ['Catalyst'] );
+my $app = $mock_app->name->new;
+my $controller = TestController->new($app, {actions => { foo => { Path => '/some/path' }}});
+
+ok $controller->can('_controller_actions');
+is_deeply $controller->_controller_actions => { foo => { Path => '/some/path' }};
+is_deeply $controller->{actions} => { foo => { Path => '/some/path' }}; # Back compat.
+is_deeply [ sort grep { ! /^_/ } map { $_->name } $controller->get_action_methods ], [sort qw/action foo/];
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_config.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_controller_config.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_config.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_config.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,91 @@
+## ============================================================================
+## Test to make sure that subclassed controllers (catalyst controllers
+## that inherit from a custom base catalyst controller) don't experienc
+## any namespace collision in the values under config.
+## ============================================================================
+
+use Test::More tests => 9;
+
+use strict;
+use warnings;
+
+use_ok('Catalyst');
+
+## ----------------------------------------------------------------------------
+## First We define a base controller that inherits from Catalyst::Controller
+## We add something to the config that we expect all children classes to
+## be able to find.
+## ----------------------------------------------------------------------------
+
+{
+ package base_controller;
+
+ use base 'Catalyst::Controller';
+
+ __PACKAGE__->config( base_key => 'base_value' );
+}
+
+## ----------------------------------------------------------------------------
+## Next we instantiate two classes that inherit from the base controller. We
+## Add some local config information to these.
+## ----------------------------------------------------------------------------
+
+{
+ package controller_a;
+
+ use base 'base_controller';
+
+ __PACKAGE__->config( key_a => 'value_a' );
+}
+
+
+{
+ package controller_b;
+
+ use base 'base_controller';
+
+ __PACKAGE__->config->{key_b} = 'value_b';
+}
+
+## Okay, we expect that the base controller has a config with one key
+## and that the two children controllers inherit that config key and then
+## add one more. So the base controller has one config value and the two
+## children each have two.
+
+## ----------------------------------------------------------------------------
+## THE TESTS. Basically we first check to make sure that all the children of
+## the base_controller properly inherit the {base_key => 'base_value'} info
+## and that each of the children also has its local config data and that none
+## of the classes have data that is unexpected.
+## ----------------------------------------------------------------------------
+
+
+# First round, does everything have what we expect to find? If these tests fail there is something
+# wrong with the way config is storing its information.
+
+ok( base_controller->config->{base_key} eq 'base_value', 'base_controller has expected config value for "base_key"') or
+ diag('"base_key" defined as "'.base_controller->config->{base_key}.'" and not "base_value" in config');
+
+ok( controller_a->config->{base_key} eq 'base_value', 'controller_a has expected config value for "base_key"') or
+ diag('"base_key" defined as "'.controller_a->config->{base_key}.'" and not "base_value" in config');
+
+ok( controller_a->config->{key_a} eq 'value_a', 'controller_a has expected config value for "key_a"') or
+ diag('"key_a" defined as "'.controller_a->config->{key_a}.'" and not "value_a" in config');
+
+ok( controller_b->config->{base_key} eq 'base_value', 'controller_b has expected config value for "base_key"') or
+ diag('"base_key" defined as "'.controller_b->config->{base_key}.'" and not "base_value" in config');
+
+ok( controller_b->config->{key_b} eq 'value_b', 'controller_b has expected config value for "key_b"') or
+ diag('"key_b" defined as "'.controller_b->config->{key_b}.'" and not "value_b" in config');
+
+# second round, does each controller have the expected number of config values? If this test fails there is
+# probably some data collision between the controllers.
+
+ok( scalar(keys %{base_controller->config}) == 1, 'base_controller has the expected number of config values') or
+ diag("base_controller should have 1 config value, but it has ".scalar(keys %{base_controller->config}));
+
+ok( scalar(keys %{controller_a->config}) == 2, 'controller_a has the expected number of config values') or
+ diag("controller_a should have 2 config value, but it has ".scalar(keys %{base_controller->config}));
+
+ok( scalar(keys %{controller_b->config}) == 2, 'controller_b has the expected number of config values') or
+ diag("controller_a should have 2 config value, but it has ".scalar(keys %{base_controller->config}));
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_namespace.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_controller_namespace.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_namespace.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_controller_namespace.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+BEGIN {
+ package MyApp::Controller::Foo;
+
+ use base qw/Catalyst::Controller/;
+
+ package MyApp::Controller::Root;
+
+ use base qw/Catalyst::Controller/;
+
+ __PACKAGE__->config(namespace => '');
+
+ package Stub;
+
+ sub config { {} };
+}
+
+is(MyApp::Controller::Foo->action_namespace('Stub'), 'foo');
+
+is(MyApp::Controller::Root->action_namespace('Stub'), '');
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_action.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_action.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_action.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_action.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,54 @@
+use Test::More tests => 6;
+use strict;
+use warnings;
+use Moose::Meta::Class;
+#use Moose::Meta::Attribute;
+use Catalyst::Request;
+
+use_ok('Catalyst::Action');
+
+my $action_1 = Catalyst::Action->new(
+ name => 'foo',
+ code => sub { "DUMMY" },
+ reverse => 'bar/foo',
+ namespace => 'bar',
+ attributes => {
+ Args => [ 1 ],
+ attr2 => [ 2 ],
+ },
+);
+
+my $action_2 = Catalyst::Action->new(
+ name => 'foo',
+ code => sub { "DUMMY" },
+ reverse => 'bar/foo',
+ namespace => 'bar',
+ attributes => {
+ Args => [ 2 ],
+ attr2 => [ 2 ],
+ },
+);
+
+is("${action_1}", $action_1->reverse, 'overload string');
+is($action_1->(), 'DUMMY', 'overload code');
+
+my $anon_meta = Moose::Meta::Class->create_anon_class(
+ attributes => [
+ Moose::Meta::Attribute->new(
+ request => (
+ reader => 'request',
+ required => 1,
+ default => sub { Catalyst::Request->new(arguments => [qw/one two/]) },
+ ),
+ ),
+ ],
+ methods => { req => sub { shift->request(@_) } }
+);
+
+my $mock_c = $anon_meta->new_object();
+$mock_c->request;
+
+ok(!$action_1->match($mock_c), 'bad match fails');
+ok($action_2->match($mock_c), 'good match works');
+
+ok($action_2->compare( $action_1 ), 'compare works');
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_action_for.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_action_for.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_action_for.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -12,7 +12,7 @@
use_ok('TestApp');
-is(TestApp->action_for('global_action')->code, TestApp->can('global_action'),
+is(TestApp->action_for('global_action')->code, TestApp::Controller::Root->can('global_action'),
'action_for on appclass ok');
is(TestApp->controller('Args')->action_for('args')->code,
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_classdata.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_classdata.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_classdata.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_classdata.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,106 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Scalar::Util qw/refaddr blessed/;
+use Test::More tests => 37;
+
+{
+ package ClassDataTest;
+ use Moose;
+ with 'Catalyst::ClassData';
+
+ package ClassDataTest2;
+ use Moose;
+ extends 'ClassDataTest';
+
+}
+
+ my $scalar = '100';
+ my $arrayref = [];
+ my $hashref = {};
+ my $scalarref = \$scalar;
+ my $coderef = sub { "beep" };
+
+ my $scalar2 = '200';
+ my $arrayref2 = [];
+ my $hashref2 = {};
+ my $scalarref2 = \$scalar2;
+ my $coderef2 = sub { "beep" };
+
+ my $scalar3 = '300';
+ my $arrayref3 = [];
+ my $hashref3 = {};
+ my $scalarref3 = \$scalar3;
+ my $coderef3 = sub { "beep" };
+
+
+my @accessors = qw/_arrayref _hashref _scalarref _coderef _scalar/;
+ClassDataTest->mk_classdata($_) for @accessors;
+can_ok('ClassDataTest', @accessors);
+
+ClassDataTest2->mk_classdata("beep", "meep");
+is(ClassDataTest2->beep, "meep");
+
+ClassDataTest->_arrayref($arrayref);
+ClassDataTest->_hashref($hashref);
+ClassDataTest->_scalarref($scalarref);
+ClassDataTest->_coderef($coderef);
+ClassDataTest->_scalar($scalar);
+
+is(ref(ClassDataTest->_arrayref), 'ARRAY');
+is(ref(ClassDataTest->_hashref), 'HASH');
+is(ref(ClassDataTest->_scalarref), 'SCALAR');
+is(ref(ClassDataTest->_coderef), 'CODE');
+ok( !ref(ClassDataTest->_scalar) );
+is(refaddr(ClassDataTest->_arrayref), refaddr($arrayref));
+is(refaddr(ClassDataTest->_hashref), refaddr($hashref));
+is(refaddr(ClassDataTest->_scalarref), refaddr($scalarref));
+is(refaddr(ClassDataTest->_coderef), refaddr($coderef));
+is(ClassDataTest->_scalar, $scalar);
+
+
+is(ref(ClassDataTest2->_arrayref), 'ARRAY');
+is(ref(ClassDataTest2->_hashref), 'HASH');
+is(ref(ClassDataTest2->_scalarref), 'SCALAR');
+is(ref(ClassDataTest2->_coderef), 'CODE');
+ok( !ref(ClassDataTest2->_scalar) );
+is(refaddr(ClassDataTest2->_arrayref), refaddr($arrayref));
+is(refaddr(ClassDataTest2->_hashref), refaddr($hashref));
+is(refaddr(ClassDataTest2->_scalarref), refaddr($scalarref));
+is(refaddr(ClassDataTest2->_coderef), refaddr($coderef));
+is(ClassDataTest2->_scalar, $scalar);
+
+ClassDataTest2->_arrayref($arrayref2);
+ClassDataTest2->_hashref($hashref2);
+ClassDataTest2->_scalarref($scalarref2);
+ClassDataTest2->_coderef($coderef2);
+ClassDataTest2->_scalar($scalar2);
+
+is(refaddr(ClassDataTest2->_arrayref), refaddr($arrayref2));
+is(refaddr(ClassDataTest2->_hashref), refaddr($hashref2));
+is(refaddr(ClassDataTest2->_scalarref), refaddr($scalarref2));
+is(refaddr(ClassDataTest2->_coderef), refaddr($coderef2));
+is(ClassDataTest2->_scalar, $scalar2);
+
+is(refaddr(ClassDataTest->_arrayref), refaddr($arrayref));
+is(refaddr(ClassDataTest->_hashref), refaddr($hashref));
+is(refaddr(ClassDataTest->_scalarref), refaddr($scalarref));
+is(refaddr(ClassDataTest->_coderef), refaddr($coderef));
+is(ClassDataTest->_scalar, $scalar);
+
+ClassDataTest->_arrayref($arrayref3);
+ClassDataTest->_hashref($hashref3);
+ClassDataTest->_scalarref($scalarref3);
+ClassDataTest->_coderef($coderef3);
+ClassDataTest->_scalar($scalar3);
+
+is(refaddr(ClassDataTest->_arrayref), refaddr($arrayref3));
+is(refaddr(ClassDataTest->_hashref), refaddr($hashref3));
+is(refaddr(ClassDataTest->_scalarref), refaddr($scalarref3));
+is(refaddr(ClassDataTest->_coderef), refaddr($coderef3));
+is(ClassDataTest->_scalar, $scalar3);
+
+my $i = bless {}, 'ClassDataTest';
+$i->_scalar('foo');
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,93 @@
+use Test::More tests => 22;
+use strict;
+use warnings;
+
+use_ok('Catalyst');
+
+my @complist = map { "MyApp::$_"; } qw/C::Controller M::Model V::View/;
+
+{
+ package MyApp;
+
+ use base qw/Catalyst/;
+
+ __PACKAGE__->components({ map { ($_, $_) } @complist });
+
+ # this is so $c->log->warn will work
+ __PACKAGE__->setup_log;
+}
+
+is(MyApp->comp('MyApp::V::View'), 'MyApp::V::View', 'Explicit return ok');
+
+is(MyApp->comp('C::Controller'), 'MyApp::C::Controller', 'Two-part return ok');
+
+is(MyApp->comp('Model'), 'MyApp::M::Model', 'Single part return ok');
+
+is_deeply([ MyApp->comp() ], \@complist, 'Empty return ok');
+
+# Is this desired behaviour?
+is_deeply([ MyApp->comp('Foo') ], \@complist, 'Fallthrough return ok');
+
+# regexp behavior
+{
+ is_deeply( [ MyApp->comp( qr{Model} ) ], [ 'MyApp::M::Model'], 'regexp ok' );
+ is_deeply( [ MyApp->comp('MyApp::V::View$') ], [ 'MyApp::V::View' ], 'Explicit return ok');
+ is_deeply( [ MyApp->comp('MyApp::C::Controller$') ], [ 'MyApp::C::Controller' ], 'Explicit return ok');
+ is_deeply( [ MyApp->comp('MyApp::M::Model$') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
+
+ # a couple other varieties for regexp fallback
+ is_deeply( [ MyApp->comp('M::Model') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
+
+ {
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ is_deeply( [ MyApp->comp('::M::Model') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
+ ok( $warnings, 'regexp fallback warnings' );
+
+ $warnings = 0;
+ is_deeply( [ MyApp->comp('Mode') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
+ ok( $warnings, 'regexp fallback warnings' );
+
+ $warnings = 0;
+ is(MyApp->comp('::M::'), 'MyApp::M::Model', 'Regex return ok');
+ ok( $warnings, 'regexp fallback for comp() warns' );
+ }
+
+}
+
+# multiple returns
+{
+ my @expected = sort qw( MyApp::C::Controller MyApp::M::Model );
+ my @got = sort MyApp->comp( qr{::[MC]::} );
+ is_deeply( \@got, \@expected, 'multiple results from regexp ok' );
+}
+
+# failed search
+{
+ is_deeply( scalar MyApp->comp( qr{DNE} ), 0, 'no results for failed search' );
+}
+
+
+#checking @args passed to ACCEPT_CONTEXT
+{
+ my $args;
+
+ {
+ no warnings 'once';
+ *MyApp::M::Model::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
+ }
+
+ my $c = bless {}, 'MyApp';
+
+ $c->component('MyApp::M::Model', qw/foo bar/);
+ is_deeply($args, [qw/foo bar/], 'args passed to ACCEPT_CONTEXT ok');
+
+ $c->component('M::Model', qw/foo2 bar2/);
+ is_deeply($args, [qw/foo2 bar2/], 'args passed to ACCEPT_CONTEXT ok');
+
+ $c->component('Mode', qw/foo3 bar3/);
+ is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok');
+}
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component_loading.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component_loading.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component_loading.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component_loading.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,235 @@
+# 2 initial tests, and 6 per component in the loop below
+# (do not forget to update the number of components in test 3 as well)
+# 5 extra tests for the loading options
+# One test for components in inner packages
+use Test::More tests => 2 + 6 * 24 + 8 + 1;
+
+use strict;
+use warnings;
+
+use File::Spec;
+use File::Path;
+
+my $libdir = 'test_trash';
+local @INC = @INC;
+unshift(@INC, $libdir);
+
+my $appclass = 'TestComponents';
+my @components = (
+ { type => 'Controller', prefix => 'C', name => 'Bar' },
+ { type => 'Controller', prefix => 'C', name => 'Foo::Bar' },
+ { type => 'Controller', prefix => 'C', name => 'Foo::Foo::Bar' },
+ { type => 'Controller', prefix => 'C', name => 'Foo::Foo::Foo::Bar' },
+ { type => 'Controller', prefix => 'Controller', name => 'Bar::Bar::Bar::Foo' },
+ { type => 'Controller', prefix => 'Controller', name => 'Bar::Bar::Foo' },
+ { type => 'Controller', prefix => 'Controller', name => 'Bar::Foo' },
+ { type => 'Controller', prefix => 'Controller', name => 'Foo' },
+ { type => 'Model', prefix => 'M', name => 'Bar' },
+ { type => 'Model', prefix => 'M', name => 'Foo::Bar' },
+ { type => 'Model', prefix => 'M', name => 'Foo::Foo::Bar' },
+ { type => 'Model', prefix => 'M', name => 'Foo::Foo::Foo::Bar' },
+ { type => 'Model', prefix => 'Model', name => 'Bar::Bar::Bar::Foo' },
+ { type => 'Model', prefix => 'Model', name => 'Bar::Bar::Foo' },
+ { type => 'Model', prefix => 'Model', name => 'Bar::Foo' },
+ { type => 'Model', prefix => 'Model', name => 'Foo' },
+ { type => 'View', prefix => 'V', name => 'Bar' },
+ { type => 'View', prefix => 'V', name => 'Foo::Bar' },
+ { type => 'View', prefix => 'V', name => 'Foo::Foo::Bar' },
+ { type => 'View', prefix => 'V', name => 'Foo::Foo::Foo::Bar' },
+ { type => 'View', prefix => 'View', name => 'Bar::Bar::Bar::Foo' },
+ { type => 'View', prefix => 'View', name => 'Bar::Bar::Foo' },
+ { type => 'View', prefix => 'View', name => 'Bar::Foo' },
+ { type => 'View', prefix => 'View', name => 'Foo' },
+);
+
+sub write_component_file {
+ my ($dir_list, $module_name, $content) = @_;
+
+ my $dir = File::Spec->catdir(@$dir_list);
+ my $file = File::Spec->catfile($dir, $module_name . '.pm');
+
+ mkpath(join(q{/}, @$dir_list) );
+ open(my $fh, '>', $file) or die "Could not open file $file for writing: $!";
+ print $fh $content;
+ close $fh;
+}
+
+sub make_component_file {
+ my ($libdir, $appclass, $type, $prefix, $name) = @_;
+
+ my $compbase = "Catalyst::${type}";
+ my $fullname = "${appclass}::${prefix}::${name}";
+ my @namedirs = split(/::/, $name);
+ my $name_final = pop(@namedirs);
+ my @dir_list = ($libdir, $appclass, $prefix, @namedirs);
+
+ write_component_file(\@dir_list, $name_final, <<EOF);
+package $fullname;
+use MRO::Compat;
+use base '$compbase';
+sub COMPONENT {
+ my \$self = shift->next::method(\@_);
+ no strict 'refs';
+ *{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; };
+ \$self;
+}
+1;
+
+EOF
+}
+
+foreach my $component (@components) {
+ make_component_file(
+ $libdir,
+ $appclass,
+ $component->{type},
+ $component->{prefix},
+ $component->{name},
+ );
+}
+
+my $shut_up_deprecated_warnings = q{
+ __PACKAGE__->log(Catalyst::Log->new('fatal'));
+};
+
+eval "package $appclass; use Catalyst; $shut_up_deprecated_warnings __PACKAGE__->setup";
+
+can_ok( $appclass, 'components');
+
+my $complist = $appclass->components;
+
+# the +1 below is for the app class itself
+is(scalar keys %$complist, 24+1, "Correct number of components loaded");
+
+foreach (keys %$complist) {
+
+ # Skip the component which happens to be the app itself
+ next if $_ eq $appclass;
+
+ my $instance = $appclass->component($_);
+ isa_ok($instance, $_);
+ can_ok($instance, 'whoami');
+ is($instance->whoami, $_);
+
+ if($_ =~ /^${appclass}::(?:V|View)::(.*)/) {
+ my $moniker = $1;
+ isa_ok($instance, 'Catalyst::View');
+ can_ok($appclass->view($moniker), 'whoami');
+ is($appclass->view($moniker)->whoami, $_);
+ }
+ elsif($_ =~ /^${appclass}::(?:M|Model)::(.*)/) {
+ my $moniker = $1;
+ isa_ok($instance, 'Catalyst::Model');
+ can_ok($appclass->model($moniker), 'whoami');
+ is($appclass->model($moniker)->whoami, $_);
+ }
+ elsif($_ =~ /^${appclass}::(?:C|Controller)::(.*)/) {
+ my $moniker = $1;
+ isa_ok($instance, 'Catalyst::Controller');
+ can_ok($appclass->controller($moniker), 'whoami');
+ is($appclass->controller($moniker)->whoami, $_);
+ }
+ else {
+ die "Something is wrong with this test, this should"
+ . " have been unreachable";
+ }
+}
+
+rmtree($libdir);
+
+# test extra component loading options
+
+$appclass = 'ExtraOptions';
+push @components, { type => 'View', prefix => 'Extra', name => 'Foo' };
+
+foreach my $component (@components) {
+ make_component_file(
+ $libdir,
+ $appclass,
+ $component->{type},
+ $component->{prefix},
+ $component->{name},
+ );
+}
+
+eval qq(
+package $appclass;
+use Catalyst;
+$shut_up_deprecated_warnings
+__PACKAGE__->config->{ setup_components } = {
+ search_extra => [ '::Extra' ],
+ except => [ "${appclass}::Controller::Foo" ]
+};
+__PACKAGE__->setup;
+);
+
+can_ok( $appclass, 'components');
+
+$complist = $appclass->components;
+
+is(scalar keys %$complist, 24+1, "Correct number of components loaded");
+
+ok( !exists $complist->{ "${appclass}::Controller::Foo" }, 'Controller::Foo was skipped' );
+ok( exists $complist->{ "${appclass}::Extra::Foo" }, 'Extra::Foo was loaded' );
+
+rmtree($libdir);
+
+$appclass = "ComponentOnce";
+
+write_component_file([$libdir, $appclass, 'Model'], 'TopLevel', <<EOF);
+package ${appclass}::Model::TopLevel;
+use base 'Catalyst::Model';
+sub COMPONENT {
+
+ my \$self = shift->next::method(\@_);
+ no strict 'refs';
+ *{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; };
+ *${appclass}::Model::TopLevel::GENERATED::ACCEPT_CONTEXT = sub {
+ return bless {}, 'FooBarBazQuux';
+ };
+ \$self;
+}
+
+package ${appclass}::Model::TopLevel::Nested;
+
+sub COMPONENT { die "COMPONENT called in the wrong order!"; }
+
+1;
+
+EOF
+
+write_component_file([$libdir, $appclass, 'Model', 'TopLevel'], 'Nested', <<EOF);
+package ${appclass}::Model::TopLevel::Nested;
+use base 'Catalyst::Model';
+
+my \$called=0;
+no warnings 'redefine';
+sub COMPONENT { \$called++;return shift->next::method(\@_); }
+sub called { return \$called };
+1;
+
+EOF
+
+eval "package $appclass; use Catalyst; __PACKAGE__->setup";
+
+is($@, '', "Didn't load component twice");
+is($appclass->model('TopLevel::Nested')->called,1, 'COMPONENT called once');
+
+ok($appclass->model('TopLevel::Generated'), 'Have generated model');
+is(ref($appclass->model('TopLevel::Generated')), 'FooBarBazQuux',
+ 'ACCEPT_CONTEXT in generated inner package fired as expected');
+
+$appclass = "InnerComponent";
+
+{
+ package InnerComponent::Controller::Test;
+ use base 'Catalyst::Controller';
+}
+
+$INC{'InnerComponent/Controller/Test.pm'} = 1;
+
+eval "package $appclass; use Catalyst; __PACKAGE__->setup";
+
+isa_ok($appclass->controller('Test'), 'Catalyst::Controller');
+
+rmtree($libdir);
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component_mro.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component_mro.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component_mro.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_component_mro.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,29 @@
+use Test::More tests => 1;
+use strict;
+use warnings;
+
+{
+ package MyApp::Component;
+ use Test::More;
+
+ sub COMPONENT {
+ fail 'This no longer gets dispatched to';
+ }
+
+ package MyApp::MyComponent;
+
+ use base 'Catalyst::Component', 'MyApp::Component';
+
+}
+
+my $warn = '';
+{
+ local $SIG{__WARN__} = sub {
+ $warn .= $_[0];
+ };
+ MyApp::MyComponent->COMPONENT('MyApp');
+}
+
+like($warn, qr/after Catalyst::Component in MyApp::Component/,
+ 'correct warning thrown');
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_engine_fixenv-iis6.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_engine_fixenv-iis6.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_engine_fixenv-iis6.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_engine_fixenv-iis6.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,62 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+eval "use FCGI";
+plan skip_all => 'FCGI required' if $@;
+
+plan tests => 2;
+
+require Catalyst::Engine::FastCGI;
+
+my %env = (
+ 'SCRIPT_NAME' => '/koo/blurb',
+ 'PATH_INFO' => '/koo/blurb',
+ 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
+ 'REQUEST_METHOD' => 'GET',
+ 'SCRIPT_FILENAME' => 'C:\\Foo\\script\\blurb',
+ 'INSTANCE_META_PATH' => '/LM/W3SVC/793536',
+ 'SERVER_SOFTWARE' => 'Microsoft-IIS/6.0',
+ 'AUTH_PASSWORD' => '',
+ 'AUTH_TYPE' => '',
+ 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows; U; Windows NT 5.2; de; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 (.NET CLR 3.5.30729)',
+ 'REMOTE_PORT' => '1281',
+ 'QUERY_STRING' => '',
+ 'URL' => '/koo/blurb',
+ 'HTTP_ACCEPT_LANGUAGE' => 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3',
+ 'FCGI_ROLE' => 'RESPONDER',
+ 'HTTP_KEEP_ALIVE' => '300',
+ 'CONTENT_TYPE' => '',
+ 'LOCAL_ADDR' => '127.0.0.1',
+ 'GATEWAY_INTERFACE' => 'CGI/1.1',
+ 'HTTPS' => 'off',
+ 'DOCUMENT_ROOT' => 'C:\\Foo\\script',
+ 'REMOTE_HOST' => '127.0.0.1',
+ 'PATH_TRANSLATED' => 'C:\\Foo\\script\\blurb',
+ 'APPL_PHYSICAL_PATH' => 'C:\\Foo\\script\\',
+ 'SERVER_NAME' => '127.0.0.1',
+ 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
+ 'HTTP_CONNECTION' => 'keep-alive',
+ 'INSTANCE_ID' => '793536',
+ 'CONTENT_LENGTH' => '0',
+ 'AUTH_USER' => '',
+ 'APPL_MD_PATH' => '/LM/W3SVC/793536/Root/koo',
+ 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
+ 'REMOTE_USER' => '',
+ 'SERVER_PORT_SECURE' => '0',
+ 'SERVER_PORT' => 83,
+ 'REMOTE_ADDR' => '127.0.0.1',
+ 'SERVER_PROTOCOL' => 'HTTP/1.1',
+ 'REQUEST_URI' => '/koo/blurb',
+ 'APP_POOL_ID' => 'DefaultAppPool',
+ 'HTTP_HOST' => '127.0.0.1:83'
+);
+
+Catalyst::Engine::FastCGI->_fix_env(\%env);
+
+is($env{PATH_INFO}, '//blurb', 'check PATH_INFO');
+is($env{SCRIPT_NAME}, '/koo', 'check SCRIPT_NAME');
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_engine_fixenv-lighttpd.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_engine_fixenv-lighttpd.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_engine_fixenv-lighttpd.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_engine_fixenv-lighttpd.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,46 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+eval "use FCGI";
+plan skip_all => 'FCGI required' if $@;
+
+plan tests => 2;
+
+require Catalyst::Engine::FastCGI;
+
+my %env = (
+ 'SCRIPT_NAME' => '/bar',
+ 'SERVER_NAME' => 'localhost:8000',
+ 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
+ 'HTTP_CONNECTION' => 'keep-alive',
+ 'PATH_INFO' => '',
+ 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
+ 'REQUEST_METHOD' => 'GET',
+ 'SCRIPT_FILENAME' => '/tmp/Foo/root/bar',
+ 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
+ 'SERVER_SOFTWARE' => 'lighttpd/1.4.15',
+ 'QUERY_STRING' => '',
+ 'REMOTE_PORT' => '22207',
+ 'SERVER_PORT' => 8000,
+ 'REDIRECT_STATUS' => '200',
+ 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5',
+ 'REMOTE_ADDR' => '127.0.0.1',
+ 'FCGI_ROLE' => 'RESPONDER',
+ 'HTTP_KEEP_ALIVE' => '300',
+ 'SERVER_PROTOCOL' => 'HTTP/1.1',
+ 'REQUEST_URI' => '/bar',
+ 'GATEWAY_INTERFACE' => 'CGI/1.1',
+ 'SERVER_ADDR' => '127.0.0.1',
+ 'DOCUMENT_ROOT' => '/tmp/Foo/root',
+ 'HTTP_HOST' => 'localhost:8000',
+);
+
+Catalyst::Engine::FastCGI->_fix_env(\%env);
+
+is($env{PATH_INFO}, '/bar', 'check PATH_INFO');
+ok(!exists($env{SCRIPT_NAME}), 'check SCRIPT_NAME');
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_log.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_log.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_log.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_log.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,69 @@
+use strict;
+use warnings;
+
+use Test::More tests => 22;
+
+use Catalyst::Log;
+
+local *Catalyst::Log::_send_to_log;
+local our @MESSAGES;
+{
+ no warnings 'redefine';
+ *Catalyst::Log::_send_to_log = sub {
+ my $self = shift;
+ push @MESSAGES, @_;
+ };
+}
+
+my $LOG = 'Catalyst::Log';
+
+can_ok $LOG, 'new';
+ok my $log = $LOG->new, '... and creating a new log object should succeed';
+isa_ok $log, $LOG, '... and the object it returns';
+
+can_ok $log, 'is_info';
+ok $log->is_info, '... and the default behavior is to allow info messages';
+
+can_ok $log, 'info';
+ok $log->info('hello there!'),
+ '... passing it an info message should succeed';
+
+can_ok $log, "_flush";
+$log->_flush;
+ok @MESSAGES, '... and flushing the log should succeed';
+is scalar @MESSAGES, 1, '... with one log message';
+like $MESSAGES[0], qr/^\[info\] hello there!$/,
+ '... which should match the format we expect';
+
+{
+
+ package Catalyst::Log::Subclass;
+ use base qw/Catalyst::Log/;
+
+ sub _send_to_log {
+ my $self = shift;
+ push @MESSAGES, '---';
+ push @MESSAGES, @_;
+ }
+}
+
+my $SUBCLASS = 'Catalyst::Log::Subclass';
+can_ok $SUBCLASS, 'new';
+ok $log = Catalyst::Log::Subclass->new,
+ '... and the log subclass constructor shoudl return a new object';
+isa_ok $log, $SUBCLASS, '... and the object it returns';
+isa_ok $log, $LOG, '... and it also';
+
+can_ok $log, 'info';
+ok $log->info('hi there!'),
+ '... passing it an info message should succeed';
+
+can_ok $log, "_flush";
+ at MESSAGES = (); # clear the message log
+$log->_flush;
+ok @MESSAGES, '... and flushing the log should succeed';
+is scalar @MESSAGES, 2, '... with two log messages';
+is $MESSAGES[0], '---', '... with the first one being our new data';
+like $MESSAGES[1], qr/^\[info\] hi there!$/,
+ '... which should match the format we expect';
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_merge_config_hashes.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_merge_config_hashes.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_merge_config_hashes.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_merge_config_hashes.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,43 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+my @tests = (
+ {
+ given => [ { a => 1 }, { b => 1 } ],
+ expects => { a => 1, b => 1 }
+ },
+ {
+ given => [ { a => 1 }, { a => { b => 1 } } ],
+ expects => { a => { b => 1 } }
+ },
+ {
+ given => [ { a => { b => 1 } }, { a => 1 } ],
+ expects => { a => 1 }
+ },
+ {
+ given => [ { a => 1 }, { a => [ 1 ] } ],
+ expects => { a => [ 1 ] }
+ },
+ {
+ given => [ { a => [ 1 ] }, { a => 1 } ],
+ expects => { a => 1 }
+ },
+ {
+ given => [ { a => { b => 1 } }, { a => { b => 2 } } ],
+ expects => { a => { b => 2 } }
+ },
+ {
+ given => [ { a => { b => 1 } }, { a => { c => 1 } } ],
+ expects => { a => { b => 1, c => 1 } }
+ },
+);
+
+plan tests => scalar @tests;
+
+use Catalyst::Component;
+
+for my $test ( @ tests ) {
+ is_deeply( Catalyst::Component->merge_config_hashes( @{ $test->{ given } } ), $test->{ expects } );
+}
Added: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_mvc.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_mvc.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_mvc.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,227 @@
+use Test::More tests => 51;
+use strict;
+use warnings;
+
+use_ok('Catalyst');
+
+my @complist =
+ map { "MyMVCTestApp::$_"; }
+ qw/C::Controller M::Model V::View Controller::C Model::M View::V Controller::Model::Dummy::Model Model::Dummy::Model/;
+
+{
+
+ package MyMVCTestApp;
+
+ use base qw/Catalyst/;
+
+ __PACKAGE__->components( { map { ( ref($_)||$_ , $_ ) } @complist } );
+
+ my $thingie={};
+ bless $thingie, 'Some::Test::Object';
+ __PACKAGE__->components->{'MyMVCTestApp::Model::Test::Object'} = $thingie;
+
+ # allow $c->log->warn to work
+ __PACKAGE__->setup_log;
+}
+
+is( MyMVCTestApp->view('View'), 'MyMVCTestApp::V::View', 'V::View ok' );
+
+is( MyMVCTestApp->controller('Controller'),
+ 'MyMVCTestApp::C::Controller', 'C::Controller ok' );
+
+is( MyMVCTestApp->model('Model'), 'MyMVCTestApp::M::Model', 'M::Model ok' );
+
+is( MyMVCTestApp->model('Dummy::Model'), 'MyMVCTestApp::Model::Dummy::Model', 'Model::Dummy::Model ok' );
+
+isa_ok( MyMVCTestApp->model('Test::Object'), 'Some::Test::Object', 'Test::Object ok' );
+
+is( MyMVCTestApp->controller('Model::Dummy::Model'), 'MyMVCTestApp::Controller::Model::Dummy::Model', 'Controller::Model::Dummy::Model ok' );
+
+is( MyMVCTestApp->view('V'), 'MyMVCTestApp::View::V', 'View::V ok' );
+
+is( MyMVCTestApp->controller('C'), 'MyMVCTestApp::Controller::C', 'Controller::C ok' );
+
+is( MyMVCTestApp->model('M'), 'MyMVCTestApp::Model::M', 'Model::M ok' );
+
+# failed search
+{
+ is( MyMVCTestApp->model('DNE'), undef, 'undef for invalid search' );
+}
+
+is_deeply( [ sort MyMVCTestApp->views ],
+ [ qw/V View/ ],
+ 'views ok' );
+
+is_deeply( [ sort MyMVCTestApp->controllers ],
+ [ qw/C Controller Model::Dummy::Model/ ],
+ 'controllers ok');
+
+is_deeply( [ sort MyMVCTestApp->models ],
+ [ qw/Dummy::Model M Model Test::Object/ ],
+ 'models ok');
+
+{
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ like (MyMVCTestApp->view , qr/^MyMVCTestApp\::(V|View)\::/ , 'view() with no defaults returns *something*');
+ ok( $warnings, 'view() w/o a default is random, warnings thrown' );
+}
+
+is ( bless ({stash=>{current_view=>'V'}}, 'MyMVCTestApp')->view , 'MyMVCTestApp::View::V', 'current_view ok');
+
+my $view = bless {} , 'MyMVCTestApp::View::V';
+is ( bless ({stash=>{current_view_instance=> $view }}, 'MyMVCTestApp')->view , $view, 'current_view_instance ok');
+
+is ( bless ({stash=>{current_view_instance=> $view, current_view=>'MyMVCTestApp::V::View' }}, 'MyMVCTestApp')->view , $view,
+ 'current_view_instance precedes current_view ok');
+
+{
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ ok( my $model = MyMVCTestApp->model );
+
+ ok( (($model =~ /^MyMVCTestApp\::(M|Model)\::/) ||
+ $model->isa('Some::Test::Object')),
+ 'model() with no defaults returns *something*' );
+
+ ok( $warnings, 'model() w/o a default is random, warnings thrown' );
+}
+
+is ( bless ({stash=>{current_model=>'M'}}, 'MyMVCTestApp')->model , 'MyMVCTestApp::Model::M', 'current_model ok');
+
+my $model = bless {} , 'MyMVCTestApp::Model::M';
+is ( bless ({stash=>{current_model_instance=> $model }}, 'MyMVCTestApp')->model , $model, 'current_model_instance ok');
+
+is ( bless ({stash=>{current_model_instance=> $model, current_model=>'MyMVCTestApp::M::Model' }}, 'MyMVCTestApp')->model , $model,
+ 'current_model_instance precedes current_model ok');
+
+MyMVCTestApp->config->{default_view} = 'V';
+is ( bless ({stash=>{}}, 'MyMVCTestApp')->view , 'MyMVCTestApp::View::V', 'default_view ok');
+is ( MyMVCTestApp->view , 'MyMVCTestApp::View::V', 'default_view in class method ok');
+
+MyMVCTestApp->config->{default_model} = 'M';
+is ( bless ({stash=>{}}, 'MyMVCTestApp')->model , 'MyMVCTestApp::Model::M', 'default_model ok');
+is ( MyMVCTestApp->model , 'MyMVCTestApp::Model::M', 'default_model in class method ok');
+
+# regexp behavior tests
+{
+ # is_deeply is used because regexp behavior means list context
+ is_deeply( [ MyMVCTestApp->view( qr{^V[ie]+w$} ) ], [ 'MyMVCTestApp::V::View' ], 'regexp view ok' );
+ is_deeply( [ MyMVCTestApp->controller( qr{Dummy\::Model$} ) ], [ 'MyMVCTestApp::Controller::Model::Dummy::Model' ], 'regexp controller ok' );
+ is_deeply( [ MyMVCTestApp->model( qr{Dum{2}y} ) ], [ 'MyMVCTestApp::Model::Dummy::Model' ], 'regexp model ok' );
+
+ # object w/ qr{}
+ is_deeply( [ MyMVCTestApp->model( qr{Test} ) ], [ MyMVCTestApp->components->{'MyMVCTestApp::Model::Test::Object'} ], 'Object returned' );
+
+ {
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ # object w/ regexp fallback
+ is_deeply( [ MyMVCTestApp->model( 'Test' ) ], [ MyMVCTestApp->components->{'MyMVCTestApp::Model::Test::Object'} ], 'Object returned' );
+ ok( $warnings, 'regexp fallback warnings' );
+ }
+
+ is_deeply( [ MyMVCTestApp->view('MyMVCTestApp::V::View$') ], [ 'MyMVCTestApp::V::View' ], 'Explicit return ok');
+ is_deeply( [ MyMVCTestApp->controller('MyMVCTestApp::C::Controller$') ], [ 'MyMVCTestApp::C::Controller' ], 'Explicit return ok');
+ is_deeply( [ MyMVCTestApp->model('MyMVCTestApp::M::Model$') ], [ 'MyMVCTestApp::M::Model' ], 'Explicit return ok');
+}
+
+{
+ my @expected = qw( MyMVCTestApp::C::Controller MyMVCTestApp::Controller::C );
+ is_deeply( [ sort MyMVCTestApp->controller( qr{^C} ) ], \@expected, 'multiple controller returns from regexp search' );
+}
+
+{
+ my @expected = qw( MyMVCTestApp::V::View MyMVCTestApp::View::V );
+ is_deeply( [ sort MyMVCTestApp->view( qr{^V} ) ], \@expected, 'multiple view returns from regexp search' );
+}
+
+{
+ my @expected = qw( MyMVCTestApp::M::Model MyMVCTestApp::Model::M );
+ is_deeply( [ sort MyMVCTestApp->model( qr{^M} ) ], \@expected, 'multiple model returns from regexp search' );
+}
+
+# failed search
+{
+ is( scalar MyMVCTestApp->controller( qr{DNE} ), 0, '0 results for failed search' );
+}
+
+#checking @args passed to ACCEPT_CONTEXT
+{
+ my $args;
+
+ {
+ no warnings 'once';
+ *MyMVCTestApp::Model::M::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
+ *MyMVCTestApp::View::V::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
+ }
+
+ my $c = bless {}, 'MyMVCTestApp';
+
+ # test accept-context with class rather than instance
+ MyMVCTestApp->model('M', qw/foo bar/);
+ is_deeply($args, [qw/foo bar/], 'MyMVCTestApp->model args passed to ACCEPT_CONTEXT ok');
+
+
+ $c->model('M', qw/foo bar/);
+ is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok');
+
+ my $x = $c->view('V', qw/foo2 bar2/);
+ is_deeply($args, [qw/foo2 bar2/], '$c->view args passed to ACCEPT_CONTEXT ok');
+
+ # regexp fallback
+ $c->view('::View::V', qw/foo3 bar3/);
+ is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok');
+
+
+}
+
+{
+ my $warn = '';
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warn .= $_[1] };
+
+ is_deeply (MyMVCTestApp->controller('MyMVCTestApp::Controller::C'),
+ MyMVCTestApp->components->{'MyMVCTestApp::Controller::C'},
+ 'controller by fully qualified name ok');
+
+ # You probably meant $c->controller('C') instead of $c->controller({'MyMVCTestApp::Controller::C'})
+ my ($suggested_comp_name, $orig_comp_name) = $warn =~ /You probably meant (.*) instead of (.*) /;
+ isnt($suggested_comp_name, $orig_comp_name, 'suggested fix in warning for fully qualified component names makes sense' );
+}
+
+{
+ package MyApp::WithoutRegexFallback;
+
+ use base qw/Catalyst/;
+
+ __PACKAGE__->config( { disable_component_resolution_regex_fallback => 1 } );
+
+ __PACKAGE__->components( { map { ( ref($_)||$_ , $_ ) }
+ qw/MyApp::WithoutRegexFallback::Controller::Another::Foo/ } );
+
+ # allow $c->log->warn to work
+ __PACKAGE__->setup_log;
+}
+
+{
+ # test if non-regex component retrieval still works
+ is( MyApp::WithoutRegexFallback->controller('Another::Foo'),
+ 'MyApp::WithoutRegexFallback::Controller::Another::Foo', 'controller Another::Foo found');
+}
+
+{
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ # try to get nonexisting object w/o regexp fallback
+ is( MyApp::WithoutRegexFallback->controller('Foo'), undef, 'no controller Foo found');
+ ok( !$warnings, 'no regexp fallback warnings' );
+}
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_path_to.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_path_to.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_path_to.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_path_to.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,39 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+my %non_unix = (
+ MacOS => 1,
+ MSWin32 => 1,
+ os2 => 1,
+ VMS => 1,
+ epoc => 1,
+ NetWare => 1,
+ dos => 1,
+ cygwin => 1
+);
+
+my $os = $non_unix{$^O} ? $^O : 'Unix';
+
+if( $os ne 'Unix' ) {
+ plan skip_all => 'tests require Unix';
+}
+else {
+ plan tests => 3;
+}
+
+use_ok('Catalyst');
+
+my $context = 'Catalyst';
+
+my $config = Catalyst->config;
+
+$config->{home} = '/home/sri/my-app/';
+
+is( Catalyst::path_to( $context, 'foo' ), '/home/sri/my-app/foo', 'Unix path' );
+
+$config->{home} = '/Users/sri/myapp/';
+
+is( Catalyst::path_to( $context, 'foo', 'bar' ),
+ '/Users/sri/myapp/foo/bar', 'deep Unix path' );
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_plugin.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_plugin.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_plugin.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_plugin.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 24;
+
+use lib 't/lib';
+
+{
+
+ package Faux::Plugin;
+
+ sub new { bless { count => 1 }, shift }
+ sub count { shift->{count}++ }
+}
+
+my $warnings = 0;
+
+use PluginTestApp;
+my $logger = Class::MOP::Class->create_anon_class(
+ methods => {
+ error => sub {0},
+ debug => sub {0},
+ info => sub {0},
+ warn => sub {
+ if ($_[1] =~ /plugin method is deprecated/) {
+ $warnings++;
+ return;
+ }
+ die "Caught unexpected warning: " . $_[1];
+ },
+ },
+)->new_object;
+PluginTestApp->log($logger);
+
+use Catalyst::Test qw/PluginTestApp/;
+
+ok( get("/compile_time_plugins"), "get ok" );
+is( $warnings, 0, 'no warnings' );
+# FIXME - Run time plugin support is insane, and should be removed
+# for Catalyst 5.9
+ok( get("/run_time_plugins"), "get ok" );
+
+local $ENV{CATALYST_DEBUG} = 0;
+
+is( $warnings, 1, '1 warning' );
+
+use_ok 'TestApp';
+my @expected = qw(
+ Catalyst::Plugin::Test::Errors
+ Catalyst::Plugin::Test::Headers
+ Catalyst::Plugin::Test::Inline
+ Catalyst::Plugin::Test::MangleDollarUnderScore
+ Catalyst::Plugin::Test::Plugin
+ TestApp::Plugin::AddDispatchTypes
+ TestApp::Plugin::FullyQualified
+);
+
+# Faux::Plugin is no longer reported
+is_deeply [ TestApp->registered_plugins ], \@expected,
+ 'registered_plugins() should only report the plugins for the current class';
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,88 @@
+use strict;
+use warnings;
+use Class::MOP::Class;
+use Catalyst::Runtime;
+
+use Test::More tests => 29;
+
+{
+ # Silence the log.
+ my $meta = Catalyst::Log->meta;
+ $meta->make_mutable;
+ $meta->remove_method('_send_to_log');
+ $meta->add_method('_send_to_log', sub {});
+}
+
+sub build_test_app_with_setup {
+ my ($name, @flags) = @_;
+ my $flags = '(' . join(', ', map { "'".$_."'" } @flags) . ')';
+ $flags = '' if $flags eq '()';
+ eval qq{
+ package $name;
+ use Catalyst $flags;
+ $name->setup;
+ };
+ die $@ if $@;
+ return $name;
+}
+
+local %ENV = %ENV;
+
+# Remove all relevant env variables to avoid accidental fail
+foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) {
+ delete $ENV{$name};
+}
+
+{
+ my $app = build_test_app_with_setup('TestAppMyTestDebug', '-Debug');
+
+ ok my $c = $app->new, 'Get debug app object';
+ ok my $log = $c->log, 'Get log object';
+ isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
+ ok $log->is_warn, 'Warnings should be enabled';
+ ok $log->is_error, 'Errors should be enabled';
+ ok $log->is_fatal, 'Fatal errors should be enabled';
+ ok $log->is_info, 'Info should be enabled';
+ ok $log->is_debug, 'Debugging should be enabled';
+ ok $app->debug, 'debug method should return true';
+}
+
+{
+ my $app = build_test_app_with_setup('TestAppMyTestLogParam', '-Log=warn,error,fatal');
+
+ ok my $c = $app->new, 'Get log app object';
+ ok my $log = $c->log, 'Get log object';
+ isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
+ ok $log->is_warn, 'Warnings should be enabled';
+ ok $log->is_error, 'Errors should be enabled';
+ ok $log->is_fatal, 'Fatal errors should be enabled';
+ ok !$log->is_info, 'Info should be disabled';
+ ok !$log->is_debug, 'Debugging should be disabled';
+ ok !$c->debug, 'Catalyst debugging is off';
+}
+{
+ my $app = build_test_app_with_setup('TestAppMyTestNoParams');
+
+ ok my $c = $app->new, 'Get log app object';
+ ok my $log = $c->log, 'Get log object';
+ isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
+ ok $log->is_warn, 'Warnings should be enabled';
+ ok $log->is_error, 'Errors should be enabled';
+ ok $log->is_fatal, 'Fatal errors should be enabled';
+ ok $log->is_info, 'Info should be enabled';
+ ok $log->is_debug, 'Debugging should be enabled';
+ ok !$c->debug, 'Catalyst debugging turned off';
+}
+my $log_meta = Class::MOP::Class->create_anon_class(
+ methods => { map { $_ => sub { 0 } } qw/debug error fatal info warn/ },
+);
+{
+ package TestAppWithOwnLogger;
+ use base qw/Catalyst/;
+ __PACKAGE__->log($log_meta->new_object);
+ __PACKAGE__->setup('-Debug');
+}
+
+ok my $c = TestAppWithOwnLogger->new, 'Get with own logger app object';
+ok $c->debug, '$c->debug is true';
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup_log.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup_log.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup_log.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup_log.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,101 @@
+use strict;
+use warnings;
+
+use Test::More tests => 30;
+use Test::Exception;
+
+use Catalyst ();
+
+sub mock_app {
+ my $name = shift;
+ print "Setting up mock application: $name\n";
+ my $meta = Moose->init_meta( for_class => $name );
+ $meta->superclasses('Catalyst');
+ return $meta->name;
+}
+
+sub test_log_object {
+ my ($log, %expected) = @_;
+ foreach my $level (keys %expected) {
+ my $method_name = "is_$level";
+ if ($expected{$level}) {
+ ok( $log->$method_name(), "Level $level on" );
+ }
+ else {
+ ok( !$log->$method_name(), "Level $level off" );
+ }
+ }
+}
+
+local %ENV = %ENV;
+
+# Remove all relevant env variables to avoid accidental fail
+foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) {
+ delete $ENV{$name};
+}
+
+{
+ my $app = mock_app('TestAppParseLogLevels');
+ $app->setup_log('error,warn');
+ ok !$app->debug, 'Not in debug mode';
+ test_log_object($app->log,
+ fatal => 1,
+ error => 1,
+ warn => 1,
+ info => 0,
+ debug => 0,
+ );
+}
+{
+ local %ENV = %ENV;
+ $ENV{CATALYST_DEBUG} = 1;
+ my $app = mock_app('TestAppLogDebugEnvSet');
+ $app->setup_log('');
+ ok $app->debug, 'In debug mode';
+ test_log_object($app->log,
+ fatal => 1,
+ error => 1,
+ warn => 1,
+ info => 1,
+ debug => 1,
+ );
+}
+{
+ local %ENV = %ENV;
+ $ENV{CATALYST_DEBUG} = 0;
+ my $app = mock_app('TestAppLogDebugEnvUnset');
+ $app->setup_log('warn');
+ ok !$app->debug, 'Not In debug mode';
+ test_log_object($app->log,
+ fatal => 1,
+ error => 1,
+ warn => 1,
+ info => 0,
+ debug => 0,
+ );
+}
+{
+ my $app = mock_app('TestAppLogEmptyString');
+ $app->setup_log('');
+ ok !$app->debug, 'Not In debug mode';
+ # Note that by default, you get _all_ the log levels turned on
+ test_log_object($app->log,
+ fatal => 1,
+ error => 1,
+ warn => 1,
+ info => 1,
+ debug => 1,
+ );
+}
+{
+ my $app = mock_app('TestAppLogDebugOnly');
+ $app->setup_log('debug');
+ ok $app->debug, 'In debug mode';
+ test_log_object($app->log,
+ fatal => 1,
+ error => 1,
+ warn => 1,
+ info => 1,
+ debug => 1,
+ );
+}
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup_stats.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup_stats.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup_stats.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_setup_stats.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,70 @@
+use strict;
+use warnings;
+
+use Test::More tests => 5;
+use Class::MOP::Class;
+
+use Catalyst ();
+
+local our %log_messages; # TODO - Test log messages as expected.
+my $mock_log = Class::MOP::Class->create_anon_class(
+ methods => {
+ map { my $level = $_;
+ $level => sub {
+ $log_messages{$level} ||= [];
+ push(@{ $log_messages{$level} }, $_[1]);
+ },
+ }
+ qw/debug info warn error fatal/,
+ },
+)->new_object;
+
+sub mock_app {
+ my $name = shift;
+ my $mock_log = shift;
+ %log_messages = (); # Flatten log messages.
+ my $meta = Moose->init_meta( for_class => $name );
+ $meta->superclasses('Catalyst');
+ $meta->add_method('log', sub { $mock_log });
+ return $meta->name;
+}
+
+local %ENV = %ENV;
+
+# Remove all relevant env variables to avoid accidental fail
+foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) {
+ delete $ENV{$name};
+}
+
+{
+ my $app = mock_app('TestAppNoStats', $mock_log);
+ $app->setup_stats();
+ ok !$app->use_stats, 'stats off by default';
+}
+{
+ my $app = mock_app('TestAppStats', $mock_log);
+ $app->setup_stats(1);
+ ok $app->use_stats, 'stats on if you say >setup_stats(1)';
+}
+{
+ my $app = mock_app('TestAppStatsDebugTurnsStatsOn', $mock_log);
+ $app->meta->add_method('debug' => sub { 1 });
+ $app->setup_stats();
+ ok $app->use_stats, 'debug on turns stats on';
+}
+{
+ local %ENV = %ENV;
+ $ENV{CATALYST_STATS} = 1;
+ my $app = mock_app('TestAppStatsEnvSet', $mock_log);
+ $app->setup_stats();
+ ok $app->use_stats, 'ENV turns stats on';
+}
+{
+ local %ENV = %ENV;
+ $ENV{CATALYST_STATS} = 0;
+ my $app = mock_app('TestAppStatsEnvUnset', $mock_log);
+ $app->meta->add_method('debug' => sub { 1 });
+ $app->setup_stats(1);
+ ok !$app->use_stats, 'ENV turns stats off, even when debug on and ->setup_stats(1)';
+}
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_uri_for.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_uri_for.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_uri_for.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_uri_for.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,145 @@
+use strict;
+use warnings;
+
+use Test::More tests => 20;
+use URI;
+
+use_ok('Catalyst');
+
+my $request = Catalyst::Request->new( {
+ base => URI->new('http://127.0.0.1/foo')
+ } );
+
+my $context = Catalyst->new( {
+ request => $request,
+ namespace => 'yada',
+ } );
+
+is(
+ Catalyst::uri_for( $context, '/bar/baz' )->as_string,
+ 'http://127.0.0.1/foo/bar/baz',
+ 'URI for absolute path'
+);
+
+is(
+ Catalyst::uri_for( $context, 'bar/baz' )->as_string,
+ 'http://127.0.0.1/foo/yada/bar/baz',
+ 'URI for relative path'
+);
+
+is(
+ Catalyst::uri_for( $context, '', 'arg1', 'arg2' )->as_string,
+ 'http://127.0.0.1/foo/yada/arg1/arg2',
+ 'URI for undef action with args'
+);
+
+
+is( Catalyst::uri_for( $context, '../quux' )->as_string,
+ 'http://127.0.0.1/foo/quux', 'URI for relative dot path' );
+
+is(
+ Catalyst::uri_for( $context, 'quux', { param1 => 'value1' } )->as_string,
+ 'http://127.0.0.1/foo/yada/quux?param1=value1',
+ 'URI for undef action with query params'
+);
+
+is (Catalyst::uri_for( $context, '/bar/wibble?' )->as_string,
+ 'http://127.0.0.1/foo/bar/wibble%3F', 'Question Mark gets encoded'
+);
+
+is( Catalyst::uri_for( $context, qw/bar wibble?/, 'with space' )->as_string,
+ 'http://127.0.0.1/foo/yada/bar/wibble%3F/with%20space', 'Space gets encoded'
+);
+
+is(
+ Catalyst::uri_for( $context, '/bar', 'with+plus', { 'also' => 'with+plus' })->as_string,
+ 'http://127.0.0.1/foo/bar/with+plus?also=with%2Bplus',
+ 'Plus is not encoded'
+);
+
+# test with utf-8
+is(
+ Catalyst::uri_for( $context, 'quux', { param1 => "\x{2620}" } )->as_string,
+ 'http://127.0.0.1/foo/yada/quux?param1=%E2%98%A0',
+ 'URI for undef action with query params in unicode'
+);
+is(
+ Catalyst::uri_for( $context, 'quux', { 'param:1' => "foo" } )->as_string,
+ 'http://127.0.0.1/foo/yada/quux?param%3A1=foo',
+ 'URI for undef action with query params in unicode'
+);
+
+# test with object
+is(
+ Catalyst::uri_for( $context, 'quux', { param1 => $request->base } )->as_string,
+ 'http://127.0.0.1/foo/yada/quux?param1=http%3A%2F%2F127.0.0.1%2Ffoo',
+ 'URI for undef action with query param as object'
+);
+
+$request->base( URI->new('http://localhost:3000/') );
+$request->match( 'orderentry/contract' );
+is(
+ Catalyst::uri_for( $context, '/Orderentry/saveContract' )->as_string,
+ 'http://localhost:3000/Orderentry/saveContract',
+ 'URI for absolute path'
+);
+
+{
+ $request->base( URI->new('http://127.0.0.1/') );
+
+ $context->namespace('');
+
+ is( Catalyst::uri_for( $context, '/bar/baz' )->as_string,
+ 'http://127.0.0.1/bar/baz', 'URI with no base or match' );
+
+ # test "0" as the path
+ is( Catalyst::uri_for( $context, qw/0 foo/ )->as_string,
+ 'http://127.0.0.1/0/foo', '0 as path is ok'
+ );
+
+}
+
+# test with undef -- no warnings should be thrown
+{
+ my $warnings = 0;
+ local $SIG{__WARN__} = sub { $warnings++ };
+
+ Catalyst::uri_for( $context, '/bar/baz', { foo => undef } )->as_string,
+ is( $warnings, 0, "no warnings emitted" );
+}
+
+# Test with parameters '/', 'foo', 'bar' - should not generate a //
+is( Catalyst::uri_for( $context, qw| / foo bar | )->as_string,
+ 'http://127.0.0.1/foo/bar', 'uri is /foo/bar, not //foo/bar'
+);
+
+TODO: {
+ local $TODO = 'RFCs are for people who, erm - fix this test..';
+ # Test rfc3986 reserved characters. These characters should all be escaped
+ # according to the RFC, but it is a very big feature change so I've removed it
+ no warnings; # Yes, everything in qw is sane
+ is(
+ Catalyst::uri_for( $context, qw|! * ' ( ) ; : @ & = $ / ? % # [ ] ,|, )->as_string,
+ 'http://127.0.0.1/%21/%2A/%27/%2B/%29/%3B/%3A/%40/%26/%3D/%24/%2C/%2F/%3F/%25/%23/%5B/%5D',
+ 'rfc 3986 reserved characters'
+ );
+
+ # jshirley bug - why the hell does only one of these get encoded
+ # has been like this forever however.
+ is(
+ Catalyst::uri_for( $context, qw|{1} {2}| )->as_string,
+ 'http://127.0.0.1/{1}/{2}',
+ 'not-escaping unreserved characters'
+ );
+}
+
+# make sure caller's query parameter hash isn't messed up
+{
+ my $query_params_base = {test => "one two",
+ bar => ["foo baz", "bar"]};
+ my $query_params_test = {test => "one two",
+ bar => ["foo baz", "bar"]};
+ Catalyst::uri_for($context, '/bar/baz', $query_params_test);
+ is_deeply($query_params_base, $query_params_test,
+ "uri_for() doesn't mess up query parameter hash in the caller");
+}
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_uri_with.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_uri_with.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_uri_with.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_uri_with.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,69 @@
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+use URI;
+
+use_ok('Catalyst::Request');
+
+my $request = Catalyst::Request->new( {
+ uri => URI->new('http://127.0.0.1/foo/bar/baz')
+ } );
+
+is(
+ $request->uri_with({}),
+ 'http://127.0.0.1/foo/bar/baz',
+ 'URI for absolute path'
+);
+
+is(
+ $request->uri_with({ foo => 'bar' }),
+ 'http://127.0.0.1/foo/bar/baz?foo=bar',
+ 'URI adds param'
+);
+
+my $request2 = Catalyst::Request->new( {
+ uri => URI->new('http://127.0.0.1/foo/bar/baz?bar=gorch')
+ } );
+is(
+ $request2->uri_with({}),
+ 'http://127.0.0.1/foo/bar/baz?bar=gorch',
+ 'URI retains param'
+);
+
+is(
+ $request2->uri_with({ me => 'awesome' }),
+ 'http://127.0.0.1/foo/bar/baz?bar=gorch&me=awesome',
+ 'URI retains param and adds new'
+);
+
+is(
+ $request2->uri_with({ bar => undef }),
+ 'http://127.0.0.1/foo/bar/baz',
+ 'URI loses param when explicitly undef'
+);
+
+is(
+ $request2->uri_with({ bar => 'snort' }),
+ 'http://127.0.0.1/foo/bar/baz?bar=snort',
+ 'URI changes param'
+);
+
+is(
+ $request2->uri_with({ bar => [ 'snort', 'ewok' ] }),
+ 'http://127.0.0.1/foo/bar/baz?bar=snort&bar=ewok',
+ 'overwrite mode URI appends arrayref param'
+);
+
+is(
+ $request2->uri_with({ bar => 'snort' }, { mode => 'append' }),
+ 'http://127.0.0.1/foo/bar/baz?bar=gorch&bar=snort',
+ 'append mode URI appends param'
+);
+
+is(
+ $request2->uri_with({ bar => [ 'snort', 'ewok' ] }, { mode => 'append' }),
+ 'http://127.0.0.1/foo/bar/baz?bar=gorch&bar=snort&bar=ewok',
+ 'append mode URI appends arrayref param'
+);
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_dispatcher_requestargs_restore.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_dispatcher_requestargs_restore.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_dispatcher_requestargs_restore.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_dispatcher_requestargs_restore.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,21 @@
+# Insane test case for the behavior needed by Plugin::Auhorization::ACL
+
+# We have to localise $c->request->{arguments} in
+# Catalyst::Dispatcher::_do_forward, rather than using save and restore,
+# as otherwise, the calling $c->detach on an action which says
+# die $Catalyst:DETACH causes the request arguments to not get restored,
+# and therefore sub gorch gets the wrong string $frozjob parameter.
+
+# Please feel free to break this behavior once a sane hook for safely
+# executing another action from the dispatcher (i.e. wrapping actions)
+# is present, so that the Authorization::ACL plugin can be re-written
+# to not be full of such crazy shit.
+
+use strict;
+use warnings;
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+use Catalyst::Test 'ACLTestApp';
+use Test::More tests => 1;
+
+request('http://localhost/gorch/wozzle');
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_load_catalyst_test.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_load_catalyst_test.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_load_catalyst_test.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_load_catalyst_test.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,157 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use Test::More tests => 61;
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+use Catalyst::Utils;
+use HTTP::Request::Common;
+use Test::Exception;
+
+my $Class = 'Catalyst::Test';
+my $App = 'TestApp';
+my $Pkg = __PACKAGE__;
+my $Url = 'http://localhost/';
+my $Content = "root index";
+
+my %Meth = (
+ $Pkg => [qw|get request ctx_request|], # exported
+ $Class => [qw|local_request remote_request|], # not exported
+);
+
+### make sure we're not trying to connect to a remote host -- these are local tests
+local $ENV{CATALYST_SERVER};
+
+use_ok( $Class );
+
+### check available methods
+{ ### turn of redefine warnings, we'll get new subs exported
+ ### XXX 'no warnings' and 'local $^W' wont work as warnings are turned on in
+ ### test.pm, so trap them for now --kane
+ { local $SIG{__WARN__} = sub {};
+ ok( $Class->import, "Argumentless import for methods only" );
+ }
+
+ while( my($class, $meths) = each %Meth ) {
+ for my $meth ( @$meths ) { SKIP: {
+
+ ### method available?
+ can_ok( $class, $meth );
+
+ ### only for exported methods
+ skip "Error tests only for exported methods", 2 unless $class eq $Pkg;
+
+ ### check error conditions
+ eval { $class->can($meth)->( $Url ) };
+ ok( $@, " $meth without app gives error" );
+ like( $@, qr/$Class/,
+ " Error filled with expected content for '$meth'" );
+ } }
+ }
+}
+
+### simple tests for exported methods
+{ ### turn of redefine warnings, we'll get new subs exported
+ ### XXX 'no warnings' and 'local $^W' wont work as warnings are turned on in
+ ### test.pm, so trap them for now --kane
+ { local $SIG{__WARN__} = sub {};
+ ok( $Class->import( $App ),
+ "Loading $Class for App $App" );
+ }
+
+ ### test exported methods again
+ for my $meth ( @{ $Meth{$Pkg} } ) { SKIP: {
+
+ ### do a call, we should get a result and perhaps a $c if it's 'ctx_request';
+ my ($res, $c) = eval { $Pkg->can($meth)->( $Url ) };
+
+ ok( 1, " Called $Pkg->$meth( $Url )" );
+ ok( !$@, " No critical error $@" );
+ ok( $res, " Result obtained" );
+
+ ### get the content as a string, to make sure we got what we expected
+ my $res_as_string = $meth eq 'get' ? $res : $res->content;
+ is( $res_as_string, $Content,
+ " Content as expected: $res_as_string" );
+
+ ### some tests for 'ctx_request'
+ skip "Context tests skipped for '$meth'", 6 unless $meth eq 'ctx_request';
+
+ ok( $c, " Context object returned" );
+ isa_ok( $c, $App, " Object" );
+ is( $c->request->uri, $Url,
+ " Url recorded in request" );
+ is( $c->response->body, $Content,
+ " Content recorded in response" );
+ ok( $c->stash, " Stash accessible" );
+ ok( $c->action, " Action object accessible" );
+ ok( $res->request, " Response has request object" );
+ lives_and { is( $res->request->uri, $Url) }
+ " Request object has correct url";
+ } }
+}
+
+### perl5.8.8 + cat 5.80's Cat::Test->ctx_request didn't return $c the 2nd
+### time it was invoked. Without tracking the bug down all the way, it was
+### clearly related to the Moose'ification of Cat::Test and a scoping issue
+### with a 'my'd variable. Since the same code works fine in 5.10, a bug in
+### either Moose or perl 5.8 is suspected.
+{ ok( 1, "Testing consistency of ctx_request()" );
+ for( 1..2 ) {
+ my($res, $c) = ctx_request( $Url );
+ ok( $c, " Call $_: Context object returned" );
+ }
+}
+
+# FIXME - These vhosts in tests tests should be somewhere else...
+
+sub customize { Catalyst::Test::_customize_request(@_) }
+
+{
+ my $req = Catalyst::Utils::request('/dummy');
+ customize( $req );
+ is( $req->header('Host'), undef, 'normal request is unmodified' );
+}
+
+{
+ my $req = Catalyst::Utils::request('/dummy');
+ customize( $req, { host => 'customized.com' } );
+ like( $req->header('Host'), qr/customized.com/, 'request is customizable via opts hash' );
+}
+
+{
+ my $req = Catalyst::Utils::request('/dummy');
+ local $Catalyst::Test::default_host = 'localized.com';
+ customize( $req );
+ like( $req->header('Host'), qr/localized.com/, 'request is customizable via package var' );
+}
+
+{
+ my $req = Catalyst::Utils::request('/dummy');
+ local $Catalyst::Test::default_host = 'localized.com';
+ customize( $req, { host => 'customized.com' } );
+ like( $req->header('Host'), qr/customized.com/, 'opts hash takes precedence over package var' );
+}
+
+{
+ my $req = Catalyst::Utils::request('/dummy');
+ local $Catalyst::Test::default_host = 'localized.com';
+ customize( $req, { host => '' } );
+ is( $req->header('Host'), undef, 'default value can be temporarily cleared via opts hash' );
+}
+
+# Back compat test, extra args used to be ignored, now a hashref of options.
+use_ok('Catalyst::Test', 'TestApp', 'foobar');
+
+# Back compat test, ensure that request ignores anything which isn't a hash.
+lives_ok {
+ request(GET('/dummy'), 'foo');
+} 'scalar additional param to request method ignored';
+lives_ok {
+ request(GET('/dummy'), []);
+} 'array additional param to request method ignored';
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_extend_non_moose_controller.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,20 @@
+use Catalyst ();
+
+{
+ package TestApp;
+ use base qw/Catalyst/;
+}
+{
+ package TestApp::Controller::Base;
+ use base qw/Catalyst::Controller/;
+}
+{
+ package TestApp::Controller::Other;
+ use Moose;
+ use Test::More tests => 1;
+ use Test::Exception;
+ lives_ok {
+ extends 'TestApp::Controller::Base';
+ };
+}
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_non_moose.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_non_moose.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_non_moose.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_non_moose.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,7 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use lib 't/lib';
+use Test::More tests => 1;
+use_ok('TestAppMetaCompat');
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_non_moose_controller.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_non_moose_controller.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_non_moose_controller.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_metaclass_compat_non_moose_controller.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 1;
+use Test::Exception;
+use TestAppNonMooseController;
+
+# Metaclass init order causes fail.
+# There are TODO tests in Moose for this, see
+# f2391d17574eff81d911b97be15ea51080500003
+# after which the evil kludge in core can die in a fire.
+
+lives_ok {
+ TestAppNonMooseController::ControllerBase->get_action_methods
+} 'Base class->get_action_methods ok when sub class initialized first';
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_response.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_response.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_response.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_response.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More tests => 6;
+
+use_ok('Catalyst::Response');
+
+my $res = Catalyst::Response->new;
+
+# test aliasing of res->code for res->status
+$res->code(500);
+is($res->code, 500, 'code sets itself');
+is($res->status, 500, 'code sets status');
+$res->status(501);
+is($res->code, 501, 'status sets code');
+is($res->body, '', "default response body ''");
+$res->body(undef);
+is($res->body, '', "response body '' after assigned undef");
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_env_value.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_env_value.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_env_value.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_env_value.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+use Catalyst::Utils;
+
+##############################################################################
+### No env vars defined
+##############################################################################
+{
+ ok( !Catalyst::Utils::env_value( 'MyApp', 'Key' ),
+ 'No env values defined returns false'
+ );
+}
+
+##############################################################################
+### App env var defined
+##############################################################################
+{
+ $ENV{'MYAPP2_KEY'} = 'Env value 2';
+ is( Catalyst::Utils::env_value( 'MyApp2', 'Key' ),
+ 'Env value 2', 'Got the right value from the application var' );
+}
+
+##############################################################################
+### Catalyst env var defined
+##############################################################################
+{
+ $ENV{'CATALYST_KEY'} = 'Env value 3';
+ is( Catalyst::Utils::env_value( 'MyApp3', 'Key' ),
+ 'Env value 3', 'Got the right value from the catalyst var' );
+}
+
+##############################################################################
+### Catalyst and Application env vars defined
+##############################################################################
+{
+ $ENV{'CATALYST_KEY'} = 'Env value bad';
+ $ENV{'MYAPP4_KEY'} = 'Env value 4';
+ is( Catalyst::Utils::env_value( 'MyApp4', 'Key' ),
+ 'Env value 4', 'Got the right value from the application var' );
+}
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_prefix.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_prefix.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_prefix.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_prefix.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 8;
+
+use lib "t/lib";
+
+use Catalyst::Utils;
+
+is( Catalyst::Utils::class2prefix('MyApp::V::Foo::Bar'), 'foo/bar', 'class2prefix works with M/V/C' );
+
+is( Catalyst::Utils::class2prefix('MyApp::Controller::Foo::Bar'), 'foo/bar', 'class2prefix works with Model/View/Controller' );
+
+is( Catalyst::Utils::class2prefix('MyApp::Controller::Foo::View::Bar'), 'foo/view/bar', 'class2prefix works with tricky components' );
+
+is( Catalyst::Utils::appprefix('MyApp::Foo'), 'myapp_foo', 'appprefix works' );
+
+is( Catalyst::Utils::class2appclass('MyApp::Foo::Controller::Bar::View::Baz'), 'MyApp::Foo', 'class2appclass works' );
+
+is( Catalyst::Utils::class2classprefix('MyApp::Foo::Controller::Bar::View::Baz'), 'MyApp::Foo::Controller', 'class2classprefix works' );
+
+is( Catalyst::Utils::class2classsuffix('MyApp::Foo::Controller::Bar::View::Baz'), 'Controller::Bar::View::Baz', 'class2classsuffix works' );
+
+is( Catalyst::Utils::class2env('MyApp::Foo'), 'MYAPP_FOO', 'class2env works' );
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_request.t (from rev 10642, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_request.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_request.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_utils_request.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,27 @@
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+use Catalyst::Utils;
+
+{
+ my $url = "/dump";
+ ok(
+ my $request = Catalyst::Utils::request($url),
+ "Request: simple get without protocol nor host"
+ );
+ like( $request->uri, qr|^http://localhost/|,
+ " has default protocol and host" );
+}
+
+{
+ my $url = "/dump?url=http://www.somewhere.com/";
+ ok(
+ my $request = Catalyst::Utils::request($url),
+ "Same with param containing a url"
+ );
+ like( $request->uri, qr|^http://localhost/|,
+ " has default protocol and host" );
+}
+
Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/author/http-server.t (from rev 11325, Catalyst-Runtime/5.80/branches/better_scripts/t/author/optional_http-server.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/author/http-server.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/author/http-server.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,96 @@
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+use File::Path;
+use FindBin;
+use IPC::Open3;
+use IO::Socket;
+
+use Catalyst::Devel 1.0;
+use File::Copy::Recursive;
+
+# Run a single test by providing it as the first arg
+my $single_test = shift;
+
+my $tmpdir = "$FindBin::Bin/../../t/tmp";
+
+# clean up
+rmtree $tmpdir if -d $tmpdir;
+
+# create a TestApp and copy the test libs into it
+mkdir $tmpdir;
+chdir $tmpdir;
+system( $^X, "-I$FindBin::Bin/../../lib", "$FindBin::Bin/../../script/catalyst.pl", 'TestApp' );
+chdir "$FindBin::Bin/..";
+File::Copy::Recursive::dircopy( '../t/lib', '../t/tmp/TestApp/lib' ) or die;
+
+# remove TestApp's tests
+rmtree '../t/tmp/TestApp/t' or die;
+
+# spawn the standalone HTTP server
+my $port = 30000 + int rand(1 + 10000);
+my @cmd = ($^X, "-I$FindBin::Bin/../../lib",
+ "$FindBin::Bin/../../t/tmp/TestApp/script/testapp_server.pl", '-port', $port );
+my $pid = open3( undef, my $server, undef, @cmd)
+ or die "Unable to spawn standalone HTTP server: $!";
+
+# wait for it to start
+print "Waiting for server to start...\n";
+my $timeout = 30;
+my $count = 0;
+while ( check_port( 'localhost', $port ) != 1 ) {
+ sleep 1;
+ die("Server did not start within $timeout seconds: " . join(' ', @cmd))
+ if $count++ > $timeout;
+}
+
+# run the testsuite against the HTTP server
+$ENV{CATALYST_SERVER} = "http://localhost:$port";
+
+my $return;
+if ( $single_test ) {
+ $return = system( "$^X -I../lib/ $single_test" );
+}
+else {
+ $return = prove( '-r', '-I../lib/', glob('../t/aggregate/live_*.t') );
+}
+
+# shut it down
+kill 'INT', $pid;
+close $server;
+
+# clean up
+rmtree "$FindBin::Bin/../../t/tmp" if -d "$FindBin::Bin/../../t/tmp";
+
+is( $return, 0, 'live tests' );
+
+sub check_port {
+ my ( $host, $port ) = @_;
+
+ my $remote = IO::Socket::INET->new(
+ Proto => "tcp",
+ PeerAddr => $host,
+ PeerPort => $port
+ );
+ if ($remote) {
+ close $remote;
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+sub prove {
+ if (!(my $pid = fork)) {
+ require App::Prove;
+ my $prove = App::Prove->new;
+ $prove->process_args(@_);
+ exit( $prove->run ? 0 : 1 );
+ } else {
+ waitpid $pid, 0;
+ return $?;
+ }
+}
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/author/optional_http-server.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/author/optional_http-server.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/author/optional_http-server.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,96 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 1;
-
-use File::Path;
-use FindBin;
-use IPC::Open3;
-use IO::Socket;
-
-use Catalyst::Devel 1.0;
-use File::Copy::Recursive;
-
-# Run a single test by providing it as the first arg
-my $single_test = shift;
-
-my $tmpdir = "$FindBin::Bin/../../t/tmp";
-
-# clean up
-rmtree $tmpdir if -d $tmpdir;
-
-# create a TestApp and copy the test libs into it
-mkdir $tmpdir;
-chdir $tmpdir;
-system( $^X, "-I$FindBin::Bin/../../lib", "$FindBin::Bin/../../script/catalyst.pl", 'TestApp' );
-chdir "$FindBin::Bin/..";
-File::Copy::Recursive::dircopy( '../t/lib', '../t/tmp/TestApp/lib' ) or die;
-
-# remove TestApp's tests
-rmtree '../t/tmp/TestApp/t' or die;
-
-# spawn the standalone HTTP server
-my $port = 30000 + int rand(1 + 10000);
-my @cmd = ($^X, "-I$FindBin::Bin/../../lib",
- "$FindBin::Bin/../../t/tmp/TestApp/script/testapp_server.pl", '-p', $port );
-my $pid = open3( undef, my $server, undef, @cmd)
- or die "Unable to spawn standalone HTTP server: $!";
-
-# wait for it to start
-print "Waiting for server to start...\n";
-my $timeout = 30;
-my $count = 0;
-while ( check_port( 'localhost', $port ) != 1 ) {
- sleep 1;
- die("Server did not start within $timeout seconds: " . join(' ', @cmd))
- if $count++ > $timeout;
-}
-
-# run the testsuite against the HTTP server
-$ENV{CATALYST_SERVER} = "http://localhost:$port";
-
-my $return;
-if ( $single_test ) {
- $return = system( "$^X -I../lib/ $single_test" );
-}
-else {
- $return = prove( '-r', '-I../lib/', glob('../t/aggregate/live_*.t') );
-}
-
-# shut it down
-kill 'INT', $pid;
-close $server;
-
-# clean up
-rmtree "$FindBin::Bin/../../t/tmp" if -d "$FindBin::Bin/../../t/tmp";
-
-is( $return, 0, 'live tests' );
-
-sub check_port {
- my ( $host, $port ) = @_;
-
- my $remote = IO::Socket::INET->new(
- Proto => "tcp",
- PeerAddr => $host,
- PeerPort => $port
- );
- if ($remote) {
- close $remote;
- return 1;
- }
- else {
- return 0;
- }
-}
-
-sub prove {
- if (!(my $pid = fork)) {
- require App::Prove;
- my $prove = App::Prove->new;
- $prove->process_args(@_);
- exit( $prove->run ? 0 : 1 );
- } else {
- waitpid $pid, 0;
- return $?;
- }
-}
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/c3_appclass_bug.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/c3_appclass_bug.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/c3_appclass_bug.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,30 +0,0 @@
-use strict;
-use Test::More tests => 1;
-
-{
- package TestPlugin;
- use strict;
-
- sub setup {
- shift->maybe::next::method(@_);
- }
-}
-{
- package TestAppC3ErrorUseMoose;
- use Moose;
-
- use Catalyst::Runtime 5.80;
-
- use base qw/Catalyst/;
- use Catalyst qw/
- +TestPlugin
- /;
-}
-
-use Test::Exception;
-lives_ok {
- TestAppC3ErrorUseMoose->setup();
-} 'No C3 error';
-
-1;
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/c3_mro.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/c3_mro.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/c3_mro.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,38 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-require Catalyst;
-require Module::Pluggable::Object;
-use MRO::Compat;
-
-# Get a list of all Catalyst:: packages in blib via M::P::O
-my @cat_mods;
-{
- # problem with @INC on win32, see:
- # http://rt.cpan.org/Ticket/Display.html?id=26452
- if ($^O eq 'MSWin32') { require Win32; Win32::GetCwd(); }
-
- local @INC = grep {/blib/} @INC;
- @cat_mods = (
- 'Catalyst',
- Module::Pluggable::Object->new(search_path => ['Catalyst'])->plugins,
- );
-}
-
-# plan one test per found package name
-plan tests => scalar @cat_mods;
-
-# Try to calculate the C3 MRO for each package
-#
-# In the case that the initial require fails (as in
-# Catalyst::Engine::FastCGI when FCGI is not installed),
-# the calculateMRO eval will not error out, which is
-# effectively a test skip.
-#
-foreach my $cat_mod (@cat_mods) {
- eval " require $cat_mod ";
- eval { mro::get_linear_isa($cat_mod, 'c3') };
- ok(!$@, "calculateMRO for $cat_mod: $@");
-}
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/caf_backcompat.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/caf_backcompat.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/caf_backcompat.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,28 +0,0 @@
-use strict;
-use warnings;
-use Test::More;
-use Test::Exception;
-use Class::MOP ();
-use Moose::Util ();
-
-# List of everything which used Class::Accessor::Fast in 5.70.
-my @modules = qw/
- Catalyst::Action
- Catalyst::ActionContainer
- Catalyst::Component
- Catalyst::Dispatcher
- Catalyst::DispatchType
- Catalyst::Engine
- Catalyst::Log
- Catalyst::Request::Upload
- Catalyst::Request
- Catalyst::Response
-/;
-
-plan tests => scalar @modules;
-
-foreach my $module (@modules) {
- Class::MOP::load_class($module);
- ok Moose::Util::does_role($module => 'MooseX::Emulate::Class::Accessor::Fast'),
- "$module has Class::Accessor::Fast back-compat";
-}
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/custom_exception_class_simple.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/custom_exception_class_simple.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/custom_exception_class_simple.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -7,12 +7,6 @@
use Test::More tests => 1;
use Test::Exception;
-TODO: {
- local $TODO = 'Does not work yet';
-
lives_ok {
require TestAppClassExceptionSimpleTest;
} 'Can load application';
-
-}
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/custom_live_component_controller_action_auto_doublebug.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/custom_live_component_controller_action_auto_doublebug.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/custom_live_component_controller_action_auto_doublebug.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,48 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-
-use FindBin;
-use lib "$FindBin::Bin/lib";
-
-our $iters;
-
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-
-use Test::More tests => 3*$iters;
-use Catalyst::Test 'TestAppDoubleAutoBug';
-
-if ( $ENV{CAT_BENCHMARK} ) {
- require Benchmark;
- Benchmark::timethis( $iters, \&run_tests );
-}
-else {
- for ( 1 .. $iters ) {
- run_tests();
- }
-}
-
-sub run_tests {
- SKIP:
- {
- if ( $ENV{CATALYST_SERVER} ) {
- skip 'Using remote server', 3;
- }
-
- {
- my @expected = qw[
- TestAppDoubleAutoBug->auto
- TestAppDoubleAutoBug->default
- TestAppDoubleAutoBug->end
- ];
-
- my $expected = join( ", ", @expected );
-
- ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
- is( $response->header('X-Catalyst-Executed'),
- $expected, 'Executed actions' );
- is( $response->content, 'default, auto=1', 'Content OK' );
- }
- }
-}
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/custom_live_path_bug.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/custom_live_path_bug.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/custom_live_path_bug.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,39 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-
-use FindBin;
-use lib "$FindBin::Bin/lib";
-
-our $iters;
-
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-
-use Test::More tests => 2*$iters;
-use Catalyst::Test 'TestAppPathBug';
-
-if ( $ENV{CAT_BENCHMARK} ) {
- require Benchmark;
- Benchmark::timethis( $iters, \&run_tests );
-}
-else {
- for ( 1 .. $iters ) {
- run_tests();
- }
-}
-
-sub run_tests {
- SKIP:
- {
- if ( $ENV{CATALYST_SERVER} ) {
- skip 'Using remote server', 2;
- }
-
- {
- my $expected = 'This is the foo method.';
- ok( my $response = request('http://localhost/'), 'response ok' );
- is( $response->content, $expected, 'Content OK' );
- }
- }
-}
Added: Catalyst-Runtime/5.80/branches/better_scripts/t/deprecated_appclass_action_warnings.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/deprecated_appclass_action_warnings.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/deprecated_appclass_action_warnings.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More;
+use Catalyst::Test 'DeprecatedActionsInAppClassTestApp';
+
+plan tests => 3;
+
+my $warnings;
+my $logger = DeprecatedActionsInAppClassTestApp::Log->new;
+Catalyst->log($logger);
+
+ok( my $response = request('http://localhost/foo'), 'Request' );
+ok( $response->is_success, 'Response Successful 2xx' );
+is( $DeprecatedActionsInAppClassTestApp::Log::warnings, 1, 'Get the appclass action warning' );
\ No newline at end of file
Added: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/ACLTestApp/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/ACLTestApp/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/ACLTestApp/Controller/Root.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,18 @@
+package ACLTestApp::Controller::Root;
+use Test::More;
+
+use base 'Catalyst::Controller';
+
+__PACKAGE__->config->{namespace} = '';
+
+sub foobar : Private {
+ die $Catalyst::DETACH;
+}
+
+sub gorch : Local {
+ my ( $self, $c, $frozjob ) = @_;
+ is $frozjob, 'wozzle';
+ $c->res->body("gorch");
+}
+
+1;
Added: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/ACLTestApp.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/ACLTestApp.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/ACLTestApp.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,26 @@
+package ACLTestApp;
+use Test::More;
+
+use strict;
+use warnings;
+use MRO::Compat;
+use Scalar::Util ();
+
+use base qw/Catalyst Catalyst::Controller/;
+use Catalyst qw//;
+
+sub execute {
+ my $c = shift;
+ my ( $class, $action ) = @_;
+
+ if ( Scalar::Util::blessed($action)
+ and $action->name ne "foobar" ) {
+ eval { $c->detach( 'foobar', [$action, 'foo'] ) };
+ }
+
+ $c->next::method( @_ );
+}
+
+__PACKAGE__->setup;
+
+1;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/Catalyst/Plugin/Test/Plugin.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/Catalyst/Plugin/Test/Plugin.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/Catalyst/Plugin/Test/Plugin.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -22,26 +22,14 @@
return $c;
}
-# Note: This is horrible, but Catalyst::Plugin::Server forces the body to
+# Note: Catalyst::Plugin::Server forces the body to
# be parsed, by calling the $c->req->body method in prepare_action.
# We need to test this, as this was broken by 5.80. See also
-# t/aggregate/live_engine_request_body.t. Better ways to test this
-# appreciated if you have suggestions :)
-{
- my $have_req_body = 0;
- sub prepare_action {
- my $c = shift;
- $have_req_body++ if $c->req->body;
- $c->next::method(@_);
- }
- sub have_req_body_in_prepare_action : Local {
- my ($self, $c) = @_;
- $c->res->body($have_req_body);
- }
+# t/aggregate/live_engine_request_body.t.
+sub prepare_action {
+ my $c = shift;
+ $c->res->header('X-Have-Request-Body', 1) if $c->req->body;
+ $c->next::method(@_);
}
-sub end : Private {
- my ($self,$c) = @_;
-}
-
1;
Added: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/DeprecatedActionsInAppClassTestApp.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/DeprecatedActionsInAppClassTestApp.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/DeprecatedActionsInAppClassTestApp.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,30 @@
+package DeprecatedActionsInAppClassTestApp;
+
+use strict;
+use warnings;
+use Catalyst;
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config( name => 'DeprecatedActionsInAppClassTestApp', root => '/some/dir' );
+__PACKAGE__->log(DeprecatedActionsInAppClassTestApp::Log->new);
+__PACKAGE__->setup;
+
+sub foo : Local {
+ my ($self, $c) = @_;
+ $c->res->body('OK');
+}
+
+package DeprecatedActionsInAppClassTestApp::Log;
+use strict;
+use warnings;
+use base qw/Catalyst::Log/;
+
+our $warnings;
+
+sub warn {
+ my ($self, $warning) = @_;
+ $warnings++ if $warning =~ /action methods .+ found defined/i;
+}
+
+1;
Added: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/PluginTestApp/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/PluginTestApp/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/PluginTestApp/Controller/Root.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,55 @@
+package PluginTestApp::Controller::Root;
+use Test::More;
+
+use base 'Catalyst::Controller';
+
+#use Catalyst qw(
+# Test::Plugin
+# +TestApp::Plugin::FullyQualified
+# );
+
+__PACKAGE__->config->{namespace} = '';
+
+sub compile_time_plugins : Local {
+ my ( $self, $c ) = @_;
+
+ isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
+ isa_ok $c, 'TestApp::Plugin::FullyQualified';
+
+ can_ok $c, 'registered_plugins';
+ $c->_test_plugins;
+
+ $c->res->body("ok");
+}
+
+sub run_time_plugins : Local {
+ my ( $self, $c ) = @_;
+
+ $c->_test_plugins;
+ my $faux_plugin = 'Faux::Plugin';
+
+# Trick perl into thinking the plugin is already loaded
+ $INC{'Faux/Plugin.pm'} = 1;
+
+ ref($c)->plugin( faux => $faux_plugin );
+
+ isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
+ isa_ok $c, 'TestApp::Plugin::FullyQualified';
+ ok !$c->isa($faux_plugin),
+ '... and it should not inherit from the instant plugin';
+ can_ok $c, 'faux';
+ is $c->faux->count, 1, '... and it should behave correctly';
+ is_deeply [ $c->registered_plugins ],
+ [
+ qw/Catalyst::Plugin::Test::Plugin
+ Faux::Plugin
+ TestApp::Plugin::FullyQualified/
+ ],
+ 'registered_plugins() should report all plugins';
+ ok $c->registered_plugins('Faux::Plugin'),
+ '... and even the specific instant plugin';
+
+ $c->res->body("ok");
+}
+
+1;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/PluginTestApp.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/PluginTestApp.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/PluginTestApp.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -6,48 +6,6 @@
+TestApp::Plugin::FullyQualified
);
-sub compile_time_plugins : Local {
- my ( $self, $c ) = @_;
-
- isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
- isa_ok $c, 'TestApp::Plugin::FullyQualified';
-
- can_ok $c, 'registered_plugins';
- $c->_test_plugins;
-
- $c->res->body("ok");
-}
-
-sub run_time_plugins : Local {
- my ( $self, $c ) = @_;
-
- $c->_test_plugins;
- my $faux_plugin = 'Faux::Plugin';
-
-# Trick perl into thinking the plugin is already loaded
- $INC{'Faux/Plugin.pm'} = 1;
-
- __PACKAGE__->plugin( faux => $faux_plugin );
-
- isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
- isa_ok $c, 'TestApp::Plugin::FullyQualified';
- ok !$c->isa($faux_plugin),
- '... and it should not inherit from the instant plugin';
- can_ok $c, 'faux';
- is $c->faux->count, 1, '... and it should behave correctly';
- is_deeply [ $c->registered_plugins ],
- [
- qw/Catalyst::Plugin::Test::Plugin
- Faux::Plugin
- TestApp::Plugin::FullyQualified/
- ],
- 'registered_plugins() should report all plugins';
- ok $c->registered_plugins('Faux::Plugin'),
- '... and even the specific instant plugin';
-
- $c->res->body("ok");
-}
-
sub _test_plugins {
my $c = shift;
is_deeply [ $c->registered_plugins ],
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Action/Chained.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Action/Chained.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Action/Chained.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -204,6 +204,13 @@
$c->req->args([ map { decode_entities($_) } @{ $c->req->args }]);
}
+sub roundtrip_urifor : Chained('/') PathPart('chained/roundtrip_urifor') CaptureArgs(1) {}
+sub roundtrip_urifor_end : Chained('roundtrip_urifor') PathPart('') Args(1) {
+ my ($self, $c) = @_;
+ # This should round-trip, always - i.e. the uri you put in should come back out.
+ $c->res->body($c->uri_for($c->action, $c->req->captures, @{$c->req->args}, $c->req->parameters));
+ $c->stash->{no_end} = 1;
+}
sub end :Private {
my ($self, $c) = @_;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Action/Private.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Action/Private.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Action/Private.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -8,27 +8,27 @@
$c->res->output('access denied');
}
-sub one : Private {
+sub one : Private {
my ( $self, $c ) = @_;
$c->res->output('access allowed');
}
-sub two : Private Relative {
+sub two : Private {
my ( $self, $c ) = @_;
$c->res->output('access allowed');
}
-sub three : Private Absolute {
+sub three : Private {
my ( $self, $c ) = @_;
$c->res->output('access allowed');
}
-sub four : Private Path('/action/private/four') {
+sub four : Private {
my ( $self, $c ) = @_;
$c->res->output('access allowed');
}
-sub five : Private Path('five') {
+sub five : Private {
my ( $self, $c ) = @_;
$c->res->output('access allowed');
}
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Dump.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Dump.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Dump.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -3,7 +3,7 @@
use strict;
use base 'Catalyst::Controller';
-sub default : Action Private {
+sub default : Action {
my ( $self, $c ) = @_;
$c->forward('TestApp::View::Dump');
}
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Root.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp/Controller/Root.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -20,4 +20,36 @@
$c->forward('TestApp::View::Dump::Request');
}
+sub index : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body('root index');
+}
+
+sub global_action : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub class_forward_test_method :Private {
+ my ( $self, $c ) = @_;
+ $c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 );
+}
+
+sub loop_test : Local {
+ my ( $self, $c ) = @_;
+
+ for( 1..1001 ) {
+ $c->forward( 'class_forward_test_method' );
+ }
+}
+
+sub recursion_test : Local {
+ my ( $self, $c ) = @_;
+ $c->forward( 'recursion_test' );
+}
+
+sub end : Private {
+ my ($self,$c) = @_;
+}
+
1;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestApp.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -41,16 +41,6 @@
TestApp->setup;
-sub index : Private {
- my ( $self, $c ) = @_;
- $c->res->body('root index');
-}
-
-sub global_action : Private {
- my ( $self, $c ) = @_;
- $c->forward('TestApp::View::Dump::Request');
-}
-
sub execute {
my $c = shift;
my $class = ref( $c->component( $_[0] ) ) || $_[0];
@@ -92,25 +82,6 @@
$c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) );
}
-sub class_forward_test_method :Private {
- my ( $self, $c ) = @_;
- $c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 );
-}
-
-sub loop_test : Local {
- my ( $self, $c ) = @_;
-
- for( 1..1001 ) {
- $c->forward( 'class_forward_test_method' );
- }
-}
-
-sub recursion_test : Local {
- my ( $self, $c ) = @_;
- no warnings 'recursion';
- $c->forward( 'recursion_test' );
-}
-
{
no warnings 'redefine';
sub Catalyst::Log::error { }
Added: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppDoubleAutoBug/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppDoubleAutoBug/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppDoubleAutoBug/Controller/Root.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,22 @@
+package TestAppDoubleAutoBug::Controller::Root;
+
+use base 'Catalyst::Controller';
+
+__PACKAGE__->config->{namespace} = '';
+
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ ++$c->stash->{auto_count};
+ return 1;
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( sprintf 'default, auto=%d', $c->stash->{auto_count} );
+}
+
+sub end : Private {
+ my ($self,$c) = @_;
+}
+
+1;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppDoubleAutoBug.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppDoubleAutoBug.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppDoubleAutoBug.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -45,15 +45,5 @@
return $c->SUPER::execute(@_);
}
+1;
-
-sub auto : Private {
- my ( $self, $c ) = @_;
- ++$c->stash->{auto_count};
- return 1;
-}
-
-sub default : Private {
- my ( $self, $c ) = @_;
- $c->res->body( sprintf 'default, auto=%d', $c->stash->{auto_count} );
-}
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPathBug.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPathBug.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPathBug.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -2,13 +2,15 @@
use warnings;
package TestAppPathBug;
-
+use strict;
+use warnings;
use Catalyst;
our $VERSION = '0.01';
__PACKAGE__->config( name => 'TestAppPathBug', root => '/some/dir' );
+__PACKAGE__->log(TestAppPathBug::Log->new);
__PACKAGE__->setup;
sub foo : Path {
@@ -16,4 +18,11 @@
$c->res->body( 'This is the foo method.' );
}
+package TestAppPathBug::Log;
+use strict;
+use warnings;
+use base qw/Catalyst::Log/;
+
+sub warn {}
+
1;
Added: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPluginWithConstructor/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPluginWithConstructor/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPluginWithConstructor/Controller/Root.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,12 @@
+package TestAppPluginWithConstructor::Controller::Root;
+
+use base 'Catalyst::Controller';
+
+__PACKAGE__->config->{namespace} = '';
+
+sub foo : Local {
+ my ($self, $c) = @_;
+ $c->res->body('foo');
+}
+
+1;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPluginWithConstructor.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPluginWithConstructor.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppPluginWithConstructor.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -6,11 +6,6 @@
use Moose;
BEGIN { extends qw/Catalyst Catalyst::Controller/ } # Ewww, FIXME.
-sub foo : Local {
- my ($self, $c) = @_;
- $c->res->body('foo');
-}
-
__PACKAGE__->setup;
our $MODIFIER_FIRED = 0;
Added: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppStats/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppStats/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppStats/Controller/Root.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -0,0 +1,16 @@
+package TestAppStats::Controller::Root;
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+
+__PACKAGE__->config->{namespace} = '';
+
+# Return log messages from previous request
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->stats->profile("test");
+ $c->res->body(join("\n", @TestAppStats::log_messages));
+ @TestAppStats::log_messages = ();
+}
+
+1;
Modified: Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppStats.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppStats.pm 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/lib/TestAppStats.pm 2009-11-20 01:09:14 UTC (rev 11931)
@@ -16,16 +16,11 @@
__PACKAGE__->setup;
-# Return log messages from previous request
-sub default : Private {
- my ( $self, $c ) = @_;
- $c->stats->profile("test");
- $c->res->body(join("\n", @log_messages));
- @log_messages = ();
-}
-
package TestAppStats::Log;
use base qw/Catalyst::Log/;
-sub info { push(@log_messages, @_); }
-sub debug { push(@log_messages, @_); }
+sub info { push(@TestAppStats::log_messages, @_); }
+sub debug { push(@TestAppStats::log_messages, @_); }
+
+1;
+
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/meta_method_unneeded.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/meta_method_unneeded.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/meta_method_unneeded.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,20 +0,0 @@
-use strict;
-use warnings;
-use FindBin qw/$Bin/;
-use lib "$Bin/lib";
-use Test::More tests => 1;
-use Test::Exception;
-use Carp ();
-
-# Doing various silly things, like for example
-# use CGI qw/:standard/ in your conrtoller / app
-# will overwrite your meta method, therefore Catalyst
-# can't depend on it being there correctly.
-
-# This is/was demonstrated by Catalyst::Controller::WrapCGI
-# and Catalyst::Plugin::Cache::Curried
-
-use Catalyst::Test 'TestAppWithMeta';
-
-ok( request('/')->is_success );
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_controller_config.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_controller_config.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_controller_config.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,91 +0,0 @@
-## ============================================================================
-## Test to make sure that subclassed controllers (catalyst controllers
-## that inherit from a custom base catalyst controller) don't experienc
-## any namespace collision in the values under config.
-## ============================================================================
-
-use Test::More tests => 9;
-
-use strict;
-use warnings;
-
-use_ok('Catalyst');
-
-## ----------------------------------------------------------------------------
-## First We define a base controller that inherits from Catalyst::Controller
-## We add something to the config that we expect all children classes to
-## be able to find.
-## ----------------------------------------------------------------------------
-
-{
- package base_controller;
-
- use base 'Catalyst::Controller';
-
- __PACKAGE__->config( base_key => 'base_value' );
-}
-
-## ----------------------------------------------------------------------------
-## Next we instantiate two classes that inherit from the base controller. We
-## Add some local config information to these.
-## ----------------------------------------------------------------------------
-
-{
- package controller_a;
-
- use base 'base_controller';
-
- __PACKAGE__->config( key_a => 'value_a' );
-}
-
-
-{
- package controller_b;
-
- use base 'base_controller';
-
- __PACKAGE__->config->{key_b} = 'value_b';
-}
-
-## Okay, we expect that the base controller has a config with one key
-## and that the two children controllers inherit that config key and then
-## add one more. So the base controller has one config value and the two
-## children each have two.
-
-## ----------------------------------------------------------------------------
-## THE TESTS. Basically we first check to make sure that all the children of
-## the base_controller properly inherit the {base_key => 'base_value'} info
-## and that each of the children also has its local config data and that none
-## of the classes have data that is unexpected.
-## ----------------------------------------------------------------------------
-
-
-# First round, does everything have what we expect to find? If these tests fail there is something
-# wrong with the way config is storing its information.
-
-ok( base_controller->config->{base_key} eq 'base_value', 'base_controller has expected config value for "base_key"') or
- diag('"base_key" defined as "'.base_controller->config->{base_key}.'" and not "base_value" in config');
-
-ok( controller_a->config->{base_key} eq 'base_value', 'controller_a has expected config value for "base_key"') or
- diag('"base_key" defined as "'.controller_a->config->{base_key}.'" and not "base_value" in config');
-
-ok( controller_a->config->{key_a} eq 'value_a', 'controller_a has expected config value for "key_a"') or
- diag('"key_a" defined as "'.controller_a->config->{key_a}.'" and not "value_a" in config');
-
-ok( controller_b->config->{base_key} eq 'base_value', 'controller_b has expected config value for "base_key"') or
- diag('"base_key" defined as "'.controller_b->config->{base_key}.'" and not "base_value" in config');
-
-ok( controller_b->config->{key_b} eq 'value_b', 'controller_b has expected config value for "key_b"') or
- diag('"key_b" defined as "'.controller_b->config->{key_b}.'" and not "value_b" in config');
-
-# second round, does each controller have the expected number of config values? If this test fails there is
-# probably some data collision between the controllers.
-
-ok( scalar(keys %{base_controller->config}) == 1, 'base_controller has the expected number of config values') or
- diag("base_controller should have 1 config value, but it has ".scalar(keys %{base_controller->config}));
-
-ok( scalar(keys %{controller_a->config}) == 2, 'controller_a has the expected number of config values') or
- diag("controller_a should have 2 config value, but it has ".scalar(keys %{base_controller->config}));
-
-ok( scalar(keys %{controller_b->config}) == 2, 'controller_b has the expected number of config values') or
- diag("controller_a should have 2 config value, but it has ".scalar(keys %{base_controller->config}));
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_controller_namespace.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_controller_namespace.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_controller_namespace.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,24 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 2;
-
-BEGIN {
- package MyApp::Controller::Foo;
-
- use base qw/Catalyst::Controller/;
-
- package MyApp::Controller::Root;
-
- use base qw/Catalyst::Controller/;
-
- __PACKAGE__->config(namespace => '');
-
- package Stub;
-
- sub config { {} };
-}
-
-is(MyApp::Controller::Foo->action_namespace('Stub'), 'foo');
-
-is(MyApp::Controller::Root->action_namespace('Stub'), '');
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_action.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_action.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_action.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,54 +0,0 @@
-use Test::More tests => 6;
-use strict;
-use warnings;
-use Moose::Meta::Class;
-#use Moose::Meta::Attribute;
-use Catalyst::Request;
-
-use_ok('Catalyst::Action');
-
-my $action_1 = Catalyst::Action->new(
- name => 'foo',
- code => sub { "DUMMY" },
- reverse => 'bar/foo',
- namespace => 'bar',
- attributes => {
- Args => [ 1 ],
- attr2 => [ 2 ],
- },
-);
-
-my $action_2 = Catalyst::Action->new(
- name => 'foo',
- code => sub { "DUMMY" },
- reverse => 'bar/foo',
- namespace => 'bar',
- attributes => {
- Args => [ 2 ],
- attr2 => [ 2 ],
- },
-);
-
-is("${action_1}", $action_1->reverse, 'overload string');
-is($action_1->(), 'DUMMY', 'overload code');
-
-my $anon_meta = Moose::Meta::Class->create_anon_class(
- attributes => [
- Moose::Meta::Attribute->new(
- request => (
- reader => 'request',
- required => 1,
- default => sub { Catalyst::Request->new(arguments => [qw/one two/]) },
- ),
- ),
- ],
- methods => { req => sub { shift->request(@_) } }
-);
-
-my $mock_c = $anon_meta->new_object();
-$mock_c->request;
-
-ok(!$action_1->match($mock_c), 'bad match fails');
-ok($action_2->match($mock_c), 'good match works');
-
-ok($action_2->compare( $action_1 ), 'compare works');
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_classdata.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_classdata.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_classdata.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,106 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use Scalar::Util qw/refaddr blessed/;
-use Test::More tests => 37;
-
-{
- package ClassDataTest;
- use Moose;
- with 'Catalyst::ClassData';
-
- package ClassDataTest2;
- use Moose;
- extends 'ClassDataTest';
-
-}
-
- my $scalar = '100';
- my $arrayref = [];
- my $hashref = {};
- my $scalarref = \$scalar;
- my $coderef = sub { "beep" };
-
- my $scalar2 = '200';
- my $arrayref2 = [];
- my $hashref2 = {};
- my $scalarref2 = \$scalar2;
- my $coderef2 = sub { "beep" };
-
- my $scalar3 = '300';
- my $arrayref3 = [];
- my $hashref3 = {};
- my $scalarref3 = \$scalar3;
- my $coderef3 = sub { "beep" };
-
-
-my @accessors = qw/_arrayref _hashref _scalarref _coderef _scalar/;
-ClassDataTest->mk_classdata($_) for @accessors;
-can_ok('ClassDataTest', @accessors);
-
-ClassDataTest2->mk_classdata("beep", "meep");
-is(ClassDataTest2->beep, "meep");
-
-ClassDataTest->_arrayref($arrayref);
-ClassDataTest->_hashref($hashref);
-ClassDataTest->_scalarref($scalarref);
-ClassDataTest->_coderef($coderef);
-ClassDataTest->_scalar($scalar);
-
-is(ref(ClassDataTest->_arrayref), 'ARRAY');
-is(ref(ClassDataTest->_hashref), 'HASH');
-is(ref(ClassDataTest->_scalarref), 'SCALAR');
-is(ref(ClassDataTest->_coderef), 'CODE');
-ok( !ref(ClassDataTest->_scalar) );
-is(refaddr(ClassDataTest->_arrayref), refaddr($arrayref));
-is(refaddr(ClassDataTest->_hashref), refaddr($hashref));
-is(refaddr(ClassDataTest->_scalarref), refaddr($scalarref));
-is(refaddr(ClassDataTest->_coderef), refaddr($coderef));
-is(ClassDataTest->_scalar, $scalar);
-
-
-is(ref(ClassDataTest2->_arrayref), 'ARRAY');
-is(ref(ClassDataTest2->_hashref), 'HASH');
-is(ref(ClassDataTest2->_scalarref), 'SCALAR');
-is(ref(ClassDataTest2->_coderef), 'CODE');
-ok( !ref(ClassDataTest2->_scalar) );
-is(refaddr(ClassDataTest2->_arrayref), refaddr($arrayref));
-is(refaddr(ClassDataTest2->_hashref), refaddr($hashref));
-is(refaddr(ClassDataTest2->_scalarref), refaddr($scalarref));
-is(refaddr(ClassDataTest2->_coderef), refaddr($coderef));
-is(ClassDataTest2->_scalar, $scalar);
-
-ClassDataTest2->_arrayref($arrayref2);
-ClassDataTest2->_hashref($hashref2);
-ClassDataTest2->_scalarref($scalarref2);
-ClassDataTest2->_coderef($coderef2);
-ClassDataTest2->_scalar($scalar2);
-
-is(refaddr(ClassDataTest2->_arrayref), refaddr($arrayref2));
-is(refaddr(ClassDataTest2->_hashref), refaddr($hashref2));
-is(refaddr(ClassDataTest2->_scalarref), refaddr($scalarref2));
-is(refaddr(ClassDataTest2->_coderef), refaddr($coderef2));
-is(ClassDataTest2->_scalar, $scalar2);
-
-is(refaddr(ClassDataTest->_arrayref), refaddr($arrayref));
-is(refaddr(ClassDataTest->_hashref), refaddr($hashref));
-is(refaddr(ClassDataTest->_scalarref), refaddr($scalarref));
-is(refaddr(ClassDataTest->_coderef), refaddr($coderef));
-is(ClassDataTest->_scalar, $scalar);
-
-ClassDataTest->_arrayref($arrayref3);
-ClassDataTest->_hashref($hashref3);
-ClassDataTest->_scalarref($scalarref3);
-ClassDataTest->_coderef($coderef3);
-ClassDataTest->_scalar($scalar3);
-
-is(refaddr(ClassDataTest->_arrayref), refaddr($arrayref3));
-is(refaddr(ClassDataTest->_hashref), refaddr($hashref3));
-is(refaddr(ClassDataTest->_scalarref), refaddr($scalarref3));
-is(refaddr(ClassDataTest->_coderef), refaddr($coderef3));
-is(ClassDataTest->_scalar, $scalar3);
-
-my $i = bless {}, 'ClassDataTest';
-$i->_scalar('foo');
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,93 +0,0 @@
-use Test::More tests => 22;
-use strict;
-use warnings;
-
-use_ok('Catalyst');
-
-my @complist = map { "MyApp::$_"; } qw/C::Controller M::Model V::View/;
-
-{
- package MyApp;
-
- use base qw/Catalyst/;
-
- __PACKAGE__->components({ map { ($_, $_) } @complist });
-
- # this is so $c->log->warn will work
- __PACKAGE__->setup_log;
-}
-
-is(MyApp->comp('MyApp::V::View'), 'MyApp::V::View', 'Explicit return ok');
-
-is(MyApp->comp('C::Controller'), 'MyApp::C::Controller', 'Two-part return ok');
-
-is(MyApp->comp('Model'), 'MyApp::M::Model', 'Single part return ok');
-
-is_deeply([ MyApp->comp() ], \@complist, 'Empty return ok');
-
-# Is this desired behaviour?
-is_deeply([ MyApp->comp('Foo') ], \@complist, 'Fallthrough return ok');
-
-# regexp behavior
-{
- is_deeply( [ MyApp->comp( qr{Model} ) ], [ 'MyApp::M::Model'], 'regexp ok' );
- is_deeply( [ MyApp->comp('MyApp::V::View$') ], [ 'MyApp::V::View' ], 'Explicit return ok');
- is_deeply( [ MyApp->comp('MyApp::C::Controller$') ], [ 'MyApp::C::Controller' ], 'Explicit return ok');
- is_deeply( [ MyApp->comp('MyApp::M::Model$') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
-
- # a couple other varieties for regexp fallback
- is_deeply( [ MyApp->comp('M::Model') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
-
- {
- my $warnings = 0;
- no warnings 'redefine';
- local *Catalyst::Log::warn = sub { $warnings++ };
-
- is_deeply( [ MyApp->comp('::M::Model') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
- ok( $warnings, 'regexp fallback warnings' );
-
- $warnings = 0;
- is_deeply( [ MyApp->comp('Mode') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
- ok( $warnings, 'regexp fallback warnings' );
-
- $warnings = 0;
- is(MyApp->comp('::M::'), 'MyApp::M::Model', 'Regex return ok');
- ok( $warnings, 'regexp fallback for comp() warns' );
- }
-
-}
-
-# multiple returns
-{
- my @expected = sort qw( MyApp::C::Controller MyApp::M::Model );
- my @got = sort MyApp->comp( qr{::[MC]::} );
- is_deeply( \@got, \@expected, 'multiple results from regexp ok' );
-}
-
-# failed search
-{
- is_deeply( scalar MyApp->comp( qr{DNE} ), 0, 'no results for failed search' );
-}
-
-
-#checking @args passed to ACCEPT_CONTEXT
-{
- my $args;
-
- {
- no warnings 'once';
- *MyApp::M::Model::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
- }
-
- my $c = bless {}, 'MyApp';
-
- $c->component('MyApp::M::Model', qw/foo bar/);
- is_deeply($args, [qw/foo bar/], 'args passed to ACCEPT_CONTEXT ok');
-
- $c->component('M::Model', qw/foo2 bar2/);
- is_deeply($args, [qw/foo2 bar2/], 'args passed to ACCEPT_CONTEXT ok');
-
- $c->component('Mode', qw/foo3 bar3/);
- is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok');
-}
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component_loading.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component_loading.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component_loading.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,226 +0,0 @@
-# 2 initial tests, and 6 per component in the loop below
-# (do not forget to update the number of components in test 3 as well)
-# 5 extra tests for the loading options
-# One test for components in inner packages
-use Test::More tests => 2 + 6 * 24 + 8 + 1;
-
-use strict;
-use warnings;
-
-use File::Spec;
-use File::Path;
-
-my $libdir = 'test_trash';
-unshift(@INC, $libdir);
-
-my $appclass = 'TestComponents';
-my @components = (
- { type => 'Controller', prefix => 'C', name => 'Bar' },
- { type => 'Controller', prefix => 'C', name => 'Foo::Bar' },
- { type => 'Controller', prefix => 'C', name => 'Foo::Foo::Bar' },
- { type => 'Controller', prefix => 'C', name => 'Foo::Foo::Foo::Bar' },
- { type => 'Controller', prefix => 'Controller', name => 'Bar::Bar::Bar::Foo' },
- { type => 'Controller', prefix => 'Controller', name => 'Bar::Bar::Foo' },
- { type => 'Controller', prefix => 'Controller', name => 'Bar::Foo' },
- { type => 'Controller', prefix => 'Controller', name => 'Foo' },
- { type => 'Model', prefix => 'M', name => 'Bar' },
- { type => 'Model', prefix => 'M', name => 'Foo::Bar' },
- { type => 'Model', prefix => 'M', name => 'Foo::Foo::Bar' },
- { type => 'Model', prefix => 'M', name => 'Foo::Foo::Foo::Bar' },
- { type => 'Model', prefix => 'Model', name => 'Bar::Bar::Bar::Foo' },
- { type => 'Model', prefix => 'Model', name => 'Bar::Bar::Foo' },
- { type => 'Model', prefix => 'Model', name => 'Bar::Foo' },
- { type => 'Model', prefix => 'Model', name => 'Foo' },
- { type => 'View', prefix => 'V', name => 'Bar' },
- { type => 'View', prefix => 'V', name => 'Foo::Bar' },
- { type => 'View', prefix => 'V', name => 'Foo::Foo::Bar' },
- { type => 'View', prefix => 'V', name => 'Foo::Foo::Foo::Bar' },
- { type => 'View', prefix => 'View', name => 'Bar::Bar::Bar::Foo' },
- { type => 'View', prefix => 'View', name => 'Bar::Bar::Foo' },
- { type => 'View', prefix => 'View', name => 'Bar::Foo' },
- { type => 'View', prefix => 'View', name => 'Foo' },
-);
-
-sub write_component_file {
- my ($dir_list, $module_name, $content) = @_;
-
- my $dir = File::Spec->catdir(@$dir_list);
- my $file = File::Spec->catfile($dir, $module_name . '.pm');
-
- mkpath(join(q{/}, @$dir_list) );
- open(my $fh, '>', $file) or die "Could not open file $file for writing: $!";
- print $fh $content;
- close $fh;
-}
-
-sub make_component_file {
- my ($type, $prefix, $name) = @_;
-
- my $compbase = "Catalyst::${type}";
- my $fullname = "${appclass}::${prefix}::${name}";
- my @namedirs = split(/::/, $name);
- my $name_final = pop(@namedirs);
- my @dir_list = ($libdir, $appclass, $prefix, @namedirs);
-
- write_component_file(\@dir_list, $name_final, <<EOF);
-package $fullname;
-use MRO::Compat;
-use base '$compbase';
-sub COMPONENT {
- my \$self = shift->next::method(\@_);
- no strict 'refs';
- *{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; };
- \$self;
-}
-1;
-
-EOF
-}
-
-foreach my $component (@components) {
- make_component_file($component->{type},
- $component->{prefix},
- $component->{name});
-}
-
-my $shut_up_deprecated_warnings = q{
- __PACKAGE__->log(Catalyst::Log->new('fatal'));
-};
-
-eval "package $appclass; use Catalyst; $shut_up_deprecated_warnings __PACKAGE__->setup";
-
-can_ok( $appclass, 'components');
-
-my $complist = $appclass->components;
-
-# the +1 below is for the app class itself
-is(scalar keys %$complist, 24+1, "Correct number of components loaded");
-
-foreach (keys %$complist) {
-
- # Skip the component which happens to be the app itself
- next if $_ eq $appclass;
-
- my $instance = $appclass->component($_);
- isa_ok($instance, $_);
- can_ok($instance, 'whoami');
- is($instance->whoami, $_);
-
- if($_ =~ /^${appclass}::(?:V|View)::(.*)/) {
- my $moniker = $1;
- isa_ok($instance, 'Catalyst::View');
- can_ok($appclass->view($moniker), 'whoami');
- is($appclass->view($moniker)->whoami, $_);
- }
- elsif($_ =~ /^${appclass}::(?:M|Model)::(.*)/) {
- my $moniker = $1;
- isa_ok($instance, 'Catalyst::Model');
- can_ok($appclass->model($moniker), 'whoami');
- is($appclass->model($moniker)->whoami, $_);
- }
- elsif($_ =~ /^${appclass}::(?:C|Controller)::(.*)/) {
- my $moniker = $1;
- isa_ok($instance, 'Catalyst::Controller');
- can_ok($appclass->controller($moniker), 'whoami');
- is($appclass->controller($moniker)->whoami, $_);
- }
- else {
- die "Something is wrong with this test, this should"
- . " have been unreachable";
- }
-}
-
-rmtree($libdir);
-
-# test extra component loading options
-
-$appclass = 'ExtraOptions';
-push @components, { type => 'View', prefix => 'Extra', name => 'Foo' };
-
-foreach my $component (@components) {
- make_component_file($component->{type},
- $component->{prefix},
- $component->{name});
-}
-
-eval qq(
-package $appclass;
-use Catalyst;
-$shut_up_deprecated_warnings
-__PACKAGE__->config->{ setup_components } = {
- search_extra => [ '::Extra' ],
- except => [ "${appclass}::Controller::Foo" ]
-};
-__PACKAGE__->setup;
-);
-
-can_ok( $appclass, 'components');
-
-$complist = $appclass->components;
-
-is(scalar keys %$complist, 24+1, "Correct number of components loaded");
-
-ok( !exists $complist->{ "${appclass}::Controller::Foo" }, 'Controller::Foo was skipped' );
-ok( exists $complist->{ "${appclass}::Extra::Foo" }, 'Extra::Foo was loaded' );
-
-rmtree($libdir);
-
-$appclass = "ComponentOnce";
-
-write_component_file([$libdir, $appclass, 'Model'], 'TopLevel', <<EOF);
-package ${appclass}::Model::TopLevel;
-use base 'Catalyst::Model';
-sub COMPONENT {
-
- my \$self = shift->next::method(\@_);
- no strict 'refs';
- *{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; };
- *${appclass}::Model::TopLevel::GENERATED::ACCEPT_CONTEXT = sub {
- return bless {}, 'FooBarBazQuux';
- };
- \$self;
-}
-
-package ${appclass}::Model::TopLevel::Nested;
-
-sub COMPONENT { die "COMPONENT called in the wrong order!"; }
-
-1;
-
-EOF
-
-write_component_file([$libdir, $appclass, 'Model', 'TopLevel'], 'Nested', <<EOF);
-package ${appclass}::Model::TopLevel::Nested;
-use base 'Catalyst::Model';
-
-my \$called=0;
-no warnings 'redefine';
-sub COMPONENT { \$called++;return shift->next::method(\@_); }
-sub called { return \$called };
-1;
-
-EOF
-
-eval "package $appclass; use Catalyst; __PACKAGE__->setup";
-
-is($@, '', "Didn't load component twice");
-is($appclass->model('TopLevel::Nested')->called,1, 'COMPONENT called once');
-
-ok($appclass->model('TopLevel::Generated'), 'Have generated model');
-is(ref($appclass->model('TopLevel::Generated')), 'FooBarBazQuux',
- 'ACCEPT_CONTEXT in generated inner package fired as expected');
-
-$appclass = "InnerComponent";
-
-{
- package InnerComponent::Controller::Test;
- use base 'Catalyst::Controller';
-}
-
-$INC{'InnerComponent/Controller/Test.pm'} = 1;
-
-eval "package $appclass; use Catalyst; __PACKAGE__->setup";
-
-isa_ok($appclass->controller('Test'), 'Catalyst::Controller');
-
-rmtree($libdir);
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component_mro.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component_mro.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_component_mro.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,29 +0,0 @@
-use Test::More tests => 1;
-use strict;
-use warnings;
-
-{
- package MyApp::Component;
- use Test::More;
-
- sub COMPONENT {
- fail 'This no longer gets dispatched to';
- }
-
- package MyApp::MyComponent;
-
- use base 'Catalyst::Component', 'MyApp::Component';
-
-}
-
-my $warn = '';
-{
- local $SIG{__WARN__} = sub {
- $warn .= $_[0];
- };
- MyApp::MyComponent->COMPONENT('MyApp');
-}
-
-like($warn, qr/after Catalyst::Component in MyApp::Component/,
- 'correct warning thrown');
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_engine_fixenv-iis6.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_engine_fixenv-iis6.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_engine_fixenv-iis6.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,62 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-
-use Test::More;
-
-eval "use FCGI";
-plan skip_all => 'FCGI required' if $@;
-
-plan tests => 2;
-
-require Catalyst::Engine::FastCGI;
-
-my %env = (
- 'SCRIPT_NAME' => '/koo/blurb',
- 'PATH_INFO' => '/koo/blurb',
- 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'REQUEST_METHOD' => 'GET',
- 'SCRIPT_FILENAME' => 'C:\\Foo\\script\\blurb',
- 'INSTANCE_META_PATH' => '/LM/W3SVC/793536',
- 'SERVER_SOFTWARE' => 'Microsoft-IIS/6.0',
- 'AUTH_PASSWORD' => '',
- 'AUTH_TYPE' => '',
- 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows; U; Windows NT 5.2; de; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 (.NET CLR 3.5.30729)',
- 'REMOTE_PORT' => '1281',
- 'QUERY_STRING' => '',
- 'URL' => '/koo/blurb',
- 'HTTP_ACCEPT_LANGUAGE' => 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3',
- 'FCGI_ROLE' => 'RESPONDER',
- 'HTTP_KEEP_ALIVE' => '300',
- 'CONTENT_TYPE' => '',
- 'LOCAL_ADDR' => '127.0.0.1',
- 'GATEWAY_INTERFACE' => 'CGI/1.1',
- 'HTTPS' => 'off',
- 'DOCUMENT_ROOT' => 'C:\\Foo\\script',
- 'REMOTE_HOST' => '127.0.0.1',
- 'PATH_TRANSLATED' => 'C:\\Foo\\script\\blurb',
- 'APPL_PHYSICAL_PATH' => 'C:\\Foo\\script\\',
- 'SERVER_NAME' => '127.0.0.1',
- 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
- 'HTTP_CONNECTION' => 'keep-alive',
- 'INSTANCE_ID' => '793536',
- 'CONTENT_LENGTH' => '0',
- 'AUTH_USER' => '',
- 'APPL_MD_PATH' => '/LM/W3SVC/793536/Root/koo',
- 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
- 'REMOTE_USER' => '',
- 'SERVER_PORT_SECURE' => '0',
- 'SERVER_PORT' => 83,
- 'REMOTE_ADDR' => '127.0.0.1',
- 'SERVER_PROTOCOL' => 'HTTP/1.1',
- 'REQUEST_URI' => '/koo/blurb',
- 'APP_POOL_ID' => 'DefaultAppPool',
- 'HTTP_HOST' => '127.0.0.1:83'
-);
-
-Catalyst::Engine::FastCGI->_fix_env(\%env);
-
-is($env{PATH_INFO}, '//blurb', 'check PATH_INFO');
-is($env{SCRIPT_NAME}, '/koo', 'check SCRIPT_NAME');
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_engine_fixenv-lighttpd.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_engine_fixenv-lighttpd.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_engine_fixenv-lighttpd.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,46 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-
-use Test::More;
-
-eval "use FCGI";
-plan skip_all => 'FCGI required' if $@;
-
-plan tests => 2;
-
-require Catalyst::Engine::FastCGI;
-
-my %env = (
- 'SCRIPT_NAME' => '/bar',
- 'SERVER_NAME' => 'localhost:8000',
- 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
- 'HTTP_CONNECTION' => 'keep-alive',
- 'PATH_INFO' => '',
- 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'REQUEST_METHOD' => 'GET',
- 'SCRIPT_FILENAME' => '/tmp/Foo/root/bar',
- 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
- 'SERVER_SOFTWARE' => 'lighttpd/1.4.15',
- 'QUERY_STRING' => '',
- 'REMOTE_PORT' => '22207',
- 'SERVER_PORT' => 8000,
- 'REDIRECT_STATUS' => '200',
- 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5',
- 'REMOTE_ADDR' => '127.0.0.1',
- 'FCGI_ROLE' => 'RESPONDER',
- 'HTTP_KEEP_ALIVE' => '300',
- 'SERVER_PROTOCOL' => 'HTTP/1.1',
- 'REQUEST_URI' => '/bar',
- 'GATEWAY_INTERFACE' => 'CGI/1.1',
- 'SERVER_ADDR' => '127.0.0.1',
- 'DOCUMENT_ROOT' => '/tmp/Foo/root',
- 'HTTP_HOST' => 'localhost:8000',
-);
-
-Catalyst::Engine::FastCGI->_fix_env(\%env);
-
-is($env{PATH_INFO}, '/bar', 'check PATH_INFO');
-ok(!exists($env{SCRIPT_NAME}), 'check SCRIPT_NAME');
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_log.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_log.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_log.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,72 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 23;
-
-my $LOG;
-
-BEGIN {
- chdir 't' if -d 't';
- use lib '../lib';
- $LOG = 'Catalyst::Log';
- use_ok $LOG or die;
-}
-my @MESSAGES;
-{
- no warnings 'redefine';
- *Catalyst::Log::_send_to_log = sub {
- my $self = shift;
- push @MESSAGES, @_;
- };
-}
-
-can_ok $LOG, 'new';
-ok my $log = $LOG->new, '... and creating a new log object should succeed';
-isa_ok $log, $LOG, '... and the object it returns';
-
-can_ok $log, 'is_info';
-ok $log->is_info, '... and the default behavior is to allow info messages';
-
-can_ok $log, 'info';
-ok $log->info('hello there!'),
- '... passing it an info message should succeed';
-
-can_ok $log, "_flush";
-$log->_flush;
-ok @MESSAGES, '... and flushing the log should succeed';
-is scalar @MESSAGES, 1, '... with one log message';
-like $MESSAGES[0], qr/^\[info\] hello there!$/,
- '... which should match the format we expect';
-
-{
-
- package Catalyst::Log::Subclass;
- use base qw/Catalyst::Log/;
-
- sub _send_to_log {
- my $self = shift;
- push @MESSAGES, '---';
- push @MESSAGES, @_;
- }
-}
-
-my $SUBCLASS = 'Catalyst::Log::Subclass';
-can_ok $SUBCLASS, 'new';
-ok $log = Catalyst::Log::Subclass->new,
- '... and the log subclass constructor shoudl return a new object';
-isa_ok $log, $SUBCLASS, '... and the object it returns';
-isa_ok $log, $LOG, '... and it also';
-
-can_ok $log, 'info';
-ok $log->info('hi there!'),
- '... passing it an info message should succeed';
-
-can_ok $log, "_flush";
- at MESSAGES = (); # clear the message log
-$log->_flush;
-ok @MESSAGES, '... and flushing the log should succeed';
-is scalar @MESSAGES, 2, '... with two log messages';
-is $MESSAGES[0], '---', '... with the first one being our new data';
-like $MESSAGES[1], qr/^\[info\] hi there!$/,
- '... which should match the format we expect';
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_merge_config_hashes.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_merge_config_hashes.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_merge_config_hashes.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,43 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-
-my @tests = (
- {
- given => [ { a => 1 }, { b => 1 } ],
- expects => { a => 1, b => 1 }
- },
- {
- given => [ { a => 1 }, { a => { b => 1 } } ],
- expects => { a => { b => 1 } }
- },
- {
- given => [ { a => { b => 1 } }, { a => 1 } ],
- expects => { a => 1 }
- },
- {
- given => [ { a => 1 }, { a => [ 1 ] } ],
- expects => { a => [ 1 ] }
- },
- {
- given => [ { a => [ 1 ] }, { a => 1 } ],
- expects => { a => 1 }
- },
- {
- given => [ { a => { b => 1 } }, { a => { b => 2 } } ],
- expects => { a => { b => 2 } }
- },
- {
- given => [ { a => { b => 1 } }, { a => { c => 1 } } ],
- expects => { a => { b => 1, c => 1 } }
- },
-);
-
-plan tests => scalar @tests + 1;
-
-use_ok('Catalyst');
-
-for my $test ( @ tests ) {
- is_deeply( Catalyst->merge_config_hashes( @{ $test->{ given } } ), $test->{ expects } );
-}
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_mvc.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_mvc.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_mvc.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,183 +0,0 @@
-use Test::More tests => 46;
-use strict;
-use warnings;
-
-use_ok('Catalyst');
-
-my @complist =
- map { "MyApp::$_"; }
- qw/C::Controller M::Model V::View Controller::C Model::M View::V Controller::Model::Dummy::Model Model::Dummy::Model/;
-
-{
-
- package MyApp;
-
- use base qw/Catalyst/;
-
- __PACKAGE__->components( { map { ( ref($_)||$_ , $_ ) } @complist } );
-
- my $thingie={};
- bless $thingie, 'Some::Test::Object';
- __PACKAGE__->components->{'MyApp::Model::Test::Object'} = $thingie;
-
- # allow $c->log->warn to work
- __PACKAGE__->setup_log;
-}
-
-is( MyApp->view('View'), 'MyApp::V::View', 'V::View ok' );
-
-is( MyApp->controller('Controller'),
- 'MyApp::C::Controller', 'C::Controller ok' );
-
-is( MyApp->model('Model'), 'MyApp::M::Model', 'M::Model ok' );
-
-is( MyApp->model('Dummy::Model'), 'MyApp::Model::Dummy::Model', 'Model::Dummy::Model ok' );
-
-isa_ok( MyApp->model('Test::Object'), 'Some::Test::Object', 'Test::Object ok' );
-
-is( MyApp->controller('Model::Dummy::Model'), 'MyApp::Controller::Model::Dummy::Model', 'Controller::Model::Dummy::Model ok' );
-
-is( MyApp->view('V'), 'MyApp::View::V', 'View::V ok' );
-
-is( MyApp->controller('C'), 'MyApp::Controller::C', 'Controller::C ok' );
-
-is( MyApp->model('M'), 'MyApp::Model::M', 'Model::M ok' );
-
-# failed search
-{
- is( MyApp->model('DNE'), undef, 'undef for invalid search' );
-}
-
-is_deeply( [ sort MyApp->views ],
- [ qw/V View/ ],
- 'views ok' );
-
-is_deeply( [ sort MyApp->controllers ],
- [ qw/C Controller Model::Dummy::Model/ ],
- 'controllers ok');
-
-is_deeply( [ sort MyApp->models ],
- [ qw/Dummy::Model M Model Test::Object/ ],
- 'models ok');
-
-{
- my $warnings = 0;
- no warnings 'redefine';
- local *Catalyst::Log::warn = sub { $warnings++ };
-
- like (MyApp->view , qr/^MyApp\::(V|View)\::/ , 'view() with no defaults returns *something*');
- ok( $warnings, 'view() w/o a default is random, warnings thrown' );
-}
-
-is ( bless ({stash=>{current_view=>'V'}}, 'MyApp')->view , 'MyApp::View::V', 'current_view ok');
-
-my $view = bless {} , 'MyApp::View::V';
-is ( bless ({stash=>{current_view_instance=> $view }}, 'MyApp')->view , $view, 'current_view_instance ok');
-
-is ( bless ({stash=>{current_view_instance=> $view, current_view=>'MyApp::V::View' }}, 'MyApp')->view , $view,
- 'current_view_instance precedes current_view ok');
-
-{
- my $warnings = 0;
- no warnings 'redefine';
- local *Catalyst::Log::warn = sub { $warnings++ };
-
- ok( my $model = MyApp->model );
-
- ok( (($model =~ /^MyApp\::(M|Model)\::/) ||
- $model->isa('Some::Test::Object')),
- 'model() with no defaults returns *something*' );
-
- ok( $warnings, 'model() w/o a default is random, warnings thrown' );
-}
-
-is ( bless ({stash=>{current_model=>'M'}}, 'MyApp')->model , 'MyApp::Model::M', 'current_model ok');
-
-my $model = bless {} , 'MyApp::Model::M';
-is ( bless ({stash=>{current_model_instance=> $model }}, 'MyApp')->model , $model, 'current_model_instance ok');
-
-is ( bless ({stash=>{current_model_instance=> $model, current_model=>'MyApp::M::Model' }}, 'MyApp')->model , $model,
- 'current_model_instance precedes current_model ok');
-
-MyApp->config->{default_view} = 'V';
-is ( bless ({stash=>{}}, 'MyApp')->view , 'MyApp::View::V', 'default_view ok');
-is ( MyApp->view , 'MyApp::View::V', 'default_view in class method ok');
-
-MyApp->config->{default_model} = 'M';
-is ( bless ({stash=>{}}, 'MyApp')->model , 'MyApp::Model::M', 'default_model ok');
-is ( MyApp->model , 'MyApp::Model::M', 'default_model in class method ok');
-
-# regexp behavior tests
-{
- # is_deeply is used because regexp behavior means list context
- is_deeply( [ MyApp->view( qr{^V[ie]+w$} ) ], [ 'MyApp::V::View' ], 'regexp view ok' );
- is_deeply( [ MyApp->controller( qr{Dummy\::Model$} ) ], [ 'MyApp::Controller::Model::Dummy::Model' ], 'regexp controller ok' );
- is_deeply( [ MyApp->model( qr{Dum{2}y} ) ], [ 'MyApp::Model::Dummy::Model' ], 'regexp model ok' );
-
- # object w/ qr{}
- is_deeply( [ MyApp->model( qr{Test} ) ], [ MyApp->components->{'MyApp::Model::Test::Object'} ], 'Object returned' );
-
- {
- my $warnings = 0;
- no warnings 'redefine';
- local *Catalyst::Log::warn = sub { $warnings++ };
-
- # object w/ regexp fallback
- is_deeply( [ MyApp->model( 'Test' ) ], [ MyApp->components->{'MyApp::Model::Test::Object'} ], 'Object returned' );
- ok( $warnings, 'regexp fallback warnings' );
- }
-
- is_deeply( [ MyApp->view('MyApp::V::View$') ], [ 'MyApp::V::View' ], 'Explicit return ok');
- is_deeply( [ MyApp->controller('MyApp::C::Controller$') ], [ 'MyApp::C::Controller' ], 'Explicit return ok');
- is_deeply( [ MyApp->model('MyApp::M::Model$') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
-}
-
-{
- my @expected = qw( MyApp::C::Controller MyApp::Controller::C );
- is_deeply( [ sort MyApp->controller( qr{^C} ) ], \@expected, 'multiple controller returns from regexp search' );
-}
-
-{
- my @expected = qw( MyApp::V::View MyApp::View::V );
- is_deeply( [ sort MyApp->view( qr{^V} ) ], \@expected, 'multiple view returns from regexp search' );
-}
-
-{
- my @expected = qw( MyApp::M::Model MyApp::Model::M );
- is_deeply( [ sort MyApp->model( qr{^M} ) ], \@expected, 'multiple model returns from regexp search' );
-}
-
-# failed search
-{
- is( scalar MyApp->controller( qr{DNE} ), 0, '0 results for failed search' );
-}
-
-#checking @args passed to ACCEPT_CONTEXT
-{
- my $args;
-
- {
- no warnings 'once';
- *MyApp::Model::M::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
- *MyApp::View::V::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
- }
-
- my $c = bless {}, 'MyApp';
-
- # test accept-context with class rather than instance
- MyApp->model('M', qw/foo bar/);
- is_deeply($args, [qw/foo bar/], 'MyApp->model args passed to ACCEPT_CONTEXT ok');
-
-
- $c->model('M', qw/foo bar/);
- is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok');
-
- my $x = $c->view('V', qw/foo2 bar2/);
- is_deeply($args, [qw/foo2 bar2/], '$c->view args passed to ACCEPT_CONTEXT ok');
-
- # regexp fallback
- $c->view('::View::V', qw/foo3 bar3/);
- is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok');
-
-
-}
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_path_to.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_path_to.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_path_to.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,39 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-
-my %non_unix = (
- MacOS => 1,
- MSWin32 => 1,
- os2 => 1,
- VMS => 1,
- epoc => 1,
- NetWare => 1,
- dos => 1,
- cygwin => 1
-);
-
-my $os = $non_unix{$^O} ? $^O : 'Unix';
-
-if( $os ne 'Unix' ) {
- plan skip_all => 'tests require Unix';
-}
-else {
- plan tests => 3;
-}
-
-use_ok('Catalyst');
-
-my $context = 'Catalyst';
-
-my $config = Catalyst->config;
-
-$config->{home} = '/home/sri/my-app/';
-
-is( Catalyst::path_to( $context, 'foo' ), '/home/sri/my-app/foo', 'Unix path' );
-
-$config->{home} = '/Users/sri/myapp/';
-
-is( Catalyst::path_to( $context, 'foo', 'bar' ),
- '/Users/sri/myapp/foo/bar', 'deep Unix path' );
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_plugin.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_plugin.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_plugin.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,64 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More tests => 24;
-
-use lib 't/lib';
-
-{
-
- package Faux::Plugin;
-
- sub new { bless {}, shift }
- my $count = 1;
- sub count { $count++ }
-}
-
-my $warnings = 0;
-
-use PluginTestApp;
-my $logger = Class::MOP::Class->create_anon_class(
- methods => {
- error => sub {0},
- debug => sub {0},
- info => sub {0},
- warn => sub {
- if ($_[1] =~ /plugin method is deprecated/) {
- $warnings++;
- return;
- }
- die "Caught unexpected warning: " . $_[1];
- },
- },
-)->new_object;
-PluginTestApp->log($logger);
-
-use Catalyst::Test qw/PluginTestApp/;
-
-ok( get("/compile_time_plugins"), "get ok" );
-is( $warnings, 0, 'no warnings' );
-# FIXME - Run time plugin support is insane, and should be removed
-# for Catalyst 5.9
-ok( get("/run_time_plugins"), "get ok" );
-
-local $ENV{CATALYST_DEBUG} = 0;
-
-is( $warnings, 1, '1 warning' );
-
-use_ok 'TestApp';
-my @expected = qw(
- Catalyst::Plugin::Test::Errors
- Catalyst::Plugin::Test::Headers
- Catalyst::Plugin::Test::Inline
- Catalyst::Plugin::Test::MangleDollarUnderScore
- Catalyst::Plugin::Test::Plugin
- TestApp::Plugin::AddDispatchTypes
- TestApp::Plugin::FullyQualified
-);
-
-# Faux::Plugin is no longer reported
-is_deeply [ TestApp->registered_plugins ], \@expected,
- 'registered_plugins() should only report the plugins for the current class';
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,88 +0,0 @@
-use strict;
-use warnings;
-use Class::MOP::Class;
-use Catalyst::Runtime;
-
-use Test::More tests => 29;
-
-{
- # Silence the log.
- my $meta = Catalyst::Log->meta;
- $meta->make_mutable;
- $meta->remove_method('_send_to_log');
- $meta->add_method('_send_to_log', sub {});
-}
-
-sub build_test_app_with_setup {
- my ($name, @flags) = @_;
- my $flags = '(' . join(', ', map { "'".$_."'" } @flags) . ')';
- $flags = '' if $flags eq '()';
- eval qq{
- package $name;
- use Catalyst $flags;
- $name->setup;
- };
- die $@ if $@;
- return $name;
-}
-
-local %ENV = %ENV;
-
-# Remove all relevant env variables to avoid accidental fail
-foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) {
- delete $ENV{$name};
-}
-
-{
- my $app = build_test_app_with_setup('TestAppMyTestDebug', '-Debug');
-
- ok my $c = $app->new, 'Get debug app object';
- ok my $log = $c->log, 'Get log object';
- isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
- ok $log->is_warn, 'Warnings should be enabled';
- ok $log->is_error, 'Errors should be enabled';
- ok $log->is_fatal, 'Fatal errors should be enabled';
- ok $log->is_info, 'Info should be enabled';
- ok $log->is_debug, 'Debugging should be enabled';
- ok $app->debug, 'debug method should return true';
-}
-
-{
- my $app = build_test_app_with_setup('TestAppMyTestLogParam', '-Log=warn,error,fatal');
-
- ok my $c = $app->new, 'Get log app object';
- ok my $log = $c->log, 'Get log object';
- isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
- ok $log->is_warn, 'Warnings should be enabled';
- ok $log->is_error, 'Errors should be enabled';
- ok $log->is_fatal, 'Fatal errors should be enabled';
- ok !$log->is_info, 'Info should be disabled';
- ok !$log->is_debug, 'Debugging should be disabled';
- ok !$c->debug, 'Catalyst debugging is off';
-}
-{
- my $app = build_test_app_with_setup('TestAppMyTestNoParams');
-
- ok my $c = $app->new, 'Get log app object';
- ok my $log = $c->log, 'Get log object';
- isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
- ok $log->is_warn, 'Warnings should be enabled';
- ok $log->is_error, 'Errors should be enabled';
- ok $log->is_fatal, 'Fatal errors should be enabled';
- ok $log->is_info, 'Info should be enabled';
- ok $log->is_debug, 'Debugging should be enabled';
- ok !$c->debug, 'Catalyst debugging turned off';
-}
-my $log_meta = Class::MOP::Class->create_anon_class(
- methods => { map { $_ => sub { 0 } } qw/debug error fatal info warn/ },
-);
-{
- package TestAppWithOwnLogger;
- use base qw/Catalyst/;
- __PACKAGE__->log($log_meta->new_object);
- __PACKAGE__->setup('-Debug');
-}
-
-ok my $c = TestAppWithOwnLogger->new, 'Get with own logger app object';
-ok $c->debug, '$c->debug is true';
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup_log.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup_log.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup_log.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,101 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 30;
-use Test::Exception;
-
-use Catalyst ();
-
-sub mock_app {
- my $name = shift;
- print "Setting up mock application: $name\n";
- my $meta = Moose->init_meta( for_class => $name );
- $meta->superclasses('Catalyst');
- return $meta->name;
-}
-
-sub test_log_object {
- my ($log, %expected) = @_;
- foreach my $level (keys %expected) {
- my $method_name = "is_$level";
- if ($expected{$level}) {
- ok( $log->$method_name(), "Level $level on" );
- }
- else {
- ok( !$log->$method_name(), "Level $level off" );
- }
- }
-}
-
-local %ENV = %ENV;
-
-# Remove all relevant env variables to avoid accidental fail
-foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) {
- delete $ENV{$name};
-}
-
-{
- my $app = mock_app('TestAppParseLogLevels');
- $app->setup_log('error,warn');
- ok !$app->debug, 'Not in debug mode';
- test_log_object($app->log,
- fatal => 1,
- error => 1,
- warn => 1,
- info => 0,
- debug => 0,
- );
-}
-{
- local %ENV = %ENV;
- $ENV{CATALYST_DEBUG} = 1;
- my $app = mock_app('TestAppLogDebugEnvSet');
- $app->setup_log('');
- ok $app->debug, 'In debug mode';
- test_log_object($app->log,
- fatal => 1,
- error => 1,
- warn => 1,
- info => 1,
- debug => 1,
- );
-}
-{
- local %ENV = %ENV;
- $ENV{CATALYST_DEBUG} = 0;
- my $app = mock_app('TestAppLogDebugEnvUnset');
- $app->setup_log('warn');
- ok !$app->debug, 'Not In debug mode';
- test_log_object($app->log,
- fatal => 1,
- error => 1,
- warn => 1,
- info => 0,
- debug => 0,
- );
-}
-{
- my $app = mock_app('TestAppLogEmptyString');
- $app->setup_log('');
- ok !$app->debug, 'Not In debug mode';
- # Note that by default, you get _all_ the log levels turned on
- test_log_object($app->log,
- fatal => 1,
- error => 1,
- warn => 1,
- info => 1,
- debug => 1,
- );
-}
-{
- my $app = mock_app('TestAppLogDebugOnly');
- $app->setup_log('debug');
- ok $app->debug, 'In debug mode';
- test_log_object($app->log,
- fatal => 1,
- error => 1,
- warn => 1,
- info => 1,
- debug => 1,
- );
-}
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup_stats.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup_stats.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_setup_stats.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,69 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 5;
-use Class::MOP::Class;
-
-use Catalyst ();
-
-my %log_messages; # TODO - Test log messages as expected.
-my $mock_log = Class::MOP::Class->create_anon_class(
- methods => {
- map { my $level = $_;
- $level => sub {
- $log_messages{$level} ||= [];
- push(@{ $log_messages{$level} }, $_[1]);
- },
- }
- qw/debug info warn error fatal/,
- },
-)->new_object;
-
-sub mock_app {
- my $name = shift;
- %log_messages = (); # Flatten log messages.
- my $meta = Moose->init_meta( for_class => $name );
- $meta->superclasses('Catalyst');
- $meta->add_method('log', sub { $mock_log });
- return $meta->name;
-}
-
-local %ENV = %ENV;
-
-# Remove all relevant env variables to avoid accidental fail
-foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) {
- delete $ENV{$name};
-}
-
-{
- my $app = mock_app('TestAppNoStats');
- $app->setup_stats();
- ok !$app->use_stats, 'stats off by default';
-}
-{
- my $app = mock_app('TestAppStats');
- $app->setup_stats(1);
- ok $app->use_stats, 'stats on if you say >setup_stats(1)';
-}
-{
- my $app = mock_app('TestAppStatsDebugTurnsStatsOn');
- $app->meta->add_method('debug' => sub { 1 });
- $app->setup_stats();
- ok $app->use_stats, 'debug on turns stats on';
-}
-{
- local %ENV = %ENV;
- $ENV{CATALYST_STATS} = 1;
- my $app = mock_app('TestAppStatsEnvSet');
- $app->setup_stats();
- ok $app->use_stats, 'ENV turns stats on';
-}
-{
- local %ENV = %ENV;
- $ENV{CATALYST_STATS} = 0;
- my $app = mock_app('TestAppStatsEnvUnset');
- $app->meta->add_method('debug' => sub { 1 });
- $app->setup_stats(1);
- ok !$app->use_stats, 'ENV turns stats off, even when debug on and ->setup_stats(1)';
-}
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_uri_for.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_uri_for.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_uri_for.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,145 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 20;
-use URI;
-
-use_ok('Catalyst');
-
-my $request = Catalyst::Request->new( {
- base => URI->new('http://127.0.0.1/foo')
- } );
-
-my $context = Catalyst->new( {
- request => $request,
- namespace => 'yada',
- } );
-
-is(
- Catalyst::uri_for( $context, '/bar/baz' )->as_string,
- 'http://127.0.0.1/foo/bar/baz',
- 'URI for absolute path'
-);
-
-is(
- Catalyst::uri_for( $context, 'bar/baz' )->as_string,
- 'http://127.0.0.1/foo/yada/bar/baz',
- 'URI for relative path'
-);
-
-is(
- Catalyst::uri_for( $context, '', 'arg1', 'arg2' )->as_string,
- 'http://127.0.0.1/foo/yada/arg1/arg2',
- 'URI for undef action with args'
-);
-
-
-is( Catalyst::uri_for( $context, '../quux' )->as_string,
- 'http://127.0.0.1/foo/quux', 'URI for relative dot path' );
-
-is(
- Catalyst::uri_for( $context, 'quux', { param1 => 'value1' } )->as_string,
- 'http://127.0.0.1/foo/yada/quux?param1=value1',
- 'URI for undef action with query params'
-);
-
-is (Catalyst::uri_for( $context, '/bar/wibble?' )->as_string,
- 'http://127.0.0.1/foo/bar/wibble%3F', 'Question Mark gets encoded'
-);
-
-is( Catalyst::uri_for( $context, qw/bar wibble?/, 'with space' )->as_string,
- 'http://127.0.0.1/foo/yada/bar/wibble%3F/with%20space', 'Space gets encoded'
-);
-
-is(
- Catalyst::uri_for( $context, '/bar', 'with+plus', { 'also' => 'with+plus' })->as_string,
- 'http://127.0.0.1/foo/bar/with+plus?also=with%2Bplus',
- 'Plus is not encoded'
-);
-
-# test with utf-8
-is(
- Catalyst::uri_for( $context, 'quux', { param1 => "\x{2620}" } )->as_string,
- 'http://127.0.0.1/foo/yada/quux?param1=%E2%98%A0',
- 'URI for undef action with query params in unicode'
-);
-is(
- Catalyst::uri_for( $context, 'quux', { 'param:1' => "foo" } )->as_string,
- 'http://127.0.0.1/foo/yada/quux?param%3A1=foo',
- 'URI for undef action with query params in unicode'
-);
-
-# test with object
-is(
- Catalyst::uri_for( $context, 'quux', { param1 => $request->base } )->as_string,
- 'http://127.0.0.1/foo/yada/quux?param1=http%3A%2F%2F127.0.0.1%2Ffoo',
- 'URI for undef action with query param as object'
-);
-
-$request->base( URI->new('http://localhost:3000/') );
-$request->match( 'orderentry/contract' );
-is(
- Catalyst::uri_for( $context, '/Orderentry/saveContract' )->as_string,
- 'http://localhost:3000/Orderentry/saveContract',
- 'URI for absolute path'
-);
-
-{
- $request->base( URI->new('http://127.0.0.1/') );
-
- $context->namespace('');
-
- is( Catalyst::uri_for( $context, '/bar/baz' )->as_string,
- 'http://127.0.0.1/bar/baz', 'URI with no base or match' );
-
- # test "0" as the path
- is( Catalyst::uri_for( $context, qw/0 foo/ )->as_string,
- 'http://127.0.0.1/0/foo', '0 as path is ok'
- );
-
-}
-
-# test with undef -- no warnings should be thrown
-{
- my $warnings = 0;
- local $SIG{__WARN__} = sub { $warnings++ };
-
- Catalyst::uri_for( $context, '/bar/baz', { foo => undef } )->as_string,
- is( $warnings, 0, "no warnings emitted" );
-}
-
-# Test with parameters '/', 'foo', 'bar' - should not generate a //
-is( Catalyst::uri_for( $context, qw| / foo bar | )->as_string,
- 'http://127.0.0.1/foo/bar', 'uri is /foo/bar, not //foo/bar'
-);
-
-TODO: {
- local $TODO = 'RFCs are for people who, erm - fix this test..';
- # Test rfc3986 reserved characters. These characters should all be escaped
- # according to the RFC, but it is a very big feature change so I've removed it
- no warnings; # Yes, everything in qw is sane
- is(
- Catalyst::uri_for( $context, qw|! * ' ( ) ; : @ & = $ / ? % # [ ] ,|, )->as_string,
- 'http://127.0.0.1/%21/%2A/%27/%2B/%29/%3B/%3A/%40/%26/%3D/%24/%2C/%2F/%3F/%25/%23/%5B/%5D',
- 'rfc 3986 reserved characters'
- );
-
- # jshirley bug - why the hell does only one of these get encoded
- # has been like this forever however.
- is(
- Catalyst::uri_for( $context, qw|{1} {2}| )->as_string,
- 'http://127.0.0.1/{1}/{2}',
- 'not-escaping unreserved characters'
- );
-}
-
-# make sure caller's query parameter hash isn't messed up
-{
- my $query_params_base = {test => "one two",
- bar => ["foo baz", "bar"]};
- my $query_params_test = {test => "one two",
- bar => ["foo baz", "bar"]};
- Catalyst::uri_for($context, '/bar/baz', $query_params_test);
- is_deeply($query_params_base, $query_params_test,
- "uri_for() doesn't mess up query parameter hash in the caller");
-}
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_uri_with.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_uri_with.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_uri_with.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,69 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 10;
-use URI;
-
-use_ok('Catalyst::Request');
-
-my $request = Catalyst::Request->new( {
- uri => URI->new('http://127.0.0.1/foo/bar/baz')
- } );
-
-is(
- $request->uri_with({}),
- 'http://127.0.0.1/foo/bar/baz',
- 'URI for absolute path'
-);
-
-is(
- $request->uri_with({ foo => 'bar' }),
- 'http://127.0.0.1/foo/bar/baz?foo=bar',
- 'URI adds param'
-);
-
-my $request2 = Catalyst::Request->new( {
- uri => URI->new('http://127.0.0.1/foo/bar/baz?bar=gorch')
- } );
-is(
- $request2->uri_with({}),
- 'http://127.0.0.1/foo/bar/baz?bar=gorch',
- 'URI retains param'
-);
-
-is(
- $request2->uri_with({ me => 'awesome' }),
- 'http://127.0.0.1/foo/bar/baz?bar=gorch&me=awesome',
- 'URI retains param and adds new'
-);
-
-is(
- $request2->uri_with({ bar => undef }),
- 'http://127.0.0.1/foo/bar/baz',
- 'URI loses param when explicitly undef'
-);
-
-is(
- $request2->uri_with({ bar => 'snort' }),
- 'http://127.0.0.1/foo/bar/baz?bar=snort',
- 'URI changes param'
-);
-
-is(
- $request2->uri_with({ bar => [ 'snort', 'ewok' ] }),
- 'http://127.0.0.1/foo/bar/baz?bar=snort&bar=ewok',
- 'overwrite mode URI appends arrayref param'
-);
-
-is(
- $request2->uri_with({ bar => 'snort' }, { mode => 'append' }),
- 'http://127.0.0.1/foo/bar/baz?bar=gorch&bar=snort',
- 'append mode URI appends param'
-);
-
-is(
- $request2->uri_with({ bar => [ 'snort', 'ewok' ] }, { mode => 'append' }),
- 'http://127.0.0.1/foo/bar/baz?bar=gorch&bar=snort&bar=ewok',
- 'append mode URI appends arrayref param'
-);
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_dispatcher_requestargs_restore.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_dispatcher_requestargs_restore.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_dispatcher_requestargs_restore.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,57 +0,0 @@
-# Insane test case for the behavior needed by Plugin::Auhorization::ACL
-
-# We have to localise $c->request->{arguments} in
-# Catalyst::Dispatcher::_do_forward, rather than using save and restore,
-# as otherwise, the calling $c->detach on an action which says
-# die $Catalyst:DETACH causes the request arguments to not get restored,
-# and therefore sub gorch gets the wrong string $frozjob parameter.
-
-# Please feel free to break this behavior once a sane hook for safely
-# executing another action from the dispatcher (i.e. wrapping actions)
-# is present, so that the Authorization::ACL plugin can be re-written
-# to not be full of such crazy shit.
-{
- package ACLTestApp;
- use Test::More;
-
- use strict;
- use warnings;
- use MRO::Compat;
- use Scalar::Util ();
-
- use base qw/Catalyst Catalyst::Controller/;
- use Catalyst qw//;
-
- sub execute {
- my $c = shift;
- my ( $class, $action ) = @_;
-
- if ( Scalar::Util::blessed($action)
- and $action->name ne "foobar" ) {
- eval { $c->detach( 'foobar', [$action, 'foo'] ) };
- }
-
- $c->next::method( @_ );
- }
-
- sub foobar : Private {
- die $Catalyst::DETACH;
- }
-
- sub gorch : Local {
- my ( $self, $c, $frozjob ) = @_;
- is $frozjob, 'wozzle';
- $c->res->body("gorch");
- }
-
- __PACKAGE__->setup;
-}
-
-use strict;
-use warnings;
-use FindBin qw/$Bin/;
-use lib "$Bin/lib";
-use Catalyst::Test 'ACLTestApp';
-use Test::More tests => 1;
-
-request('http://localhost/gorch/wozzle');
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_load_catalyst_test.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_load_catalyst_test.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_load_catalyst_test.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,154 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-
-use FindBin;
-use lib "$FindBin::Bin/lib";
-use Test::More tests => 59;
-use FindBin qw/$Bin/;
-use lib "$Bin/lib";
-use Catalyst::Utils;
-use HTTP::Request::Common;
-use Test::Exception;
-
-my $Class = 'Catalyst::Test';
-my $App = 'TestApp';
-my $Pkg = __PACKAGE__;
-my $Url = 'http://localhost/';
-my $Content = "root index";
-
-my %Meth = (
- $Pkg => [qw|get request ctx_request|], # exported
- $Class => [qw|local_request remote_request|], # not exported
-);
-
-### make sure we're not trying to connect to a remote host -- these are local tests
-local $ENV{CATALYST_SERVER};
-
-use_ok( $Class );
-
-### check available methods
-{ ### turn of redefine warnings, we'll get new subs exported
- ### XXX 'no warnings' and 'local $^W' wont work as warnings are turned on in
- ### test.pm, so trap them for now --kane
- { local $SIG{__WARN__} = sub {};
- ok( $Class->import, "Argumentless import for methods only" );
- }
-
- while( my($class, $meths) = each %Meth ) {
- for my $meth ( @$meths ) { SKIP: {
-
- ### method available?
- can_ok( $class, $meth );
-
- ### only for exported methods
- skip "Error tests only for exported methods", 2 unless $class eq $Pkg;
-
- ### check error conditions
- eval { $class->can($meth)->( $Url ) };
- ok( $@, " $meth without app gives error" );
- like( $@, qr/$Class/,
- " Error filled with expected content for '$meth'" );
- } }
- }
-}
-
-### simple tests for exported methods
-{ ### turn of redefine warnings, we'll get new subs exported
- ### XXX 'no warnings' and 'local $^W' wont work as warnings are turned on in
- ### test.pm, so trap them for now --kane
- { local $SIG{__WARN__} = sub {};
- ok( $Class->import( $App ),
- "Loading $Class for App $App" );
- }
-
- ### test exported methods again
- for my $meth ( @{ $Meth{$Pkg} } ) { SKIP: {
-
- ### do a call, we should get a result and perhaps a $c if it's 'ctx_request';
- my ($res, $c) = eval { $Pkg->can($meth)->( $Url ) };
-
- ok( 1, " Called $Pkg->$meth( $Url )" );
- ok( !$@, " No critical error $@" );
- ok( $res, " Result obtained" );
-
- ### get the content as a string, to make sure we got what we expected
- my $res_as_string = $meth eq 'get' ? $res : $res->content;
- is( $res_as_string, $Content,
- " Content as expected: $res_as_string" );
-
- ### some tests for 'ctx_request'
- skip "Context tests skipped for '$meth'", 6 unless $meth eq 'ctx_request';
-
- ok( $c, " Context object returned" );
- isa_ok( $c, $App, " Object" );
- is( $c->request->uri, $Url,
- " Url recorded in request" );
- is( $c->response->body, $Content,
- " Content recorded in response" );
- ok( $c->stash, " Stash accessible" );
- ok( $c->action, " Action object accessible" );
- } }
-}
-
-### perl5.8.8 + cat 5.80's Cat::Test->ctx_request didn't return $c the 2nd
-### time it was invoked. Without tracking the bug down all the way, it was
-### clearly related to the Moose'ification of Cat::Test and a scoping issue
-### with a 'my'd variable. Since the same code works fine in 5.10, a bug in
-### either Moose or perl 5.8 is suspected.
-{ ok( 1, "Testing consistency of ctx_request()" );
- for( 1..2 ) {
- my($res, $c) = ctx_request( $Url );
- ok( $c, " Call $_: Context object returned" );
- }
-}
-
-# FIXME - These vhosts in tests tests should be somewhere else...
-
-sub customize { Catalyst::Test::_customize_request(@_) }
-
-{
- my $req = Catalyst::Utils::request('/dummy');
- customize( $req );
- is( $req->header('Host'), undef, 'normal request is unmodified' );
-}
-
-{
- my $req = Catalyst::Utils::request('/dummy');
- customize( $req, { host => 'customized.com' } );
- like( $req->header('Host'), qr/customized.com/, 'request is customizable via opts hash' );
-}
-
-{
- my $req = Catalyst::Utils::request('/dummy');
- local $Catalyst::Test::default_host = 'localized.com';
- customize( $req );
- like( $req->header('Host'), qr/localized.com/, 'request is customizable via package var' );
-}
-
-{
- my $req = Catalyst::Utils::request('/dummy');
- local $Catalyst::Test::default_host = 'localized.com';
- customize( $req, { host => 'customized.com' } );
- like( $req->header('Host'), qr/customized.com/, 'opts hash takes precedence over package var' );
-}
-
-{
- my $req = Catalyst::Utils::request('/dummy');
- local $Catalyst::Test::default_host = 'localized.com';
- customize( $req, { host => '' } );
- is( $req->header('Host'), undef, 'default value can be temporarily cleared via opts hash' );
-}
-
-# Back compat test, extra args used to be ignored, now a hashref of options.
-use_ok('Catalyst::Test', 'TestApp', 'foobar');
-
-# Back compat test, ensure that request ignores anything which isn't a hash.
-lives_ok {
- request(GET('/dummy'), 'foo');
-} 'scalar additional param to request method ignored';
-lives_ok {
- request(GET('/dummy'), []);
-} 'array additional param to request method ignored';
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_extend_non_moose_controller.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_extend_non_moose_controller.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_extend_non_moose_controller.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,20 +0,0 @@
-use Catalyst ();
-
-{
- package TestApp;
- use base qw/Catalyst/;
-}
-{
- package TestApp::Controller::Base;
- use base qw/Catalyst::Controller/;
-}
-{
- package TestApp::Controller::Other;
- use Moose;
- use Test::More tests => 1;
- use Test::Exception;
- lives_ok {
- extends 'TestApp::Controller::Base';
- };
-}
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_non_moose.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_non_moose.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_non_moose.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,7 +0,0 @@
-#!/usr/bin/env perl
-use strict;
-use warnings;
-use lib 't/lib';
-use Test::More tests => 1;
-use_ok('TestAppMetaCompat');
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_non_moose_controller.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_non_moose_controller.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_metaclass_compat_non_moose_controller.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,19 +0,0 @@
-use strict;
-use warnings;
-
-use FindBin;
-use lib "$FindBin::Bin/lib";
-
-use Test::More tests => 1;
-use Test::Exception;
-use TestAppNonMooseController;
-
-# Metaclass init order causes fail.
-# There are TODO tests in Moose for this, see
-# f2391d17574eff81d911b97be15ea51080500003
-# after which the evil kludge in core can die in a fire.
-
-lives_ok {
- TestAppNonMooseController::ControllerBase->get_action_methods
-} 'Base class->get_action_methods ok when sub class initialized first';
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_response.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_response.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_response.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,18 +0,0 @@
-use strict;
-use warnings;
-use Test::More tests => 6;
-
-use_ok('Catalyst::Response');
-
-my $res = Catalyst::Response->new;
-
-# test aliasing of res->code for res->status
-$res->code(500);
-is($res->code, 500, 'code sets itself');
-is($res->status, 500, 'code sets status');
-$res->status(501);
-is($res->code, 501, 'status sets code');
-is($res->body, '', "default response body ''");
-$res->body(undef);
-is($res->body, '', "response body '' after assigned undef");
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_env_value.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_env_value.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_env_value.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,44 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 5;
-
-BEGIN { use_ok("Catalyst::Utils") }
-
-##############################################################################
-### No env vars defined
-##############################################################################
-{
- ok( !Catalyst::Utils::env_value( 'MyApp', 'Key' ),
- 'No env values defined returns false'
- );
-}
-
-##############################################################################
-### App env var defined
-##############################################################################
-{
- $ENV{'MYAPP2_KEY'} = 'Env value 2';
- is( Catalyst::Utils::env_value( 'MyApp2', 'Key' ),
- 'Env value 2', 'Got the right value from the application var' );
-}
-
-##############################################################################
-### Catalyst env var defined
-##############################################################################
-{
- $ENV{'CATALYST_KEY'} = 'Env value 3';
- is( Catalyst::Utils::env_value( 'MyApp3', 'Key' ),
- 'Env value 3', 'Got the right value from the catalyst var' );
-}
-
-##############################################################################
-### Catalyst and Application env vars defined
-##############################################################################
-{
- $ENV{'CATALYST_KEY'} = 'Env value bad';
- $ENV{'MYAPP4_KEY'} = 'Env value 4';
- is( Catalyst::Utils::env_value( 'MyApp4', 'Key' ),
- 'Env value 4', 'Got the right value from the application var' );
-}
-
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_prefix.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_prefix.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_prefix.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,26 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More tests => 9;
-
-use lib "t/lib";
-
-BEGIN { use_ok("Catalyst::Utils") };
-
-is( Catalyst::Utils::class2prefix('MyApp::V::Foo::Bar'), 'foo/bar', 'class2prefix works with M/V/C' );
-
-is( Catalyst::Utils::class2prefix('MyApp::Controller::Foo::Bar'), 'foo/bar', 'class2prefix works with Model/View/Controller' );
-
-is( Catalyst::Utils::class2prefix('MyApp::Controller::Foo::View::Bar'), 'foo/view/bar', 'class2prefix works with tricky components' );
-
-is( Catalyst::Utils::appprefix('MyApp::Foo'), 'myapp_foo', 'appprefix works' );
-
-is( Catalyst::Utils::class2appclass('MyApp::Foo::Controller::Bar::View::Baz'), 'MyApp::Foo', 'class2appclass works' );
-
-is( Catalyst::Utils::class2classprefix('MyApp::Foo::Controller::Bar::View::Baz'), 'MyApp::Foo::Controller', 'class2classprefix works' );
-
-is( Catalyst::Utils::class2classsuffix('MyApp::Foo::Controller::Bar::View::Baz'), 'Controller::Bar::View::Baz', 'class2classsuffix works' );
-
-is( Catalyst::Utils::class2env('MyApp::Foo'), 'MYAPP_FOO', 'class2env works' );
Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_request.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_request.t 2009-11-20 01:07:04 UTC (rev 11930)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_utils_request.t 2009-11-20 01:09:14 UTC (rev 11931)
@@ -1,27 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 5;
-
-use_ok('Catalyst::Utils');
-
-{
- my $url = "/dump";
- ok(
- my $request = Catalyst::Utils::request($url),
- "Request: simple get without protocol nor host"
- );
- like( $request->uri, qr|^http://localhost/|,
- " has default protocol and host" );
-}
-
-{
- my $url = "/dump?url=http://www.somewhere.com/";
- ok(
- my $request = Catalyst::Utils::request($url),
- "Same with param containing a url"
- );
- like( $request->uri, qr|^http://localhost/|,
- " has default protocol and host" );
-}
-
More information about the Catalyst-commits
mailing list