X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FTesting.pod;h=35a46953af63bd65e7004fb0ffa7baeb3788b493;hb=feb4555a077523ed0583fa59e9f4ff843d5ae026;hp=3ce55ffb1c5d30f0e82080600150ac6c9b406c6c;hpb=191dee29949dbcb6c296feb845dc08e22eac2949;p=catagits%2FCatalyst-Manual.git diff --git a/lib/Catalyst/Manual/Tutorial/Testing.pod b/lib/Catalyst/Manual/Tutorial/Testing.pod index 3ce55ff..35a4695 100644 --- a/lib/Catalyst/Manual/Tutorial/Testing.pod +++ b/lib/Catalyst/Manual/Tutorial/Testing.pod @@ -67,11 +67,6 @@ You can checkout the source code for this example from the catalyst subversion repository as per the instructions in L. -B Some of the tests in this section currently fail under -Ubuntu 8.10 and Catalyst v5.7014. We are looking for a fix. They -do work under Ubuntu 8.04 and Catalyst v5.7011. - - =head1 RUNNING THE "CANNED" CATALYST TESTS @@ -82,10 +77,10 @@ directory, enter: $ prove --lib lib t -There will be a lot of output because we have the C<-Debug> flag enabled -in C (see the C tip below for a quick -and easy way to reduce the clutter). Look for lines like this for -errors: +There will be a lot of output because we have the C<-Debug> flag +enabled in C (see the C tip below for +a quick and easy way to reduce the clutter). Look for lines like this +for errors: # Failed test 'Request should succeed' # in t/controller_Books.t at line 8. @@ -103,11 +98,13 @@ to: ok( request('/login')->is_success, 'Request should succeed' ); -2) Change the Cis_success> to -Cis_redirect> in C. +2) Change the "Cis_success>" to +"Cis_redirect>" in C. + +3) Change the "Cis_success>" to +"Cis_redirect>" in C. -3) Change the Cis_success> to -Cis_redirect> in C. +4) Add "C" to the top of C. As you can see in the C command line above, the C<--lib> option is used to set the location of the Catalyst C directory. With this @@ -119,6 +116,19 @@ environment variable. For example: $ CATALYST_DEBUG=0 prove --lib lib t +B Depending on the versions of various modules you have +installed, you might get some C warnings -- you can +ignore these. If you are following along in Ubuntu 8.10, you can +prevent them by adding C above line 49 in +C to match the following: + + ... + { no strict qw( refs ); + no warnings; + $argnames = \@{"$class\::BASEARGS"} || [ ]; + } + ... + During the C and C tests, you might notice the C warning message. To execute the Pod-related tests, add C to the C @@ -215,7 +225,7 @@ editor and enter the following: "Check we ARE logged in" ) for $ua1, $ua2; # 'Click' the 'Logout' link (see also 'text_regex' and 'url_regex' options) - $_->follow_link_ok({n => 1}, "Logout via first link on page") for $ua1, $ua2; + $_->follow_link_ok({n => 4}, "Logout via first link on page") for $ua1, $ua2; $_->title_is("Login", "Check for login title") for $ua1, $ua2; $_->content_contains("You need to log in to use this application", "Check we are NOT logged in") for $ua1, $ua2; @@ -232,7 +242,7 @@ editor and enter the following: $_->content_contains("Book List", "Check for book list title") for $ua1, $ua2; # Make sure the appropriate logout buttons are displayed - $_->content_contains("/logout\">Logout", + $_->content_contains("/logout\">User Logout", "Both users should have a 'User Logout'") for $ua1, $ua2; $ua1->content_contains("/books/form_create\">Create", "Only 'test01' should have a create link"); @@ -324,6 +334,12 @@ failed test: This will cause the full HTML returned by the request to be displayed. +Another approach to see the full HTML content at the failure point in +a series of tests would be to insert a "C<$DB::single=1;> right above +the location of the failure and run the test under the perl debugger +(with C<-d>) as shown above. Then you can use the debugger to explore +the state of the application right before or after the failure. + =head1 SUPPORTING BOTH PRODUCTION AND TEST DATABASES