Skip to content

EspoCRM – Open Source CRM Application

Base Test prepare binding method

Yurii3a0c08294280
diff --git a/tests/integration/Core/BaseTestCase.php b/tests/integration/Core/BaseTestCase.php
index 0e41205c11..458664a511 100644
--- a/tests/integration/Core/BaseTestCase.php
+++ b/tests/integration/Core/BaseTestCase.php
@@ -29,9 +29,11 @@
namespace tests\integration\Core;
+use Closure;
use Espo\Core\Api\RequestWrapper;
use Espo\Core\Api\ResponseWrapper;
use Espo\Core\Application;
+use Espo\Core\Binding\Binder;
use Espo\Core\Binding\BindingProcessor;
use Espo\Core\Container;
use Espo\Core\DataManager;
@@ -425,4 +427,22 @@ abstract class BaseTestCase extends TestCase
$configWriter->setMultiple($params);
$configWriter->save();
}
+
+ /**
+ * @param Closure(Binder): void $callback
+ */
+ protected function prepareBinding(Closure $callback): BindingProcessor
+ {
+ return new class ($callback) implements BindingProcessor {
+ /**
+ * @param Closure(Binder): void $callback
+ */
+ public function __construct(private Closure $callback) {}
+
+ public function process(Binder $binder): void
+ {
+ ($this->callback)($binder);
+ }
+ };
+ }
}