www.un.org/Depts/DGACM/index_spanish.htm 人均<>
我为地址表确定了可使用的行为,但当Im试图进行PHPUnit测试时,一 ve有以下错误:
SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction
我在试验Case上有2种测试方法。 如果我只剩下1人,如果是,如果是,那么它就会起作用;如果是的话,它就会产生这一错误。
该守则是:
class UserTest extends DbTestCase {
protected $object;
protected function setUp()
{
// zf bootstrap here and doctrine connect
parent::setUp();
// clean/create tmp tables
$this->_prepareDB();
$this->object = new User;
iii
public function testGetFullUsername()
{
$model = new User;
$model->email = $email . time();
...
$model->Supplier->Address->firstname = $first_name;
$model->Supplier->Address->lastname = $last_name;
...
$model->UserRight[0]->role = Supplier ;
$model->UserRight[0]->resource = * ;
$model->UserRight[0]->privilege = ;
$model->save();
iii
// it can be even the same
public function testRoles()
{
$model = new User;
$model->email = $email . time();
...
$model->Supplier->Address->firstname = $first_name;
$model->Supplier->Address->lastname = $last_name;
...
$model->UserRight[0]->role = Supplier ;
$model->UserRight[0]->resource = * ;
$model->UserRight[0]->privilege = ;
$model->save();
iii
iii
当PHPunit经营第二种方法交易时,先进行另一种交易:
// 1st method
// thread id: 412
START TRANSACTION
INSERT INTO user (...) VALUES (...)
INSERT INTO address (...) VALUES ( ... )
INSERT INTO address_version (...) VALUES (...)
INSERT INTO supplier (...) VALUES (...)
INSERT INTO user_right (...) VALUES (..)
commit
// 2nd method
// thread id: 413
START TRANSACTION
INSERT INTO user (...) VALUES (...)
INSERT INTO address (..) VALUES (...)
// then new thread created (server disconnects), id: 414
CONNECT xxxxx@localhost on xxxx__tmp_testing
START TRANSACTION
INSERT INTO address_version (...) VALUES (...)
rollback
rollback
它减少了联系,但我不知道为什么。 如果我去掉可变的行为——那么它就会起作用!
Can 请帮助我。 我真心 st不 the,不了解错误原因:
感谢 你们的关注!
<><>UPDATE:
The reason was in "versionable" plugin. We have to disable it in phpunit tests: $account->Distributor->Address->getListener()->setOption( disabled , true); Versionable attached to Address model It fixes the problem.