clear in setUp

This commit is contained in:
Shish 2020-01-29 00:37:31 +00:00
parent 30bf856f98
commit e8a72b0291

View file

@ -39,7 +39,7 @@ abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase
public function setUp(): void
{
global $_tracer;
global $database, $_tracer;
$_tracer->begin($this->getName());
$_tracer->begin("setUp");
$class = str_replace("Test", "", get_class($this));
@ -54,6 +54,12 @@ abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase
// log in as anon
$this->log_out();
$_tracer->begin("tearDown");
foreach ($database->get_col("SELECT id FROM images") as $image_id) {
send_event(new ImageDeletionEvent(Image::by_id($image_id)));
}
$_tracer->end();
$_tracer->end();
$_tracer->begin("test");
}
@ -62,12 +68,6 @@ abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase
{
global $_tracer;
$_tracer->end();
$_tracer->begin("tearDown");
global $database, $_tracer;
foreach ($database->get_col("SELECT id FROM images") as $image_id) {
send_event(new ImageDeletionEvent(Image::by_id($image_id)));
}
$_tracer->end();
$_tracer->end();
$_tracer->clear();
$_tracer->flush("tests/trace.json");