You convert private to protected and then create a test class extend
the model/controller you want to test, letting your extended model
call parent::method and return its value.

HTH,
Nick

On Jun 13, 5:15 pm, euromark <[email protected]> wrote:
> some of my classes are already php5 like
> with private variables and methods
>
> if i would like to test them via simple test cases
> how could i do that. usually you cant just echo the content of the var
> or the return value of this private method (if would throw an error)
>
> private $someVar;
>
> private function foo() { return true; }
>
> test case:
>
> assertTrue($this->Object->someVar === null);
>
> assertTrue($this->Object->foo());
>
> etc
>
> are there some test case methods i am not aware of?
> usually there is a good reason for those vars/methods to be private
> but if you want to test internal functions, it might be very useful to
> be able to test private ones

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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