Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.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
Phpunit 如何删除Silverstripe';s SapphireTest类在使用夹具文件运行测试时创建_Phpunit_Silverstripe - Fatal编程技术网

Phpunit 如何删除Silverstripe';s SapphireTest类在使用夹具文件运行测试时创建

Phpunit 如何删除Silverstripe';s SapphireTest类在使用夹具文件运行测试时创建,phpunit,silverstripe,Phpunit,Silverstripe,我想知道如何在通过YAML装置运行Sapphire测试后删除临时数据库。也许在teardown函数中有一些代码可以删除TMPDB 仅供参考,即使我的所有测试都通过,tmp DB仍然落后。我知道在其他phpunit框架中,运行测试时出现错误可能会导致进程中止,从而留下tmp数据库。根据您的SilverStripe版本,对于3.x版,您可以运行yourdomain/dev/build/cleanupdb。对于版本4,它是yourdomain/dev/tasks/CleanupTestDatabase

我想知道如何在通过YAML装置运行Sapphire测试后删除临时数据库。也许在teardown函数中有一些代码可以删除TMPDB


仅供参考,即使我的所有测试都通过,tmp DB仍然落后。我知道在其他phpunit框架中,运行测试时出现错误可能会导致进程中止,从而留下tmp数据库。

根据您的SilverStripe版本,对于3.x版,您可以运行
yourdomain/dev/build/cleanupdb
。对于版本4,它是
yourdomain/dev/tasks/CleanupTestDatabasesTask

我知道这并不能直接回答问题,但是如果您正在运行单元测试,那么在内存中使用SQLITE可能会更好。这明显加快了运行速度(对我来说快了10倍),并且在运行之后会清理内存。我只能在SS3中找到这方面的文档: