【问题标题】:Unable make SimpleTest GET and POST in test case, using Drupal6 and SimpleTest使用 Drupal6 和 SimpleTest 无法在测试用例中进行 SimpleTest GET 和 POST
【发布时间】:2013-05-02 10:07:12
【问题描述】:

一段时间后,我运行了这个示例测试,Drupal 批处理屏幕(带有进度条的屏幕)停止运行,我的服务器日志中没有记录任何错误,整个浏览器窗口保持冻结状态。代码很基础:

<?php
class FooTestCase extends DrupalWebTestCase {
  public static function getInfo() {
    return array(
      'name' => 'test',
      'description' => 'test',
      'group' => 'Foo',
    );
  }

  public function setUp() {
    parent::setUp();
  }

  public function testLogin() {
    // The drupalCreateUser() runs fine
    $user = $this->drupalCreateUser(array('access content'));
    // If i comment out the following, test runs fine.
    $this->drupalLogin($user);
  }
}
?>

我错过了什么?

== EDIT1 ==

另一个线索:我通过 drush test-run 运行了测试,它们运行良好。

== EDIT2 ==

这原来是一个curl_setopt_array 错误,它在DrupalWebTestCase::curlInitialize() 期间返回 FALSE。该问题没有进一步进展。

== EDIT3 ==

经过更深入的调试,这被证明是 curl CURLOPT_FOLLOWLOCATION 的一个问题,它会在设置尝试时触发错误。

【问题讨论】:

    标签: php unit-testing curl drupal-6 simpletest


    【解决方案1】:

    如果在您的 php 配置中,CURLOPT_FOLLOWLOCATION 将不起作用,

    • safe_mode = 开启
    • open_basedir 已设置

    因此,更改其中一个或两个应该可以解决问题。有 3 个地方可以实现这一目标。

    php.inisafe_mode = 关闭,并注释掉 open_basedir

    apache .conf.htaccess

    php_value safe_mode Off
    php_value open_basedir none
    

    请注意,您的服务器配置必须允许值覆盖才能在 .htaccess 上工作。

    还要注意 CURLOPT_FOLLOWLOCATION 自 php 5.3 起已被弃用,并在 php 5.4 中被删除。

    【讨论】:

      猜你喜欢
      • 2013-10-30
      • 2012-01-31
      • 1970-01-01
      • 1970-01-01
      • 2011-07-17
      • 2010-12-16
      • 2011-02-20
      • 2012-07-13
      • 1970-01-01
      相关资源
      最近更新 更多