snapshot of https://github.com/espocrm/espocrm.git (master, 2026-09-18; blobs > 131072B omitted)
Some checks failed
Test / Test on PHP 8.3 (push) Failing after 5s
Test / Test on PHP 8.4 (push) Failing after 4s
Test / Test on PHP 8.5 (push) Failing after 3s
TypeScript static analysis / TypeScript check (push) Failing after 14s
Test Integration on MySQL / Test on PHP 8.3 (push) Failing after 2s
Test Integration on MySQL / Test on PHP 8.5 (push) Failing after 0s
Test Integration on PostgreSQL / Test on PHP 8.4 fix (push) Failing after 1s
Test Integration on PostgreSQL / Test on PHP 8.4 master (push) Failing after 1s
Some checks failed
Test / Test on PHP 8.3 (push) Failing after 5s
Test / Test on PHP 8.4 (push) Failing after 4s
Test / Test on PHP 8.5 (push) Failing after 3s
TypeScript static analysis / TypeScript check (push) Failing after 14s
Test Integration on MySQL / Test on PHP 8.3 (push) Failing after 2s
Test Integration on MySQL / Test on PHP 8.5 (push) Failing after 0s
Test Integration on PostgreSQL / Test on PHP 8.4 fix (push) Failing after 1s
Test Integration on PostgreSQL / Test on PHP 8.4 master (push) Failing after 1s
This commit is contained in:
56
tests/unit/Espo/Core/Job/DataTest.php
Normal file
56
tests/unit/Espo/Core/Job/DataTest.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace tests\unit\Espo\Core\Job;
|
||||
|
||||
use Espo\Core\Job\Job\Data;
|
||||
|
||||
class DataTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testData1()
|
||||
{
|
||||
$data = Data
|
||||
::create((object) ['test' => '1'])
|
||||
->withTargetId('target-id')
|
||||
->withTargetType('target-type');
|
||||
|
||||
$this->assertEquals('1', $data->get('test'));
|
||||
$this->assertEquals('target-id', $data->getTargetId());
|
||||
$this->assertEquals('target-type', $data->getTargetType());
|
||||
}
|
||||
|
||||
public function testData2()
|
||||
{
|
||||
$data = Data
|
||||
::create(['test' => '1']);
|
||||
|
||||
$this->assertEquals('1', $data->get('test'));
|
||||
$this->assertEquals(null, $data->getTargetId());
|
||||
}
|
||||
}
|
||||
117
tests/unit/Espo/Core/Job/JobSchedulerTest.php
Normal file
117
tests/unit/Espo/Core/Job/JobSchedulerTest.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace tests\unit\Espo\Core\Job;
|
||||
|
||||
use Espo\Core\Field\DateTime as DateTimeField;
|
||||
use Espo\Core\Job\JobScheduler;
|
||||
use Espo\Core\Job\JobScheduler\Creator;
|
||||
use Espo\Core\Job\QueueName;
|
||||
use Espo\Core\Job\Job\Data;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use tests\unit\testClasses\Core\Job\TestJob;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use DateInterval;
|
||||
|
||||
class JobSchedulerTest extends TestCase
|
||||
{
|
||||
private ?JobScheduler\Creator $creator = null;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->creator = $this->createMock(JobScheduler\Creator::class);
|
||||
}
|
||||
|
||||
public function testSchedule1(): void
|
||||
{
|
||||
$scheduler = new JobScheduler($this->creator);
|
||||
|
||||
$time = new DateTimeImmutable();
|
||||
|
||||
$delay = DateInterval::createFromDateString('1 minute');
|
||||
|
||||
$expectedData = new Creator\Data(
|
||||
className: TestJob::class,
|
||||
queue: QueueName::Q0,
|
||||
group: null,
|
||||
data: new Data((object) ['test' => '1']),
|
||||
time: DateTimeField::fromDateTime($time)->addMinutes(1),
|
||||
);
|
||||
|
||||
$this->creator
|
||||
->expects($this->once())
|
||||
->method('create')
|
||||
->with($expectedData);
|
||||
|
||||
$scheduler
|
||||
->setClassName(TestJob::class)
|
||||
->setQueue(QueueName::Q0)
|
||||
->setData([
|
||||
'test' => '1',
|
||||
])
|
||||
->setTime($time)
|
||||
->setDelay($delay)
|
||||
->schedule();
|
||||
}
|
||||
|
||||
public function testSchedule2(): void
|
||||
{
|
||||
$scheduler = new JobScheduler($this->creator);
|
||||
|
||||
$time = new DateTimeImmutable();
|
||||
|
||||
$expectedData = new Creator\Data(
|
||||
className: TestJob::class,
|
||||
queue: null,
|
||||
group: 'g-1',
|
||||
data: (new Data((object) ['test' => '1']))->withTargetType('TestType')->withTargetId('test-id'),
|
||||
time: DateTimeField::fromDateTime($time),
|
||||
);
|
||||
|
||||
$this->creator
|
||||
->expects($this->once())
|
||||
->method('create')
|
||||
->with($expectedData);
|
||||
|
||||
$data = Data
|
||||
::create([
|
||||
'test' => '1',
|
||||
])
|
||||
->withTargetId('test-id')
|
||||
->withTargetType('TestType');
|
||||
|
||||
$scheduler
|
||||
->setClassName(TestJob::class)
|
||||
->setGroup('g-1')
|
||||
->setData($data)
|
||||
->setTime($time)
|
||||
->schedule();
|
||||
}
|
||||
}
|
||||
70
tests/unit/Espo/Core/Job/MetadataProviderTest.php
Normal file
70
tests/unit/Espo/Core/Job/MetadataProviderTest.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace tests\unit\Espo\Core\Job;
|
||||
|
||||
use Espo\Core\{
|
||||
Job\MetadataProvider,
|
||||
Utils\Metadata,
|
||||
};
|
||||
|
||||
class MetadataProviderTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
private $metadata;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->metadata = $this->createMock(Metadata::class);
|
||||
}
|
||||
|
||||
public function testGetPreparableJobNameList()
|
||||
{
|
||||
$this->metadata
|
||||
->method('get')
|
||||
->with(['app', 'scheduledJobs'])
|
||||
->willReturn([
|
||||
'Test1' => [
|
||||
'preparatorClassName' => "Test",
|
||||
],
|
||||
'Test2' => [
|
||||
'preparatorClassName' => "Test",
|
||||
],
|
||||
'Test3' => [],
|
||||
'Test4' => [
|
||||
'preparatorClassName' => null,
|
||||
],
|
||||
]);
|
||||
|
||||
$provider = new MetadataProvider($this->metadata);
|
||||
|
||||
$list = $provider->getPreparableJobNameList();
|
||||
|
||||
$this->assertEquals(['Test1', 'Test2'], $list);
|
||||
}
|
||||
}
|
||||
76
tests/unit/Espo/Core/Job/QueuePortionNumberProviderTest.php
Normal file
76
tests/unit/Espo/Core/Job/QueuePortionNumberProviderTest.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace tests\unit\Espo\Core\Job;
|
||||
|
||||
use Espo\Core\Job\QueueName;
|
||||
use Espo\Core\Job\QueuePortionNumberProvider;
|
||||
use Espo\Core\Utils\Config;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class QueuePortionNumberProviderTest extends TestCase
|
||||
{
|
||||
private $config;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->config = $this->createMock(Config::class);
|
||||
}
|
||||
|
||||
public function testDefault(): void
|
||||
{
|
||||
$provider = new QueuePortionNumberProvider($this->config);
|
||||
|
||||
$this->assertEquals(200, $provider->get(QueueName::Q0));
|
||||
$this->assertEquals(500, $provider->get(QueueName::Q1));
|
||||
$this->assertEquals(100, $provider->get(QueueName::E0));
|
||||
$this->assertEquals(200, $provider->get('TestDefault'));
|
||||
}
|
||||
|
||||
public function testConfig(): void
|
||||
{
|
||||
$this->config
|
||||
->method('get')
|
||||
->willReturnMap(
|
||||
[
|
||||
['jobQ0MaxPortion', null, 201],
|
||||
['jobQ1MaxPortion', null, 501],
|
||||
['jobE0MaxPortion', null, 101],
|
||||
['jobTestDefaultMaxPortion', null, 301]
|
||||
]
|
||||
);
|
||||
|
||||
$provider = new QueuePortionNumberProvider($this->config);
|
||||
|
||||
$this->assertEquals(201, $provider->get(QueueName::Q0));
|
||||
$this->assertEquals(501, $provider->get(QueueName::Q1));
|
||||
$this->assertEquals(101, $provider->get(QueueName::E0));
|
||||
$this->assertEquals(301, $provider->get('TestDefault'));
|
||||
}
|
||||
}
|
||||
255
tests/unit/Espo/Core/Job/QueueProcessor/PickerTest.php
Normal file
255
tests/unit/Espo/Core/Job/QueueProcessor/PickerTest.php
Normal file
@@ -0,0 +1,255 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace tests\unit\Espo\Core\Job\QueueProcessor;
|
||||
|
||||
use Countable;
|
||||
use Espo\Core\Job\QueueProcessor\Params;
|
||||
use Espo\Core\Job\QueueProcessor\Picker;
|
||||
use Espo\Core\Job\QueueUtil;
|
||||
use Espo\Entities\Job;
|
||||
use Espo\ORM\Collection;
|
||||
use Espo\ORM\EntityCollection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class PickerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @param string[] $ids
|
||||
* @return Collection<Job>&Countable
|
||||
*/
|
||||
private function createCollection(array $ids): Collection&Countable
|
||||
{
|
||||
$output = new EntityCollection();
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$job = $this->createMock(Job::class);
|
||||
|
||||
$job->expects($this->any())
|
||||
->method('getId')
|
||||
->willReturn($id);
|
||||
|
||||
$output[] = $job;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $ids
|
||||
* @param iterable<Job> $pick
|
||||
*/
|
||||
private function assertPick(array $ids, iterable $pick): void
|
||||
{
|
||||
$pick = iterator_to_array($pick);
|
||||
|
||||
$this->assertSameSize($ids, $pick);
|
||||
|
||||
foreach ($pick as $i => $job) {
|
||||
$this->assertEquals($ids[$i], $job->getId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float[] $weights
|
||||
* @param string[][] $idsGroups
|
||||
* @param string[] $idsExpected
|
||||
*/
|
||||
private function prepareAndTest(int $limit, array $weights, array $idsGroups, array $idsExpected): void
|
||||
{
|
||||
$util = $this->createMock(QueueUtil::class);
|
||||
|
||||
$params = Params::create()->withLimit($limit);
|
||||
|
||||
$paramList = [];
|
||||
|
||||
foreach ($weights as $i => $weight) {
|
||||
$paramList[] = $params
|
||||
->withWeight($weight)
|
||||
->withQueue('m' . $i);
|
||||
}
|
||||
|
||||
|
||||
$params = $params->withSubQueueParamsList($paramList);
|
||||
|
||||
$picker = new Picker($util);
|
||||
|
||||
$collections = [];
|
||||
|
||||
foreach ($idsGroups as $ids) {
|
||||
$collections[] = $this->createCollection($ids);
|
||||
}
|
||||
|
||||
$util->expects($this->any())
|
||||
->method('getPendingJobs')
|
||||
->willReturnOnConsecutiveCalls(...$collections);
|
||||
|
||||
$pick = $picker->pick($params);
|
||||
|
||||
$this->assertPick($idsExpected, $pick);
|
||||
}
|
||||
|
||||
public function testPick0(): void
|
||||
{
|
||||
$this->prepareAndTest(
|
||||
limit: 10,
|
||||
weights: [1.0],
|
||||
idsGroups: [
|
||||
['a0', 'a1', 'a2', 'a3', 'a4', 'a5'],
|
||||
],
|
||||
idsExpected:
|
||||
['a0', 'a1', 'a2', 'a3', 'a4', 'a5'],
|
||||
);
|
||||
}
|
||||
|
||||
public function testPick1(): void
|
||||
{
|
||||
$this->prepareAndTest(
|
||||
limit: 10,
|
||||
weights: [0.5, 0.5],
|
||||
idsGroups: [
|
||||
['a0', 'a1', 'a2', 'a3', 'a4', 'a5'],
|
||||
['b0', 'b1', 'b2', 'b3', 'b4', 'b5'],
|
||||
],
|
||||
idsExpected: array_merge(
|
||||
['a0', 'a1', 'a2', 'a3', 'a4'],
|
||||
['b0', 'b1', 'b2', 'b3', 'b4'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function testPick2(): void
|
||||
{
|
||||
$this->prepareAndTest(
|
||||
limit: 10,
|
||||
weights: [0.5, 0.5],
|
||||
idsGroups: [
|
||||
['a0', 'a1', 'a2'],
|
||||
['b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7'],
|
||||
],
|
||||
idsExpected: array_merge(
|
||||
['a0', 'a1', 'a2'],
|
||||
['b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function testPick3(): void
|
||||
{
|
||||
$this->prepareAndTest(
|
||||
limit: 10,
|
||||
weights: [0.5, 0.5],
|
||||
idsGroups: [
|
||||
['a0', 'a1', 'a2', 'a4', 'a5', 'a6', 'a7'],
|
||||
['b0', 'b1', 'b2'],
|
||||
],
|
||||
idsExpected:
|
||||
['a0', 'a1', 'a2', 'a4', 'a5', 'b0', 'b1', 'b2', 'a6', 'a7'],
|
||||
);
|
||||
}
|
||||
|
||||
public function testPick4(): void
|
||||
{
|
||||
$this->prepareAndTest(
|
||||
limit: 10,
|
||||
weights: [0.5, 0.5],
|
||||
idsGroups: [
|
||||
['a0', 'a1', 'a2'],
|
||||
['b0', 'b1', 'b2'],
|
||||
],
|
||||
idsExpected:
|
||||
['a0', 'a1', 'a2', 'b0', 'b1', 'b2'],
|
||||
);
|
||||
}
|
||||
|
||||
public function testPick5(): void
|
||||
{
|
||||
$this->prepareAndTest(
|
||||
limit: 15,
|
||||
weights: [0.5, 0.5],
|
||||
idsGroups: [
|
||||
['a0', 'a1', 'a2'],
|
||||
['b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'b10', 'b11', 'b12'],
|
||||
],
|
||||
idsExpected: array_merge(
|
||||
['a0', 'a1', 'a2'],
|
||||
['b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'b10', 'b11'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function testPick6(): void
|
||||
{
|
||||
$this->prepareAndTest(
|
||||
limit: 10,
|
||||
weights: [0.5, 0.5],
|
||||
idsGroups: [
|
||||
[],
|
||||
['b0', 'b1', 'b2'],
|
||||
],
|
||||
idsExpected:
|
||||
[ 'b0', 'b1', 'b2'],
|
||||
);
|
||||
}
|
||||
|
||||
public function testPick7(): void
|
||||
{
|
||||
$this->prepareAndTest(
|
||||
limit: 10,
|
||||
weights: [0.5, 0.5],
|
||||
idsGroups: [
|
||||
['a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6'],
|
||||
['b0', 'b1', 'b2', 'b3', 'b4', 'b5'],
|
||||
],
|
||||
idsExpected: array_merge(
|
||||
['a0', 'a1', 'a2', 'a3', 'a4'],
|
||||
['b0', 'b1', 'b2', 'b3', 'b4'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function testPick8(): void
|
||||
{
|
||||
$this->prepareAndTest(
|
||||
limit: 10,
|
||||
weights: [0.5, 0.3, 0.2],
|
||||
idsGroups: [
|
||||
['a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6'],
|
||||
['b0', 'b1', 'b2', 'b3', 'b4', 'b5'],
|
||||
['c0', 'c1', 'c2', 'c3', 'c4', 'c5'],
|
||||
],
|
||||
idsExpected: array_merge(
|
||||
['a0', 'a1', 'a2', 'a3', 'a4'],
|
||||
['b0', 'b1', 'b2'],
|
||||
['c0', 'c1'],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
62
tests/unit/Espo/Core/Job/QueueProcessorParamsTest.php
Normal file
62
tests/unit/Espo/Core/Job/QueueProcessorParamsTest.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM – Open Source CRM application.
|
||||
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||
* Website: https://www.espocrm.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace tests\unit\Espo\Core\Job;
|
||||
|
||||
use Espo\Core\Job\QueueProcessor\Params;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class QueueProcessorParamsTest extends TestCase
|
||||
{
|
||||
protected function setUp() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function testParams1()
|
||||
{
|
||||
$params = Params
|
||||
::create()
|
||||
->withLimit(10);
|
||||
|
||||
$this->assertEquals(10, $params->getLimit());
|
||||
$this->assertNull($params->getQueue());
|
||||
}
|
||||
|
||||
public function testParams2()
|
||||
{
|
||||
$params = Params
|
||||
::create()
|
||||
->withLimit(10)
|
||||
->withGroup('group-0')
|
||||
->withQueue('q0');
|
||||
|
||||
$this->assertEquals('q0', $params->getQueue());
|
||||
$this->assertEquals('group-0', $params->getGroup());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user