【发布时间】:2014-06-25 14:18:28
【问题描述】:
我仍在进行 PHP 单元测试以测试我的 symfony2 控制器。我的测试类是 WebTestCase 的派生类,并且测试正在执行 GET 或 POST 请求,以检查一切是否正常。 我想测试所有底层,但我不想让我的数据库因测试而混乱。我不想使用模型,而是使用内存中的 SQLite db,我可以在其中设置测试场景来检查所有修改。 我发现了很多提示如何使用学说 1.x 做到这一点,但它们不再起作用了。 所以我想要这样的东西:
class BlahblahTest extends WebTestCase {
public function testXXXYYY() {
// 1. Setup a new database with SQLite:memory:
// 2. create the database and all tables according the entities in my project
$this->createTestScenario(); // 3.
$crawler = $this->client->request('GET', '/testpage'); // 4.
// 5. Lots of checks against the database and / or the $crawler data
}
}
有机会得到这份工作吗?
提前致谢 亨内斯
【问题讨论】:
标签: doctrine-orm phpunit webtest dbal