Symfony 4.如何使用另一个文件夹进行单元测试?

时间:2019-01-31 15:20:19

标签: php unit-testing symfony4

我在[项目文件夹] /文件夹中有一些docx文档。对于单元测试,我想使用文件夹[project-folder] / tests / resources中的另一个docx文档。 可能吗?我怎么说$this->rootDir返回[项目文件夹] /测试/资源?还是有其他想法可以解决我的问题?

public function __construct(EngineInterface $templating, KernelInterface $kernel)
{
    $this->templating = $templating;
    $this->rootDir = $kernel->getProjectDir();
}

public function generateDocxDocument($twigTemplate, $data = [], $docxTemplate = self::DEFAULT_DOCX_TEMPLATE)
{
    $tempFileName = sys_get_temp_dir(). '/' . uniqid();
    $tempDocxFileName = $tempFileName . '.docx';

    $filename = $this->rootDir . '/assets/' . $docxTemplate;
}

0 个答案:

没有答案