Yii Framework Forum: ProjectTest.php error on unit testing - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

ProjectTest.php error on unit testing

#1 User is offline   hnam 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 19-September 10
  • Location:BSP

Posted 05 January 2012 - 01:47 AM

During PHPUnit test on ProjectTest.php i am getting an Error :-

CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`trackstar_test`.`tbl_comment`, CONSTRAINT `FK_comment_issue` FOREIGN KEY (`issue_id`) REFERENCES `tbl_issue` (`id`))

I am using Yii 1.1.8 and PHPunit 3.6.6 test suite. for more check code and screenshot.

Attached File(s)

On revolutions !

#2 User is offline   ragua 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 138
  • Joined: 23-January 12
  • Location:Paris - France

Posted 03 May 2012 - 08:31 AM

It looks like more database issue than yii.
You're trying to delete a record which is related to another table. If you set the "on delete cascade" in your database for the relationship, it should work. But maybe you would prefer not cascading.
I hope it will help you.

Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

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