Drupal 的 SimpleTest 不创建自定义表的副本

发布于 2024-08-04 03:51:31 字数 393 浏览 3 评论 0原文

我正在使用 SimpleTest 模块版本 6.x-2.8 和 Drupal 6.13。我编写了一个自定义模块,并为其编写了一些测试。但是,SimpleTest 似乎没有创建与我的自定义模块关联的表的副本,因为每次尝试在表中插入某些内容或在 SimpleTest 中查询它时,我都会收到一条异常消息。

所有插入查询都会在 SimpleTest 结果页面中生成如下所示的结果: 表 'db_name.simpletest692319new_table' 不存在查询: INSERT INTO simpletest692319new_table(...)

在我的模块的 .install 文件中定义了一个 hook_schema() 。有谁知道 SimpleTest 是否还需要其他任何东西才能识别我的表并创建它的副本?

谢谢。

I am using the SimpleTest module version 6.x-2.8 with Drupal 6.13. I wrote a custom module, for which I wrote some tests. However, SimpleTest doesn't seem to be creating a copy of the table associated with my custom module, because I get an exception message for every time I try to insert something into the table or query it in the SimpleTest.

All insert queries result into something like this in the SimpleTest results page:
Table 'db_name.simpletest692319new_table' doesn't exist query: INSERT INTO simpletest692319new_table(...)

There is a hook_schema() defined in my .install file for the module. Does anyone know if there's anything else that SimpleTest needs in order to recognize my table and create the copy of it?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笑饮青盏花 2024-08-11 03:51:31

问题是你必须扩展 DrupalWebTestCase 并将模块添加到 setup 中

class MyTest extends DrupalWebTestCase {
    function setUp() {
        parent::setUp('mymodule');
    }
}

The problem is you have to extend DrupalWebTestCase and add your module to setUp

class MyTest extends DrupalWebTestCase {
    function setUp() {
        parent::setUp('mymodule');
    }
}
蘑菇王子 2024-08-11 03:51:31

查看 CCK 的 SimpleTest 实现,您似乎需要:

  function setUp() {
    $args = func_get_args();
    $modules = array_merge(array('my', 'list', 'of', 'modules'), $args);
    call_user_func_array(array('parent','setUp'), $modules);
  }

Looking at CCK's implementation of SimpleTest it looks like you need to:

  function setUp() {
    $args = func_get_args();
    $modules = array_merge(array('my', 'list', 'of', 'modules'), $args);
    call_user_func_array(array('parent','setUp'), $modules);
  }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文