aboutsummaryrefslogtreecommitdiffstats
path: root/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php')
-rw-r--r--apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php b/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php
index 9854cd3e609..6afa2539f10 100644
--- a/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php
+++ b/apps/testing/lib/TaskProcessing/FakeTextToTextProvider.php
@@ -9,7 +9,9 @@ declare(strict_types=1);
namespace OCA\Testing\TaskProcessing;
use OCA\Testing\AppInfo\Application;
+use OCP\AppFramework\Services\IAppConfig;
use OCP\TaskProcessing\EShapeType;
+use OCP\TaskProcessing\Exception\ProcessingException;
use OCP\TaskProcessing\ISynchronousProvider;
use OCP\TaskProcessing\ShapeDescriptor;
use OCP\TaskProcessing\ShapeEnumValue;
@@ -18,7 +20,9 @@ use RuntimeException;
class FakeTextToTextProvider implements ISynchronousProvider {
- public function __construct() {
+ public function __construct(
+ protected IAppConfig $appConfig,
+ ) {
}
public function getId(): string {
@@ -90,6 +94,10 @@ class FakeTextToTextProvider implements ISynchronousProvider {
}
public function process(?string $userId, array $input, callable $reportProgress): array {
+ if ($this->appConfig->getAppValueBool('fail-' . $this->getId())) {
+ throw new ProcessingException('Failing as set by AppConfig');
+ }
+
if (isset($input['model']) && is_string($input['model'])) {
$model = $input['model'];
} else {