Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在内存中使用sqlite进行功能测试_Php_Sqlite_Symfony1_Doctrine_Phpunit - Fatal编程技术网

Php 在内存中使用sqlite进行功能测试

Php 在内存中使用sqlite进行功能测试,php,sqlite,symfony1,doctrine,phpunit,Php,Sqlite,Symfony1,Doctrine,Phpunit,我知道已经有一些关于这方面的话题,但我无法得到任何具体的答案 我已经有了内存中的数据库单元测试: Doctrine_Core::createTablesFromModels(sfConfig::get('sf_lib_dir').'/model'); Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/phpunit/fixtures'); 但这不适用于功能测试。 总是说:没有这样的表:user。 但如果使用此步骤运行测试: D

我知道已经有一些关于这方面的话题,但我无法得到任何具体的答案

我已经有了内存中的数据库单元测试:

Doctrine_Core::createTablesFromModels(sfConfig::get('sf_lib_dir').'/model');
Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/phpunit/fixtures');
但这不适用于功能测试。 总是说:
没有这样的表:user。

但如果使用此步骤运行测试:

    Doctrine_Core::createTablesFromModels(sfConfig::get('sf_lib_dir').'/model');
    Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/phpunit/fixtures');
    Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/phpunit/fixtures');
将给出一个异常:“条令\连接\ Sqlite \异常:完整性约束冲突:19列用户名不唯一”,这是有意义的,因为用户名必须是唯一的,并且是将数据加载到内存中Sqlite数据库的证据


我怀疑当浏览器发出请求时,它会在内存中为SQLite数据库创建新连接,而不是使用当前的open by CLI。

您在说什么浏览器?如果是单元测试,就没有浏览器。您应该在单元测试中模拟HTTP请求。@yegor256这是一个使用selenium和firefox的功能测试。在我的单元测试中,这非常有效。你在说什么浏览器?如果是单元测试,就没有浏览器。您应该在单元测试中模拟HTTP请求。@yegor256这是一个使用selenium和firefox的功能测试。在我的单元测试中,这非常有效。