Doesn't anyone want to help me here?

zwobot wrote:
> Hi everyone,
>
> I have cakePHP 1.1.13.4450 and installed the test suite into my app
> folder.
> SimpleTest is installed to app/vendors folder.
>
> I have a test case for my interpret model (see APPENDIX for code)
> which is correctly shown in the App Test Cases I acces with the
> browser (example.org/tests/)
> Everytime I run the test it fails. As far as I can recreate the issue
> the save method of the model does not work it returns null everytime
> (see APPENDIX too).
> Generic SQL queries I run with the model's query() method are executed
> correctly thoguh.
>
> Can anybody give me hint on what is going wrong? Is my code incorrect?
> The interpret model has "hasMany" associations to two other models,
> could that be the problem?
>
>
> APPENDIX:
>
> This is the output of the test case:
>
> CakePHP Test Suite v 1.0.0.0
> Individual test case: models\\interpret.test.php
> Fail: C:\Programme\xampp\htdocs\musikportal_backup\app\tests\app\cases
> \models\\interpret.test.php -> InterpretTest -> test_save -> Equal
> expectation fails as [NULL] does not match [String: Musikgruppe] at [C:
> \Programme\xampp\htdocs\musikportal_backup\app\tests\app\cases\models
> \interpret.test.php line 30]
> Exception: C:\Programme\xampp\htdocs\musikportal_backup\app\tests\app
> \cases\models\\interpret.test.php -> InterpretTest -> test_save ->
> Unexpected PHP error [Undefined property: InterpretTest::$model_data]
> severity [E_NOTICE] in [C:\Programme\xampp\htdocs\musikportal_backup
> \app\tests\app\cases\models\interpret.test.php] line [30]
> Exception: C:\Programme\xampp\htdocs\musikportal_backup\app\tests\app
> \cases\models\\interpret.test.php -> InterpretTest -> test_save ->
> Unexpected PHP error [Undefined property: InterpretTest::$model_data]
> severity [E_NOTICE] in [C:\Programme\xampp\htdocs\musikportal_backup
> \app\tests\app\cases\models\interpret.test.php] line [31]
> 1/1 test cases complete: 1 passes, 1 fails and 2 exceptions.
>
>
> This is the code of the test class:
>
> class InterpretTest extends UnitTestCase
> {
>
>       var $model;
>       var $valid_name = 'Musikgruppe';
>       var $valid_freigegeben = 0;
>
>       function setUp()
>       {
>
>               $this->model =& new Interpret();
>
>       }
>
>
>       function test_save()
>       {
>
>               $this->model->data = array(
>                       'name' => $this->valid_name,
>                       'freigegeben' => $this->valid_freigegeben);
>
>               $this->assertTrue($this->model->save());
>
>               $name = $this->model->getLastInsertId();
>               $model_data = $this->model->find(array('name' => $name));
>
>               $this->assertEqual($this->model_data['Interpret']['name'], 
> $this-
> >valid_name);
>               
> $this->assertEqual($this->model_data['Interpret']['freigegeben'],
> $this->valid_freigegeben);
>
>       }
>
> }
>
>
> Code of interpret model:
>
> class Interpret extends AppModel
> {
>
>       var $name = 'Interpret';
>
>       var $primaryKey = 'name';
>
>       var $validate = array(
>               'freigegeben' => '[0-1] {1}'
>       );
>
>       var $hasMany = array('Track', 'Album');
>
> }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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