diff --git a/tests/testBaseClass.php b/tests/testBaseClass.php index fa90f87163..a183bb5eaa 100644 --- a/tests/testBaseClass.php +++ b/tests/testBaseClass.php @@ -47,7 +47,7 @@ function __construct() { $this->testing_skip_bibcode = false; } if (!getenv('PHP_OAUTH_CONSUMER_TOKEN') || !getenv('PHP_OAUTH_CONSUMER_SECRET') || - !getenv('PHP_OAUTH_ACCESS_TOKEN') || !getenv('PHP_OAUTH_ACCESS_SECRET')) { + !getenv('PHP_OAUTH_ACCESS_TOKEN') || !getenv('PHP_OAUTH_ACCESS_SECRET')) { $this->testing_skip_wiki = true; } else { $this->testing_skip_wiki = false; @@ -96,13 +96,13 @@ protected function requires_bibcode(callable $function): void { // Speeds up non-zotero tests protected function requires_zotero(callable $function): void { - try { - usleep(300000); // Reduce failures - Zotero::unblock_zotero(); - $function(); - } finally { - Zotero::block_zotero(); - } + try { + usleep(300000); // Reduce failures + Zotero::unblock_zotero(); + $function(); + } finally { + Zotero::block_zotero(); + } } protected function make_citation(string $text): Template { @@ -179,11 +179,14 @@ protected function reference_to_template(string $text): Template { } protected function flush(): void { - if (ob_get_level() > 0) { - ob_end_flush(); - ob_start(); - } - flush(); + $level = ob_get_level(); + for ($count = 0; $count < $level; $count++) { + ob_end_flush(); + } + flush(); + for ($count = 0; $count < $level; $count++) { + ob_start(); + } } protected function fill_cache(): void { // Name is outdated