我已经安装了LiipFunctionalTestBundle,并从昨天开始尝试使用它,但我遇到了一个错误,我不知道如何解决它。
我使用文档(Config_test)中描述的基本配置:
framework:
test: ~
session:
storage_id: session.storage.filesystem
liip_functional_test: ~
doctrine:
dbal:
default_connection: default
connections:
default:
driver: pdo_sqlite
path: %kernel.cache_dir%/test.sql我在包中创建了一个简单的测试文件,只是为了知道是否加载了我的数据库:
class AdControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$this->loadFixtures(array());
$this->assertTrue(true);
}
}当我使用$ this ->loadFixtures(array())时,它工作得很好,所以我可以从一个空的数据库(用我的模式初始化)开始,但当我替换它并尝试使用fixture时,我会得到如下错误:
$this->loadFixtures(array('\Blabla\MyBunble\DataFixtures\ORM\LoadUserData'));
现在我有了这个错误:
Doctrine\DBAL\DBALException: An exception occurred while executing 'PRAGMA table_info(transaction)':
SQLSTATE[HY000]: General error: 1 near "transaction": syntax error我是测试新手,如果有人使用这个包作为提示,我将不胜感激:)
谢谢
发布于 2013-05-02 23:51:55
好吧,这是个愚蠢的错误。
当我清理缓存时,我看到了真正的错误:由于错误的名称空间,loadFixtures无法找到我的fixture。
发布于 2014-01-10 16:50:39
我有同样的错误,它让我抓狂了两个小时,唯一与symfony和测试相关的信息就是这个问题,但我的命名空间和路由是OK的……那么问题出在哪里呢?这很简单..。TRANSACTION是一个SQLite关键字:https://www.sqlite.org/lang_keywords.html,如果我删除了缓存,测试将在哪里工作,但当它检索表信息时,它会因为表名而崩溃。
我希望它的结果对任何其他可能有同样问题的人都有帮助。
https://stackoverflow.com/questions/16336841
复制相似问题