I am also struggling with the test framework and it isn't an easy
path. There isn't plenty of documentation and it is sometimes outdated
or incorrect.

But look at section "4.7.6.2 The testAction method" in the cookbook.

In your case, it isn't displaying anything in debug() because by
default, testAction() is set to 'return' => 'result' so it just
returns the result of the controller's action (which usually doesn't
return anything unless you explicitly make it so).

Look at the parameters that testAction() expects for 'return' and set
it accordingly. But I think the book's documentation is not updated to
the latest version because it states that the parameters are 'vars',
'render' and 'return' while if you are using RC1 and look at the
source code for testAction() in cake_test_case.php, you will see the
the expected parameters are one of 'result', 'view',  'contents' or
'vars'.

So set it to one of the other values to make it return the rendered
view or vars.

- barduck



On Jun 17, 3:33 pm, jaro <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've been reading a lot about test cases but cannot find a how-to
> approach in testing plugins controllers.
>
> Read the tutorial 
> inhttp://book.cakephp.org/view/160/testing#testing-plugins-485
> but that was only for models.
>
> I created the ffg to test my pizza_controller.php. I named it
> pizza_controller.test.php
>
> class PizzaControllerTest extends CakeTestCase {
>    function startCase() {
>      echo '<h1>Starting Test Case</h1>';
>    }
>    function endCase() {
>      echo '<h1>Ending Test Case</h1>';
>    }
>    function startTest($method) {
>      echo '<h3>Starting method ' . $method . '</h3>';
>    }
>    function endTest($method) {
>      echo '<hr />';
>    }
>    function testIndex() {
>      $result = $this->testAction('/shopping_cart/index');
>      debug($result);
>    }
>
> }
>
> Nothing is displayed in the test.php page. What am I missing?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to