【发布时间】:2017-04-16 17:36:37
【问题描述】:
我无法解决这个测试问题。
我为测试存储库编写了一个测试,它使用内存实现,例如:
class RepositoryTest extends TestCase {
function setUp() {
// set implementation in the container
container()->set(Repository::class, InMemoryRepository::class);
}
function test_it_can_save() {...}
function test_it_can_delete() {...}
function test_it_can_query() {...}
}
然后我为这个存储库添加了另一个实现。假设它是SQLRepository。
我需要针对我的新实现运行完全相同的测试集。
我想为相同的测试设置另一个上下文。
我该怎么做?
【问题讨论】:
标签: php phpunit tdd ioc-container