1

我正在尝试在typo3基于 PHP 的 CMS 4.7.8 中进行测试驱动开发。使用扩展TestingFramework提供的类phpunit,我在遵循扩展提供的教程文档phpunit时遇到问题(关于TestingFramework类)

在这里,我有这个简单的单元测试

/**
 * @test
 *
 */
public function fake_frontend_can_be_instantiated() {

    $this->testingFramework->createFakeFrontEnd(16); // uid=16
    $expectedResult = 1;
    $actualResult = $this->testingFramework->hasFakeFrontEnd();
    $this->assertEquals ( $expectedResult, $actualResult );
}


Result: 
 fake frontend can be instantiated
! Error in test case fake_frontend_can_be_instantiated
File: .../typo3_src-4.7.8/t3lib/class.t3lib_db.php
Line: 730
mysql_real_escape_string() expects parameter 2 to be resource, integer given

当我createFakeFrontEnd用空参数调用 () 时也会发生同样的情况。当我启用 dbal 扩展(数据库抽象层)时,这是输出:

File: ...typo3-4.7.8/typo3_src-4.7.8/typo3/sysext/dbal/class.ux_t3lib_db.php
Line: 1546
mysql_query() expects parameter 2 to be resource, integer given

我真的很喜欢使用 TestingFramework,因为我有很多前端用户要创建,并且我想在发送通知电子邮件之前测试每个用户的登录凭据。

4

0 回答 0