Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions tests/lib/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,27 @@ protected function isFileLocked($view, $path, $type, $onMountPoint = false) {
}
}

protected function getGroupAnnotations(): array {
if (method_exists($this, 'getAnnotations')) {
$annotations = $this->getAnnotations();
return $annotations['class']['group'] ?? [];
}

$r = new \ReflectionClass($this);
$doc = $r->getDocComment();
preg_match_all('#@group\s+(.*?)\n#s', $doc, $annotations);
return $annotations[1] ?? [];
}

protected function IsDatabaseAccessAllowed() {
// on travis-ci.org we allow database access in any case - otherwise
// this will break all apps right away
if (true == getenv('TRAVIS')) {
return true;
}
$annotations = $this->getAnnotations();
if (isset($annotations['class']['group'])) {
if (in_array('DB', $annotations['class']['group']) || in_array('SLOWDB', $annotations['class']['group'])) {
$annotations = $this->getGroupAnnotations();
if (isset($annotations)) {
if (in_array('DB', $annotations) || in_array('SLOWDB', $annotations)) {
return true;
}
}
Expand Down