Yii Framework Forum: Error buat Test CRUD - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Error buat Test CRUD minta penjelasan Erronya kenapa Rate Topic: -----

#1 User is offline   Ting tong 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-September 10

Posted 03 February 2011 - 11:01 PM

kang saia lagi coba baca ebook tentang yii dan coba praktekan, nah saat saia buat class di protected\tests\unit
untuk test CRUD
<?php
class ProjectTest extends CDbTestCase{
      public function testCRUD()
      {
	$newproject = new Project;
	$newProjectName = 'Test Project 1'; 
  	$newProject->setAttributes(
    	array('name' => $newProjectName, 
              'description' => 'Test project number one', 
              'create_time' => '2010-01-01 00:00:00',
    	      'create_user_id' => 1, 
              'update_time' => '2010-01-01 00:00:00', 
              'update_user_id' => 1, 
             )
        );
        $this->assertTrue($newProject->save(false)); 	
     }	
}
?>


saat di coba di test di menggunakan PHPunit malah error gini :
Call to a member function setAttributes() on a non-object in protected\tests\unit line 8.
kira" saia kurang apanya ya. soalnya setau saia setAttributes() itukan method bawaan dan kita ga perlu buat. apa masalah includenya yang kurang ya! mohon petunjuknya.
0

#2 User is offline   ibiz4 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 151
  • Joined: 26-November 10
  • Location:Indonesia

Posted 05 February 2011 - 09:45 AM

ya udah satu2 aja diisi attribute nya
WYSIWYG
(What Yii Serve is What You Get)
0

#3 User is offline   nasrul 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 14-April 09
  • Location:Sorowako - Indonesia

Posted 06 February 2011 - 09:42 AM

agan udah set parameter db di protected/config/test.php belum?
0

#4 User is offline   anggoro ari nurcahyo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 23-January 11

Posted 07 February 2011 - 01:56 AM

mas itu mah masalah di case sensitifnya aja. coba lihat variable yang menampung object Project($newproject) nya harus sama dengan yang saar di assertTrue.
0

#5 User is offline   Ting tong 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-September 10

Posted 07 February 2011 - 09:20 PM

View Postanggoro ari nurcahyo, on 07 February 2011 - 01:56 AM, said:

mas itu mah masalah di case sensitifnya aja. coba lihat variable yang menampung object Project($newproject) nya harus sama dengan yang saar di assertTrue.


oia disitu ka... maksie atas sarannya kakak-kakak dah bisa sekarang mah! terima kasih
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users