Hello,

in some of my models I heavily use Session::read or AuthComponent::user or 
similar methods.

I would like to test these mehtods but i don't kown how to prepare the 
model test. I get the following error:


 PHPUnit_Framework_Error_Notice
> Undefined index: Auth
> Test case: ContactTest(testGetUserContactsByQuery)
> Stack trace:
> /Users/user/Sites/my-site.de/app/Model/Membership.php : 8
> /Users/user/Sites/my-site.de/app/Model/Contact.php : 112
> /Users/user/Sites/my-site.de/app/Test/Case/Model/ContactTest.php : 18
> ContactTest::testGetUserContactsByQuery
> /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Framework/TestCase.php 
> : 942
> /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Framework/TestCase.php 
> : 804
> /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Framework/TestResult.php 
> : 649
> /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Framework/TestCase.php 
> : 751
> /Users/user/Sites/my-site.de/lib/Cake/TestSuite/CakeTestCase.php : 78
> /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Framework/TestSuite.php 
> : 772
> /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/Framework/TestSuite.php 
> : 745
> /Applications/MAMP/bin/php/php5.3.6/lib/php/PHPUnit/TextUI/TestRunner.php 
> : 325
> /Users/user/Sites/my-site.de/lib/Cake/TestSuite/CakeTestRunner.php : 57
> /Users/user/Sites/my-site.de/lib/Cake/TestSuite/CakeTestSuiteCommand.php : 
> 111
> /Users/user/Sites/my-site.de/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php 
> : 242
> /Users/user/Sites/my-site.de/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php 
> : 99
> /Users/user/Sites/my-site.de/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php 
> : 116
> /Users/user/Sites/my-site.de/app/webroot/test.php : 92
>
>
 In my model i use

$user_id = AuthComponent::user('id');
>

Regards,
cronet



-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to