English 中文(简体)
PHPUnit + Doctrine + FCCC
原标题:PHPUnit + Doctrine + Versionable + ZF bug

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.

问题回答

我在很多地区都存在同样的问题。

我可以着手解决该问题,先把持续存在的连接点放到别处。

// {{{ getConnection()
/**
 * gets database connection
 */
protected function getConnection() {
    $pdo = new pdo("mysql:dbname=depage_phpunit;host=localhost", "root", "", array(
        PDO::ATTR_PERSISTENT => true,
    ));

    return $this->createDefaultDBConnection($pdo,  testdb );
}
// }}}




相关问题
Zend 邮件问题,涉及外国char子+ com子

泽斯德邮局在名称被定为具有外国性质(如“保”)和 com(”)的物品时,就放弃了一种例外(因为邮局(邮局)退回假)。 重新提出以下守则。

PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

Tagging with Zend Framework

I m trying to create the same solutions as below, but using a simple MySQL query (instead of the static version used below where the words/tags are implemented in the code). The name of the MySQL ...

dynamicaly adding textboxes to zend_form

I hope that this is a quick question to answer. I am developing a form using Zend_Form, I have a number of Zend_Dojo_Form_Element_Textboxs to add to this form dynamically. These are added from rows ...

热门标签