Skip to content

EspoCRM – Open Source CRM Application

fix integration tests

Yuri Kuznetsov59279344f1f8
diff --git a/tests/integration/Espo/Core/Binding/BindingTest.php b/tests/integration/Espo/Core/Binding/BindingTest.php
index 02c85b7226..f49d71a448 100644
--- a/tests/integration/Espo/Core/Binding/BindingTest.php
+++ b/tests/integration/Espo/Core/Binding/BindingTest.php
@@ -29,24 +29,22 @@
namespace tests\integration\Espo\Core\Binding;
-use Espo\Core\{
- Container\ContainerBuilder,
- Binding\BindingLoader,
- Binding\BindingData,
- Binding\Binding,
-};
-
-use tests\integration\testClasses\Binding\{
- SomeInterface,
- SomeImplementation,
- SomeClass,
- SomeService,
- SomeClassRequiringService,
- SomeClassRequiringValue,
- SomeFactory,
-};
-
-class BindingTest extends \tests\integration\Core\BaseTestCase
+use Espo\Core\Application\ApplicationParams;
+use Espo\Core\Binding\Binding;
+use Espo\Core\Binding\BindingData;
+use Espo\Core\Binding\BindingLoader;
+use Espo\Core\Container\ContainerBuilder;
+
+use tests\integration\Core\BaseTestCase;
+use tests\integration\testClasses\Binding\SomeClass;
+use tests\integration\testClasses\Binding\SomeClassRequiringService;
+use tests\integration\testClasses\Binding\SomeClassRequiringValue;
+use tests\integration\testClasses\Binding\SomeFactory;
+use tests\integration\testClasses\Binding\SomeImplementation;
+use tests\integration\testClasses\Binding\SomeInterface;
+use tests\integration\testClasses\Binding\SomeService;
+
+class BindingTest extends BaseTestCase
{
public function testImplementation(): void
{
@@ -69,6 +67,7 @@ class BindingTest extends \tests\integration\Core\BaseTestCase
$container = (new ContainerBuilder())
->withBindingLoader($bindingLoader)
+ ->withParams(new ApplicationParams(noErrorHandler: true))
->build();
$injectableFactory = $container->get('injectableFactory');
@@ -104,6 +103,7 @@ class BindingTest extends \tests\integration\Core\BaseTestCase
$container = (new ContainerBuilder())
->withBindingLoader($bindingLoader)
+ ->withParams(new ApplicationParams(noErrorHandler: true))
->build();
$injectableFactory = $container->get('injectableFactory');
@@ -141,6 +141,7 @@ class BindingTest extends \tests\integration\Core\BaseTestCase
$container = (new ContainerBuilder())
->withBindingLoader($bindingLoader)
+ ->withParams(new ApplicationParams(noErrorHandler: true))
->build();
$injectableFactory = $container->get('injectableFactory');
@@ -179,6 +180,7 @@ class BindingTest extends \tests\integration\Core\BaseTestCase
'someService' => $someService,
])
->withBindingLoader($bindingLoader)
+ ->withParams(new ApplicationParams(noErrorHandler: true))
->build();
$injectableFactory = $container->get('injectableFactory');
@@ -213,6 +215,7 @@ class BindingTest extends \tests\integration\Core\BaseTestCase
$container = (new ContainerBuilder())
->withBindingLoader($bindingLoader)
+ ->withParams(new ApplicationParams(noErrorHandler: true))
->build();
$injectableFactory = $container->get('injectableFactory');
diff --git a/tests/integration/Espo/Core/Select/LegacyTest.php b/tests/integration/Espo/Core/Select/LegacyTest.php
index ac8021302a..25cc965fb2 100644
--- a/tests/integration/Espo/Core/Select/LegacyTest.php
+++ b/tests/integration/Espo/Core/Select/LegacyTest.php
@@ -29,19 +29,18 @@
namespace tests\integration\Espo\Core\Select;
-use Espo\Core\{
- Application,
- Container,
- Select\SelectManagerFactory,
-};
+use Espo\Core\Application;
+use Espo\Core\Select\SelectManagerFactory;
+use tests\integration\Core\BaseTestCase;
-class LegacyTest extends \tests\integration\Core\BaseTestCase
+class LegacyTest extends BaseTestCase
{
/**
* @var SelectManagerFactory
*/
private $selectManagerFactory;
+
protected function setUp(): void
{
parent::setUp();
@@ -67,7 +66,7 @@ class LegacyTest extends \tests\integration\Core\BaseTestCase
$this->selectManagerFactory = $injectableFactory->create(SelectManagerFactory::class);
- $this->user = $app->getContainer()->get('user');
+ $app->getContainer()->get('user');
return $app;
}
diff --git a/tests/integration/Espo/Tools/App/LanguageTest.php b/tests/integration/Espo/Tools/App/LanguageTest.php
index f04f825e04..7a8c965d02 100644
--- a/tests/integration/Espo/Tools/App/LanguageTest.php
+++ b/tests/integration/Espo/Tools/App/LanguageTest.php
@@ -57,6 +57,6 @@ class LanguageTest extends BaseTestCase
$data = json_decode(json_encode($data));
$this->assertNotNull($data?->Lead?->options?->source);
- $this->assertNull($data?->Lead?->options?->status);
+ $this->assertNull($data?->Lead?->options?->status ?? null);
}
}
diff --git a/tests/integration/Espo/Tools/App/MetadataTest.php b/tests/integration/Espo/Tools/App/MetadataTest.php
index 06d17276cd..bd4bc36ec9 100644
--- a/tests/integration/Espo/Tools/App/MetadataTest.php
+++ b/tests/integration/Espo/Tools/App/MetadataTest.php
@@ -55,6 +55,6 @@ class MetadataTest extends BaseTestCase
$data = $this->getInjectableFactory()->create(MetadataService::class)->getDataForFrontend();
$this->assertIsArray($data?->entityDefs?->Lead?->fields?->source?->options);
- $this->assertNull($data->entityDefs->Lead->fields?->name);
+ $this->assertNull($data->entityDefs->Lead->fields?->name ?? null);
}
}
diff --git a/tests/integration/Espo/Webhook/ProcessingTest.php b/tests/integration/Espo/Webhook/ProcessingTest.php
index be48368777..5471e8e105 100644
--- a/tests/integration/Espo/Webhook/ProcessingTest.php
+++ b/tests/integration/Espo/Webhook/ProcessingTest.php
@@ -134,7 +134,7 @@ class ProcessingTest extends BaseTestCase
->expects($invokedCount)
->method('send')
->willReturnCallback(function (Webhook $webhook, $dataList) use ($invokedCount, $dataList1, $dataList2, &$notSame) {
- if ($invokedCount->getInvocationCount() === 1) {
+ if ($invokedCount->numberOfInvocations() === 1) {
if (count($dataList) !== count($dataList1)) {
$notSame = true;
}
@@ -146,7 +146,7 @@ class ProcessingTest extends BaseTestCase
return 200;
}
- if ($invokedCount->getInvocationCount() === 2) {
+ if ($invokedCount->numberOfInvocations() === 2) {
if (count($dataList) !== count($dataList2)) {
$notSame = true;
}
@@ -237,7 +237,7 @@ class ProcessingTest extends BaseTestCase
->expects($invokedCount)
->method('send')
->willReturnCallback(function (Webhook $webhook, $dataList) use ($invokedCount, $dataList1, &$notSame) {
- if ($invokedCount->getInvocationCount() === 1) {
+ if ($invokedCount->numberOfInvocations() === 1) {
if ('Account.delete' !== $webhook->getEvent()) {
$notSame = true;
}
@@ -324,7 +324,7 @@ class ProcessingTest extends BaseTestCase
->expects($invokedCount)
->method('send')
->willReturnCallback(function (Webhook $webhook, $dataList) use ($invokedCount, $dataList1, &$notSame) {
- if ($invokedCount->getInvocationCount() === 1) {
+ if ($invokedCount->numberOfInvocations() === 1) {
if (json_encode($dataList) !== json_encode($dataList1)) {
$notSame = true;
}