fix integration tests

This commit is contained in:
Yuri Kuznetsov
2025-07-09 15:21:14 +03:00
parent 4413871dd0
commit 59279344f1
5 changed files with 31 additions and 29 deletions
@@ -29,24 +29,22 @@
namespace tests\integration\Espo\Core\Binding;
use Espo\Core\{
Container\ContainerBuilder,
Binding\BindingLoader,
Binding\BindingData,
Binding\Binding,
};
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\testClasses\Binding\{
SomeInterface,
SomeImplementation,
SomeClass,
SomeService,
SomeClassRequiringService,
SomeClassRequiringValue,
SomeFactory,
};
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 \tests\integration\Core\BaseTestCase
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');
@@ -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;
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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;
}