fix tests

This commit is contained in:
Yuri Kuznetsov
2024-11-10 16:36:40 +02:00
parent 3702df731f
commit 48f46ac1ee
15 changed files with 237 additions and 243 deletions
@@ -29,29 +29,29 @@
namespace tests\integration\Espo\Core\Field;
use Espo\Core\Field\{
Currency,
Date,
DateTime,
DateTimeOptional,
Address,
EmailAddress,
EmailAddressGroup,
PhoneNumber,
PhoneNumberGroup,
Link,
LinkParent,
LinkMultiple,
LinkMultipleItem,
};
use Espo\Core\Field\Address;
use Espo\Core\Field\Currency;
use Espo\Core\Field\Date;
use Espo\Core\Field\DateTime;
use Espo\Core\Field\DateTimeOptional;
use Espo\Core\Field\EmailAddress;
use Espo\Core\Field\EmailAddressGroup;
use Espo\Core\Field\Link;
use Espo\Core\Field\LinkMultiple;
use Espo\Core\Field\LinkMultipleItem;
use Espo\Core\Field\LinkParent;
use Espo\Core\Field\PhoneNumber;
use Espo\Core\Field\PhoneNumberGroup;
use Espo\ORM\EntityManager;
use tests\integration\Core\BaseTestCase;
class ValueObjectTest extends \tests\integration\Core\BaseTestCase
class ValueObjectTest extends BaseTestCase
{
public function testAddress()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$entity = $entityManager->getEntity('Account');
$entity = $entityManager->getNewEntity('Account');
$address = Address
::create()
@@ -62,7 +62,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($entity);
$entity = $entityManager->getEntity('Account', $entity->getId());
$entity = $entityManager->getEntityById('Account', $entity->getId());
$address = $entity->getBillingAddress();
@@ -81,9 +81,9 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
public function testCurrency()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$opportunity = $entityManager->getEntity('Opportunity');
$opportunity = $entityManager->getNewEntity('Opportunity');
$opportunity->set('name', 'opp-1');
@@ -91,7 +91,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($opportunity);
$opportunity = $entityManager->getEntity('Opportunity', $opportunity->getId());
$opportunity = $entityManager->getEntityById('Opportunity', $opportunity->getId());
$currency = $opportunity->getAmount();
@@ -103,9 +103,9 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
public function testDate()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$opportunity = $entityManager->getEntity('Opportunity');
$opportunity = $entityManager->getNewEntity('Opportunity');
$opportunity->set('name', 'opp-1');
@@ -113,7 +113,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($opportunity);
$opportunity = $entityManager->getEntity('Opportunity', $opportunity->getId());
$opportunity = $entityManager->getEntityById('Opportunity', $opportunity->getId());
$closeDate = $opportunity->getCloseDate();
@@ -125,7 +125,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($opportunity);
$opportunity = $entityManager->getEntity('Opportunity', $opportunity->getId());
$opportunity = $entityManager->getEntityById('Opportunity', $opportunity->getId());
$closeDate = $opportunity->getValueObject('closeDate');
@@ -134,9 +134,9 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
public function testDateTime()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$call = $entityManager->getEntity('Call');
$call = $entityManager->getNewEntity('Call');
$call->set('name', 'call-1');
@@ -144,7 +144,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($call);
$call = $entityManager->getEntity('Call', $call->getId());
$call = $entityManager->getEntityById('Call', $call->getId());
$dateStart = $call->getValueObject('dateStart');
@@ -156,7 +156,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($call);
$call = $entityManager->getEntity('Call', $call->getId());
$call = $entityManager->getEntityById('Call', $call->getId());
$dateStart = $call->getValueObject('dateStart');
@@ -165,9 +165,9 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
public function testDateTimeOptional()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$meeting = $entityManager->getEntity('Meeting');
$meeting = $entityManager->getNewEntity('Meeting');
$meeting->set('name', 'meeting-1');
@@ -175,7 +175,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($meeting);
$meeting = $entityManager->getEntity('Meeting', $meeting->getId());
$meeting = $entityManager->getEntityById('Meeting', $meeting->getId());
$dateStart = $meeting->getDateStart();
@@ -187,7 +187,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($meeting);
$meeting = $entityManager->getEntity('Meeting', $meeting->getId());
$meeting = $entityManager->getEntityById('Meeting', $meeting->getId());
$dateStart = $meeting->getValueObject('dateStart');
@@ -197,7 +197,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($meeting);
$meeting = $entityManager->getEntity('Meeting', $meeting->getId());
$meeting = $entityManager->getEntityById('Meeting', $meeting->getId());
$dateStart = $meeting->getValueObject('dateStart');
@@ -208,9 +208,9 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
public function testEmailAddress()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$entity = $entityManager->getEntity('Account');
$entity = $entityManager->getNewEntity('Account');
$group = EmailAddressGroup::create([
EmailAddress::create('one@test.com'),
@@ -222,7 +222,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($entity);
$entity = $entityManager->getEntity('Account', $entity->getId());
$entity = $entityManager->getEntityById('Account', $entity->getId());
$group = $entity->getEmailAddressGroup();
@@ -235,9 +235,9 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
public function testPhoneNumber()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$entity = $entityManager->getEntity('Account');
$entity = $entityManager->getNewEntity('Account');
$group = PhoneNumberGroup::create([
PhoneNumber::create('1')->withType('Office'),
@@ -249,7 +249,7 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($entity);
$entity = $entityManager->getEntity('Account', $entity->getId());
$entity = $entityManager->getEntityById('Account', $entity->getId());
$group = $entity->getPhoneNumberGroup();
@@ -263,9 +263,9 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
public function testLink()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$entity = $entityManager->getEntity('Account');
$entity = $entityManager->getNewEntity('Account');
$entity->setValueObject('assignedUser', Link::create('1'));
@@ -280,9 +280,9 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
public function testLinkParent()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$entity = $entityManager->getEntity('Task');
$entity = $entityManager->getNewEntity('Task');
$entity->setValueObject('parent', LinkParent::create('Account', 'test-id'));
@@ -296,66 +296,62 @@ class ValueObjectTest extends \tests\integration\Core\BaseTestCase
$this->assertNull($entity->getValueObject('parent'));
}
public function testLinkMultiple1()
public function testLinkMultiple1(): void
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$c1 = $entityManager->createEntity('Contact', []);
$c2 = $entityManager->createEntity('Contact', []);
$entity = $entityManager->getEntity('Opportunity');
$entity = $entityManager->getNewEntity('Opportunity');
$link = LinkMultiple::create([
LinkMultipleItem::create($c1->id)->withColumnValue('role', 'Decision Maker'),
LinkMultipleItem::create($c2->id),
LinkMultipleItem::create($c1->getId())->withColumnValue('role', 'Decision Maker'),
LinkMultipleItem::create($c2->getId()),
]);
$entity->setValueObject('contacts', $link);
$entityManager->saveEntity($entity);
$entity = $entityManager->getEntity('Opportunity', $entity->id);
$entity = $entityManager->getEntityById('Opportunity', $entity->getId());
/**
* @var LinkMultiple
*/
/** @var LinkMultiple */
$link = $entity->getValueObject('contacts');
$this->assertEquals(2, $link->getCount());
$this->assertEquals('Decision Maker', $link->getById($c1->id)->getColumnValue('role'));
$this->assertEquals(null, $link->getById($c2->id)->getColumnValue('role'));
$this->assertEquals('Decision Maker', $link->getById($c1->getId())->getColumnValue('role'));
$this->assertEquals(null, $link->getById($c2->getId())->getColumnValue('role'));
}
public function testLinkMultiple2()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$c1 = $entityManager->createEntity('Contact', []);
$c2 = $entityManager->createEntity('Contact', []);
$entity = $entityManager->getEntity('Opportunity');
$entity = $entityManager->getNewEntity('Opportunity');
$link = LinkMultiple::create([
LinkMultipleItem::create($c1->id)->withColumnValue('role', 'Decision Maker'),
LinkMultipleItem::create($c2->id),
LinkMultipleItem::create($c1->getId())->withColumnValue('role', 'Decision Maker'),
LinkMultipleItem::create($c2->getId()),
]);
$entity->setValueObject('contacts', $link);
$entityManager->saveEntity($entity);
$entity = $entityManager->getEntity('Opportunity', $entity->id);
$entity = $entityManager->getEntityById('Opportunity', $entity->getId());
$entity->loadLinkMultipleField('contacts');
/**
* @var LinkMultiple
*/
/** @var LinkMultiple */
$link = $entity->getValueObject('contacts');
$this->assertEquals(2, $link->getCount());
$this->assertEquals('Decision Maker', $link->getById($c1->id)->getColumnValue('role'));
$this->assertEquals('Decision Maker', $link->getById($c1->getId())->getColumnValue('role'));
}
}
@@ -45,17 +45,17 @@ class FormulaTest extends BaseTestCase
{
public function testCountRelatedAndSumRelated()
{
$entityManager = $this->getContainer()->get('entityManager');
$entityManager = $this->getContainer()->getByClass(EntityManager::class);
$account = $entityManager->getEntity('Account');
$account = $entityManager->getNewEntity('Account');
$account->set('name', 'test');
$entityManager->saveEntity($account);
$contact = $entityManager->getEntity('Contact');
$contact = $entityManager->getNewEntity('Contact');
$contact->set('name', 'test');
$entityManager->saveEntity($contact);
$opportunity = $entityManager->getEntity('Opportunity');
$opportunity = $entityManager->getNewEntity('Opportunity');
$opportunity->set([
'name' => '1',
'amount' => 10,
@@ -64,7 +64,7 @@ class FormulaTest extends BaseTestCase
]);
$entityManager->saveEntity($opportunity);
$opportunity = $entityManager->getEntity('Opportunity');
$opportunity = $entityManager->getNewEntity('Opportunity');
$opportunity->set([
'name' => '2',
'amount' => 20,
@@ -73,7 +73,7 @@ class FormulaTest extends BaseTestCase
]);
$entityManager->saveEntity($opportunity);
$opportunity = $entityManager->getEntity('Opportunity');
$opportunity = $entityManager->getNewEntity('Opportunity');
$opportunity->set([
'name' => '3',
'amount' => 40,
@@ -81,9 +81,10 @@ class FormulaTest extends BaseTestCase
]);
$entityManager->saveEntity($opportunity);
$entityManager->getRepository('Contact')->relate($contact, 'opportunities', $opportunity);
$entityManager->getRelation($contact, 'opportunities')
->relate($opportunity);
$formulaManager = $this->getContainer()->get('formulaManager');
$formulaManager = $this->getContainer()->getByClass(Manager::class);
$script = "entity\countRelated('opportunities')";
$result = $formulaManager->run($script, $account);
@@ -108,7 +109,7 @@ class FormulaTest extends BaseTestCase
public function testSumRelated()
{
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$fm = $this->getContainer()->get('formulaManager');
$contact1 = $em->createEntity('Contact', [
@@ -118,14 +119,14 @@ class FormulaTest extends BaseTestCase
'lastName' => '2',
]);
$opportunity1 = $em->createEntity('Opportunity', [
$em->createEntity('Opportunity', [
'name' => '1',
'amount' => 1,
'stage' => 'Closed Won',
'contactsIds' => [$contact1->getId(), $contact2->getId()],
]);
$opportunity2 = $em->createEntity('Opportunity', [
$em->createEntity('Opportunity', [
'name' => '2',
'amount' => 1,
'stage' => 'Closed Won',
@@ -139,7 +140,7 @@ class FormulaTest extends BaseTestCase
public function testRecordExists()
{
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$em->createEntity('Meeting', [
'status' => 'Held',
@@ -169,7 +170,7 @@ class FormulaTest extends BaseTestCase
public function testRecordCount()
{
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$em->createEntity('Meeting', [
'status' => 'Held',
@@ -205,7 +206,7 @@ class FormulaTest extends BaseTestCase
public function testRecordFindOne()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$m1 = $em->createEntity('Meeting', [
'name' => '1',
@@ -296,7 +297,7 @@ class FormulaTest extends BaseTestCase
public function testRecordFindRelatedOne1()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$account = $em->createEntity('Account', [
'name' => 'Test',
@@ -339,8 +340,8 @@ class FormulaTest extends BaseTestCase
'lastName' => '2',
]);
$em->getRepository('Account')->relate($account, 'contacts', $c1);
$em->getRepository('Account')->relate($account, 'contacts', $c2);
$em->getRelation($account, 'contacts')->relate($c1);
$em->getRelation($account, 'contacts')->relate($c2);
$script = "record\\findRelatedOne('Account', '".$account->getId()."', 'meetings', 'name', 'asc')";
$result = $fm->run($script);
@@ -374,7 +375,7 @@ class FormulaTest extends BaseTestCase
public function testRecordFindRelatedOne2()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$a = $em->createEntity('Account', [
]);
@@ -453,7 +454,7 @@ class FormulaTest extends BaseTestCase
public function testRecordAttribute()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$m1 = $em->createEntity('Meeting', [
'name' => '1',
@@ -570,12 +571,12 @@ class FormulaTest extends BaseTestCase
public function testEntityGetLinkColumn()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$lead = $em->createEntity('Lead', []);
$targetList = $em->createEntity('TargetList', []);
$em->getRepository('Lead')->relate($lead, 'targetLists', $targetList->getId(), [
$em->getRelation($lead, 'targetLists')->relateById($targetList->getId(), [
'optedOut' => true,
]);
@@ -585,7 +586,7 @@ class FormulaTest extends BaseTestCase
$this->assertTrue($result);
$em->getRepository('Lead')->relate($lead, 'targetLists', $targetList->getId(), [
$em->getRelation($lead, 'targetLists')->relateById($targetList->getId(), [
'optedOut' => false,
]);
@@ -596,7 +597,7 @@ class FormulaTest extends BaseTestCase
public function testRecordRelate()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$a = $em->createEntity('Account', [
'name' => '1',
@@ -609,13 +610,13 @@ class FormulaTest extends BaseTestCase
$result = $fm->run($script);
$this->assertTrue($result);
$this->assertTrue($em->getRepository('Account')->isRelated($a, 'opportunities', $o));
$this->assertTrue($em->getRelation($a, 'opportunities')->isRelated($o));
}
public function testRecordRelate1()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$a = $em->createEntity('Account', [
'name' => '1',
@@ -628,13 +629,13 @@ class FormulaTest extends BaseTestCase
$result = $fm->run($script);
$this->assertTrue($result);
$this->assertTrue($em->getRepository('Account')->isRelated($a, 'opportunities', $o));
$this->assertTrue($em->getRelation($a, 'opportunities')->isRelated($o));
}
public function testRecordUnrelate()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$a = $em->createEntity('Account', [
'name' => '1',
@@ -644,19 +645,19 @@ class FormulaTest extends BaseTestCase
'name' => '1',
]);
$em->getRepository('Account')->relate($a, 'opportunities', $o);
$em->getRelation($a, 'opportunities')->relate($o);
$script = "record\\unrelate('Account', '".$a->getId()."', 'opportunities', '".$o->getId()."')";
$result = $fm->run($script);
$this->assertTrue($result);
$this->assertFalse($em->getRepository('Account')->isRelated($a, 'opportunities', $o));
$this->assertFalse($em->getRelation($a, 'opportunities')->isRelated($o));
}
public function testRecordRelationColumn()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$a = $em->createEntity('Account', [
'name' => '1',
@@ -665,7 +666,7 @@ class FormulaTest extends BaseTestCase
'lastName' => '1',
]);
$em->getRepository('Account')->relate($a, 'contacts', $c->getId(), ['role' => 'test']);
$em->getRelation($a, 'contacts')->relate($c->getId(), ['role' => 'test']);
$script = "record\\relationColumn('Account', '{$a->getId()}', 'contacts', '{$c->getId()}', 'role')";
$result = $fm->run($script);
@@ -676,7 +677,7 @@ class FormulaTest extends BaseTestCase
public function testRecordUpdateRelationColumn()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$a = $em->createEntity('Account', [
'name' => '1',
@@ -685,12 +686,12 @@ class FormulaTest extends BaseTestCase
'lastName' => '1',
]);
$em->getRepository('Account')->relate($a, 'contacts', $c->getId());
$em->getRelation($a, 'contacts')->relate( $c->getId());
$script = "record\\updateRelationColumn('Account', '{$a->getId()}', 'contacts', '{$c->getId()}', 'role', 'test')";
$fm->run($script);
$value = $em->getRepository('Account')->getRelationColumn($a, 'contacts', $c->getId(), 'role');
$value = $em->getRelation($a, 'contacts')->getColumnById($c->getId(), 'role');
$this->assertEquals('test', $value);
}
@@ -698,7 +699,7 @@ class FormulaTest extends BaseTestCase
public function testExtAccountFindByEmailAddress()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$a1 = $em->createEntity('Account', [
'name' => '1',
@@ -748,7 +749,7 @@ class FormulaTest extends BaseTestCase
public function testExtEmailApplyTemplate()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$a = $em->createEntity('Account', [
'name' => '1',
@@ -785,7 +786,7 @@ class FormulaTest extends BaseTestCase
$script = "ext\\email\\applyTemplate('{$email->getId()}', '{$emailTemplate->getId()}', 'Account', '{$a->getId()}')";
$fm->run($script);
$email = $em->getEntity('Email', $email->getId());
$email = $em->getEntityById('Email', $email->getId());
$attachmentsIds = $email->getLinkMultipleIdList('attachments');
@@ -823,7 +824,7 @@ class FormulaTest extends BaseTestCase
public function testExtPdfGenerate()
{
$fm = $this->getContainer()->get('formulaManager');
$em = $this->getContainer()->get('entityManager');
$em = $this->getContainer()->getByClass(EntityManager::class);
$a = $em->createEntity('Account', [
'name' => '1',
+25 -26
View File
@@ -29,26 +29,25 @@
namespace tests\integration\Espo\Core\Job;
use Espo\Core\{
Job\JobManager,
Job\Job\Status,
Job\JobSchedulerFactory,
Job\QueueName,
ORM\EntitManager,
};
use Espo\Core\InjectableFactory;
use Espo\Core\Job\Job\Status;
use Espo\Core\Job\JobManager;
use Espo\Core\Job\JobSchedulerFactory;
use Espo\Core\Job\QueueName;
use Espo\ORM\EntityManager;
use tests\integration\Core\BaseTestCase;
use tests\integration\testClasses\Job\Job as TestJob;
class JobTest extends \tests\integration\Core\BaseTestCase
class JobTest extends BaseTestCase
{
/**
* @var JobManager
*/
private $jobManager;
/**
* @var EntitManager
*/
/** @var EntityManager */
private $entityManager;
/**
@@ -62,10 +61,10 @@ class JobTest extends \tests\integration\Core\BaseTestCase
$this->jobManager = $this->getContainer()->get('jobManager');
$this->entityManager = $this->getContainer()->get('entityManager');
$this->entityManager = $this->getContainer()->getByClass(EntityManager::class);
$this->schedulerFactory = $this->getContainer()
->get('injectableFactory')
->getByClass(InjectableFactory::class)
->create(JobSchedulerFactory::class);
}
@@ -79,7 +78,7 @@ class JobTest extends \tests\integration\Core\BaseTestCase
$this->jobManager->processQueue(QueueName::Q0, 10);
$jobReloaded = $this->entityManager->getEntity('Job', $job->getId());
$jobReloaded = $this->entityManager->getEntityById('Job', $job->getId());
$this->assertEquals(Status::SUCCESS, $jobReloaded->getStatus());
}
@@ -93,7 +92,7 @@ class JobTest extends \tests\integration\Core\BaseTestCase
$this->jobManager->processQueue('q0', 10);
$jobReloaded = $this->entityManager->getEntity('Job', $job->getId());
$jobReloaded = $this->entityManager->getEntityById('Job', $job->getId());
$this->assertEquals(Status::SUCCESS, $jobReloaded->getStatus());
}
@@ -117,9 +116,9 @@ class JobTest extends \tests\integration\Core\BaseTestCase
$this->jobManager->process();
$job1Reloaded = $this->entityManager->getEntity('Job', $job1->getId());
$job2Reloaded = $this->entityManager->getEntity('Job', $job2->getId());
$job3Reloaded = $this->entityManager->getEntity('Job', $job3->getId());
$job1Reloaded = $this->entityManager->getEntityById('Job', $job1->getId());
$job2Reloaded = $this->entityManager->getEntityById('Job', $job2->getId());
$job3Reloaded = $this->entityManager->getEntityById('Job', $job3->getId());
$this->assertEquals(Status::SUCCESS, $job1Reloaded->getStatus());
$this->assertEquals(Status::SUCCESS, $job2Reloaded->getStatus());
@@ -145,9 +144,9 @@ class JobTest extends \tests\integration\Core\BaseTestCase
$this->jobManager->processGroup('group-1', 100);
$job1Reloaded = $this->entityManager->getEntity('Job', $job1->getId());
$job2Reloaded = $this->entityManager->getEntity('Job', $job2->getId());
$job3Reloaded = $this->entityManager->getEntity('Job', $job3->getId());
$job1Reloaded = $this->entityManager->getEntityById('Job', $job1->getId());
$job2Reloaded = $this->entityManager->getEntityById('Job', $job2->getId());
$job3Reloaded = $this->entityManager->getEntityById('Job', $job3->getId());
$this->assertEquals(Status::PENDING, $job1Reloaded->getStatus());
$this->assertEquals(Status::SUCCESS, $job2Reloaded->getStatus());
@@ -155,7 +154,7 @@ class JobTest extends \tests\integration\Core\BaseTestCase
$this->jobManager->processGroup('group-0', 100);
$job1Reloaded2 = $this->entityManager->getEntity('Job', $job1->getId());
$job1Reloaded2 = $this->entityManager->getEntityById('Job', $job1->getId());
$this->assertEquals(Status::SUCCESS, $job1Reloaded2->getStatus());
}
@@ -167,9 +166,9 @@ class JobTest extends \tests\integration\Core\BaseTestCase
'status' => Status::READY,
]);
$this->jobManager->runJobById($job->id);
$this->jobManager->runJobById($job->getId());
$jobReloaded = $this->entityManager->getEntity('Job', $job->id);
$jobReloaded = $this->entityManager->getEntityById('Job', $job->getId());
$this->assertEquals(Status::SUCCESS, $jobReloaded->getStatus());
}
@@ -182,7 +181,7 @@ class JobTest extends \tests\integration\Core\BaseTestCase
$this->jobManager->runJob($job);
$jobReloaded = $this->entityManager->getEntity('Job', $job->id);
$jobReloaded = $this->entityManager->getEntityById('Job', $job->getId());
$this->assertEquals(Status::SUCCESS, $jobReloaded->getStatus());
}
@@ -198,7 +197,7 @@ class JobTest extends \tests\integration\Core\BaseTestCase
$this->jobManager->runJob($job);
$jobReloaded = $this->entityManager->getEntity('Job', $job->getId());
$jobReloaded = $this->entityManager->getEntityById('Job', $job->getId());
$this->assertEquals(Status::SUCCESS, $jobReloaded->getStatus());
}
@@ -29,22 +29,17 @@
namespace tests\integration\Espo\Core\Notification;
use Espo\Core\{
ORM\EntityManager,
Container,
Utils\Config\ConfigWriter,
};
use Espo\Core\Container;
use Espo\ORM\EntityManager;
use Espo\Core\Utils\Config\ConfigWriter;
use Espo\{
Entities\User,
};
Core\InjectableFactory,
Entities\User};
use tests\integration\Core\BaseTestCase;
class AssignmentNotificatorTest extends \tests\integration\Core\BaseTestCase
class AssignmentNotificatorTest extends BaseTestCase
{
/**
* @var Container
*/
private $container;
/**
* @var EntityManager
@@ -61,10 +56,6 @@ class AssignmentNotificatorTest extends \tests\integration\Core\BaseTestCase
*/
private $user2;
/**
* @var User
*/
private $user3;
public function setUp(): void
{
@@ -74,15 +65,14 @@ class AssignmentNotificatorTest extends \tests\integration\Core\BaseTestCase
$application = $this->createApplication();
$this->container = $application->getContainer();
$container = $application->getContainer();
$this->entityManager = $this->container->get('entityManager');
$this->entityManager = $container->getByClass(EntityManager::class);
}
private function initTestData() : void
{
/* @var $configWriter ConfigWriter */
$configWriter = $this->getContainer()->get('injectableFactory')->create(ConfigWriter::class);
$configWriter = $this->getContainer()->getByClass(InjectableFactory::class)->create(ConfigWriter::class);
$this->getMetadata()->set('scopes', 'Meeting', [
'stream' => false,
@@ -114,18 +104,18 @@ class AssignmentNotificatorTest extends \tests\integration\Core\BaseTestCase
$this->user1 = $em->createEntity('User', [
'userName' => 'test-1',
'lastName' => 'Test 1',
'rolesIds' => [$role->id],
'rolesIds' => [$role->getId()],
'emailAddress' => 'test1@test.com',
]);
$this->user2 = $em->createEntity('User', [
'userName' => 'test-2',
'lastName' => 'Test 2',
'rolesIds' => [$role->id],
'rolesIds' => [$role->getId()],
'emailAddress' => 'test2@test.com',
]);
$this->user3 = $em->createEntity('User', [
$em->createEntity('User', [
'userName' => 'test-3',
'lastName' => 'Test 3',
'rolesIds' => [],
@@ -150,7 +140,7 @@ class AssignmentNotificatorTest extends \tests\integration\Core\BaseTestCase
]);
$notification = $this->entityManager
->getRepository('Notification')
->getRDBRepository('Notification')
->where([
'userId' => '1',
'type' => 'Assign',
@@ -170,7 +160,7 @@ class AssignmentNotificatorTest extends \tests\integration\Core\BaseTestCase
]);
$notification = $this->entityManager
->getRepository('Notification')
->getRDBRepository('Notification')
->where([
'userId' => $this->user1->getId(),
'type' => 'Assign',
@@ -190,7 +180,7 @@ class AssignmentNotificatorTest extends \tests\integration\Core\BaseTestCase
]);
$notification = $this->entityManager
->getRepository('Notification')
->getRDBRepository('Notification')
->where([
'userId' => $this->user1->getId(),
'type' => 'Assign',
@@ -210,7 +200,7 @@ class AssignmentNotificatorTest extends \tests\integration\Core\BaseTestCase
]);
$notification = $this->entityManager
->getRepository('Notification')
->getRDBRepository('Notification')
->where([
'userId' => $this->user1->getId(),
'type' => 'Assign',
@@ -29,7 +29,10 @@
namespace tests\integration\Espo\Core\Utils\FieldManager;
class ArrayTypeTest extends \tests\integration\Core\BaseTestCase
use Espo\ORM\EntityManager;
use tests\integration\Core\BaseTestCase;
class ArrayTypeTest extends BaseTestCase
{
private $jsonFieldDefs = '{
"name":"testArray",
@@ -83,7 +86,8 @@ class ArrayTypeTest extends \tests\integration\Core\BaseTestCase
$this->assertEquals('array', $savedFieldDefs['type']);
$this->assertTrue($savedFieldDefs['isCustom']);
$entityManager = $app->getContainer()->get('entityManager');
$entityManager = $app->getContainer()->getByClass(EntityManager::class);
$account = $entityManager->getEntity('Account');
$account->set([
'name' => 'Test',
@@ -92,7 +96,7 @@ class ArrayTypeTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($account);
$account = $entityManager->getEntity('Account', $account->id);
$account = $entityManager->getEntity('Account', $account->getId());
$this->assertEquals(['option1', 'option3'], $account->get('cTestArray'));
}
@@ -118,7 +122,7 @@ class ArrayTypeTest extends \tests\integration\Core\BaseTestCase
$this->assertTrue($savedFieldDefs['required']);
$entityManager = $app->getContainer()->get('entityManager');
$entityManager = $app->getContainer()->getByClass(EntityManager::class);
$account = $entityManager->getEntity('Account');
$account->set([
'name' => 'Test',
@@ -29,7 +29,10 @@
namespace tests\integration\Espo\Core\Utils\FieldManager;
class EnumTypeTest extends \tests\integration\Core\BaseTestCase
use Espo\ORM\EntityManager;
use tests\integration\Core\BaseTestCase;
class EnumTypeTest extends BaseTestCase
{
private $jsonFieldDefs = '{
"type":"enum",
@@ -82,7 +85,7 @@ class EnumTypeTest extends \tests\integration\Core\BaseTestCase
$this->assertTrue($savedFieldDefs['isCustom']);
$this->assertTrue($savedFieldDefs['audited']);
$entityManager = $app->getContainer()->get('entityManager');
$entityManager = $app->getContainer()->getByClass(EntityManager::class);
$account = $entityManager->getEntity('Account');
$account->set([
@@ -92,7 +95,7 @@ class EnumTypeTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($account);
$account = $entityManager->getEntity('Account', $account->id);
$account = $entityManager->getEntity('Account', $account->getId());
$this->assertEquals('option1', $account->get('cTestEnum'));
}
@@ -122,7 +125,8 @@ class EnumTypeTest extends \tests\integration\Core\BaseTestCase
$this->assertTrue($savedFieldDefs['audited']);
$this->assertTrue($savedFieldDefs['readOnly']);
$entityManager = $app->getContainer()->get('entityManager');
$entityManager = $app->getContainer()->getByClass(EntityManager::class);
$account = $entityManager->getEntity('Account');
$account->set([
'name' => 'New Test',
@@ -130,7 +134,7 @@ class EnumTypeTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($account);
$account = $entityManager->getEntity('Account', $account->id);
$account = $entityManager->getEntity('Account', $account->getId());
$this->assertEquals('option3', $account->get('cTestEnum'));
}
}
@@ -29,7 +29,9 @@
namespace tests\integration\Espo\Core\Utils\FieldManager;
class VarcharTypeTest extends \tests\integration\Core\BaseTestCase
use tests\integration\Core\BaseTestCase;
class VarcharTypeTest extends BaseTestCase
{
private $jsonFieldDefs = '{
"type":"varchar",
@@ -89,7 +91,7 @@ class VarcharTypeTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($account);
$account = $entityManager->getEntity('Account', $account->id);
$account = $entityManager->getEntity('Account', $account->getId());
$this->assertEquals('test-value', $account->get('cTestVarchar'));
}
@@ -125,7 +127,7 @@ class VarcharTypeTest extends \tests\integration\Core\BaseTestCase
$entityManager->saveEntity($account);
$account = $entityManager->getEntity('Account', $account->id);
$account = $entityManager->getEntity('Account', $account->getId());
$this->assertEquals('default-value', $account->get('cTestVarchar'));
}
}
@@ -45,16 +45,16 @@ class GlobalSearchTest extends \tests\integration\Core\BaseTestCase
$contact = $em->createEntity('Contact', [
'lastName' => '1',
'teamsIds' => [$team->id],
'teamsIds' => [$team->getId()],
]);
$account = $em->createEntity('Account', [
'name' => '1',
'teamsIds' => [$team->id],
'teamsIds' => [$team->getId()],
]);
$account = $em->createEntity('Account', [
'name' => '2',
'teamsIds' => [$team->id],
'teamsIds' => [$team->getId()],
]);
$account = $em->createEntity('Account', [
'name' => '1',
@@ -62,7 +62,7 @@ class GlobalSearchTest extends \tests\integration\Core\BaseTestCase
$this->createUser([
'userName' => 'tester',
'teamsIds' => [$team->id],
'teamsIds' => [$team->getId()],
], [
'data' => [
'Account' => [
@@ -50,8 +50,8 @@ class LeadCaptureTest extends \tests\integration\Core\BaseTestCase
$leadCaptureData = (object) [
'name' => 'test',
'subscribeToTargetList' => true,
'targetListId' => $targetList->id,
'targetTeamId' => $team->id,
'targetListId' => $targetList->getId(),
'targetTeamId' => $team->getId(),
'fieldList' => ['name', 'emailAddress'],
'leadSource' => 'Web Site'
];
@@ -76,8 +76,8 @@ class LeadCaptureTest extends \tests\integration\Core\BaseTestCase
$this->assertEquals('Web Site', $lead->get('source'));
$this->assertTrue($entityManager->getRepository('Lead')->isRelated($lead, 'teams', $team->id));
$this->assertTrue($entityManager->getRepository('Lead')->isRelated($lead, 'teams', $team->getId()));
$this->assertTrue($entityManager->getRepository('Lead')->isRelated($lead, 'targetLists', $targetList->id));
$this->assertTrue($entityManager->getRepository('Lead')->isRelated($lead, 'targetLists', $targetList->getId()));
}
}
+10 -10
View File
@@ -72,7 +72,7 @@ class MapperTest extends \tests\integration\Core\BaseTestCase
$isRelated = $entityManager->getRepository('Contact')->isRelated($contact, 'account', $account);
$this->assertTrue($isRelated);
$contact = $entityManager->getEntity('Contact', $contact->id);
$contact = $entityManager->getEntity('Contact', $contact->getId());
$entityManager->getRepository('Contact')->unrelate($contact, 'account', $account);
@@ -106,7 +106,7 @@ class MapperTest extends \tests\integration\Core\BaseTestCase
$this->assertTrue($isRelated);
$contact = $entityManager->getEntity('Contact', $contact->id);
$contact = $entityManager->getEntity('Contact', $contact->getId());
$entityManager->getRepository('Contact')
->getRelation($contact, 'account')
@@ -139,7 +139,7 @@ class MapperTest extends \tests\integration\Core\BaseTestCase
$isRelated = $entityManager->getRepository('Task')->isRelated($task, 'parent', $account);
$this->assertTrue($isRelated);
$task = $entityManager->getEntity('Task', $task->id);
$task = $entityManager->getEntity('Task', $task->getId());
$entityManager->getRepository('Task')->unrelate($task, 'parent', $account);
$isRelated = $entityManager->getRepository('Task')->isRelated($task, 'parent', $account);
@@ -194,10 +194,10 @@ class MapperTest extends \tests\integration\Core\BaseTestCase
$isRelated = $em->getRepository('Account')->isRelated($a1, 'originalLead', $l1);
$this->assertFalse($isRelated);
$c = $em->getRepository('Lead')->where(['createdAccountId' => $a1->id])->count();
$c = $em->getRepository('Lead')->where(['createdAccountId' => $a1->getId()])->count();
$this->assertEquals(0, $c);
$c = $em->getRepository('Lead')->where(['createdAccountId' => $a2->id])->count();
$c = $em->getRepository('Lead')->where(['createdAccountId' => $a2->getId()])->count();
$this->assertEquals(1, $c);
}
@@ -248,10 +248,10 @@ class MapperTest extends \tests\integration\Core\BaseTestCase
$isRelated = $em->getRepository('Account')->isRelated($a1, 'originalLead', $l1);
$this->assertFalse($isRelated);
$c = $em->getRepository('Lead')->where(['createdAccountId' => $a1->id])->count();
$c = $em->getRepository('Lead')->where(['createdAccountId' => $a1->getId()])->count();
$this->assertEquals(0, $c);
$c = $em->getRepository('Lead')->where(['createdAccountId' => $a2->id])->count();
$c = $em->getRepository('Lead')->where(['createdAccountId' => $a2->getId()])->count();
$this->assertEquals(1, $c);
}
@@ -297,7 +297,7 @@ class MapperTest extends \tests\integration\Core\BaseTestCase
$isRelated = $em->getRepository('Lead')->isRelated($l2, 'createdAccount', $a1);
$this->assertTrue($isRelated);
$l1 = $em->getEntity('Lead', $l1->id);
$l1 = $em->getEntity('Lead', $l1->getId());
$isRelated = $em->getRepository('Lead')->isRelated($l1, 'createdAccount', $a1);
$this->assertFalse($isRelated);
@@ -305,7 +305,7 @@ class MapperTest extends \tests\integration\Core\BaseTestCase
$isRelated = $em->getRepository('Account')->isRelated($a1, 'originalLead', $l1);
$this->assertFalse($isRelated);
$c = $em->getRepository('Lead')->where(['createdAccountId' => $a1->id])->count();
$c = $em->getRepository('Lead')->where(['createdAccountId' => $a1->getId()])->count();
$this->assertEquals(1, $c);
}
@@ -337,7 +337,7 @@ class MapperTest extends \tests\integration\Core\BaseTestCase
$em->getRepository('Lead')->relate($l1, 'createdAccount', $a1);
$em->getRepository('Account')->unrelate($a1, 'originalLead', $l1);
$l1 = $em->getEntity('Lead', $l1->id);
$l1 = $em->getEntity('Lead', $l1->getId());
$isRelated = $em->getRepository('Lead')->isRelated($l1, 'createdAccount', $a1);
$this->assertFalse($isRelated);
@@ -156,11 +156,11 @@ class SthCollectionTest extends \tests\integration\Core\BaseTestCase
]);
$em->createEntity('Opportunity', [
'name' => 'o-1',
'accountId' => $account->id,
'accountId' => $account->getId(),
]);
$em->createEntity('Opportunity', [
'name' => 'o-2',
'accountId' => $account->id,
'accountId' => $account->getId(),
]);
$query = $em->getQueryBuilder()
@@ -200,11 +200,11 @@ class SthCollectionTest extends \tests\integration\Core\BaseTestCase
]);
$em->createEntity('Opportunity', [
'name' => 'o-1',
'contactsIds' => [$contact->id],
'contactsIds' => [$contact->getId()],
]);
$em->createEntity('Opportunity', [
'name' => 'o-2',
'contactsIds' => [$contact->id],
'contactsIds' => [$contact->getId()],
]);
@@ -47,7 +47,7 @@ class TransactionManagerTest extends \tests\integration\Core\BaseTestCase
$this->assertNotNull($account);
$id = $account->id;
$id = $account->getId();
$tm->commit();
@@ -72,7 +72,7 @@ class TransactionManagerTest extends \tests\integration\Core\BaseTestCase
$this->assertNotNull($account);
$id = $account->id;
$id = $account->getId();
$tm->rollback();
@@ -95,7 +95,7 @@ class TransactionManagerTest extends \tests\integration\Core\BaseTestCase
'name' => 'test1',
]);
$id1 = $account1->id;
$id1 = $account1->getId();
$tm->start();
@@ -103,7 +103,7 @@ class TransactionManagerTest extends \tests\integration\Core\BaseTestCase
'name' => 'test2',
]);
$id2 = $account2->id;
$id2 = $account2->getId();
$tm->rollback();
@@ -128,7 +128,7 @@ class TransactionManagerTest extends \tests\integration\Core\BaseTestCase
'name' => 'test',
]);
$id = $account->id;
$id = $account->getId();
$tm->run(
function () use ($em, $id){
@@ -156,7 +156,7 @@ class TransactionManagerTest extends \tests\integration\Core\BaseTestCase
'name' => 'test',
]);
$id = $account->id;
$id = $account->getId();
try {
$tm->run(
+39 -39
View File
@@ -52,8 +52,8 @@ class AclTest extends BaseTestCase
$this->createUser([
'userName' => 'tester',
'portalsIds' => [$portal->id],
'contactId' => $contact->id,
'portalsIds' => [$portal->getId()],
'contactId' => $contact->getId(),
], [
'data' => [
'Case' => [
@@ -66,19 +66,19 @@ class AclTest extends BaseTestCase
],
], true);
$this->auth('tester', null, $portal->id);
$this->auth('tester', null, $portal->getId());
$app = $this->createApplication(true, $portal->id);
$app = $this->createApplication(true, $portal->getId());
$em = $app->getContainer()->get('entityManager');
$acl = $app->getContainer()->get('acl');
$case1 = $em->createEntity('Case', [
'contactId' => $contact->id,
'contactId' => $contact->getId(),
], ['createdById' => '1']);
$case2 = $em->createEntity('Case', [
'contactsIds' => [$contact->id],
'contactsIds' => [$contact->getId()],
], ['createdById' => '1']);
$case3 = $em->createEntity('Case', [
], ['createdById' => '1']);
@@ -97,12 +97,12 @@ class AclTest extends BaseTestCase
$idList = [];
foreach ($result->getCollection() as $e) {
$idList[] = $e->id;
$idList[] = $e->getId();
}
$this->assertTrue(in_array($case1->id, $idList));
$this->assertTrue(in_array($case2->id, $idList));
$this->assertFalse(in_array($case3->id, $idList));
$this->assertTrue(in_array($case1->getId(), $idList));
$this->assertTrue(in_array($case2->getId(), $idList));
$this->assertFalse(in_array($case3->getId(), $idList));
}
public function testAccessAccount(): void
@@ -119,9 +119,9 @@ class AclTest extends BaseTestCase
$this->createUser([
'userName' => 'tester',
'portalsIds' => [$portal->id],
'contactId' => $contact->id,
'accountsIds' => [$account->id],
'portalsIds' => [$portal->getId()],
'contactId' => $contact->getId(),
'accountsIds' => [$account->getId()],
], [
'data' => [
'Case' => [
@@ -134,24 +134,24 @@ class AclTest extends BaseTestCase
],
], true);
$this->auth('tester', null, $portal->id);
$this->auth('tester', null, $portal->getId());
$app = $this->createApplication(true, $portal->id);
$app = $this->createApplication(true, $portal->getId());
$em = $app->getContainer()->get('entityManager');
$acl = $app->getContainer()->get('acl');
$case1 = $em->createEntity('Case', [
'contactId' => $contact->id,
'contactId' => $contact->getId(),
], ['createdById' => '1']);
$case2 = $em->createEntity('Case', [
'contactsIds' => [$contact->id],
'contactsIds' => [$contact->getId()],
], ['createdById' => '1']);
$case3 = $em->createEntity('Case', [
], ['createdById' => '1']);
$case4 = $em->createEntity('Case', [
'accountId' => $account->id,
'accountId' => $account->getId(),
], ['createdById' => '1']);
$this->assertFalse($acl->check('Case', 'create'));
@@ -168,13 +168,13 @@ class AclTest extends BaseTestCase
$idList = [];
foreach ($result->getCollection() as $e) {
$idList[] = $e->id;
$idList[] = $e->getId();
}
$this->assertTrue(in_array($case1->id, $idList));
$this->assertTrue(in_array($case2->id, $idList));
$this->assertFalse(in_array($case3->id, $idList));
$this->assertTrue(in_array($case4->id, $idList));
$this->assertTrue(in_array($case1->getId(), $idList));
$this->assertTrue(in_array($case2->getId(), $idList));
$this->assertFalse(in_array($case3->getId(), $idList));
$this->assertTrue(in_array($case4->getId(), $idList));
}
public function testAccessOwn(): void
@@ -191,9 +191,9 @@ class AclTest extends BaseTestCase
$this->createUser([
'userName' => 'tester',
'portalsIds' => [$portal->id],
'contactId' => $contact->id,
'accountsIds' => [$account->id],
'portalsIds' => [$portal->getId()],
'contactId' => $contact->getId(),
'accountsIds' => [$account->getId()],
], [
'data' => [
'Case' => [
@@ -206,9 +206,9 @@ class AclTest extends BaseTestCase
],
], true);
$this->auth('tester', null, $portal->id);
$this->auth('tester', null, $portal->getId());
$app = $this->createApplication(true, $portal->id);
$app = $this->createApplication(true, $portal->getId());
$em = $app->getContainer()->get('entityManager');
@@ -216,19 +216,19 @@ class AclTest extends BaseTestCase
$user = $app->getContainer()->get('user');
$case1 = $em->createEntity('Case', [
'contactId' => $contact->id,
'contactId' => $contact->getId(),
], ['createdById' => '1']);
$case2 = $em->createEntity('Case', [
'contactsIds' => [$contact->id],
'contactsIds' => [$contact->getId()],
], ['createdById' => '1']);
$case3 = $em->createEntity('Case', [
], ['createdById' => '1']);
$case4 = $em->createEntity('Case', [
'accountId' => $account->id,
'accountId' => $account->getId(),
], ['createdById' => '1']);
$case5 = $em->createEntity('Case', [
'accountId' => $account->id,
], ['createdById' => $user->id]);
'accountId' => $account->getId(),
], ['createdById' => $user->getId()]);
$this->assertFalse($acl->check('Case', 'create'));
$this->assertFalse($acl->check('Case', 'edit'));
@@ -247,14 +247,14 @@ class AclTest extends BaseTestCase
$idList = [];
foreach ($result->getCollection() as $e) {
$idList[] = $e->id;
$idList[] = $e->getId();
}
$this->assertFalse(in_array($case1->id, $idList));
$this->assertFalse(in_array($case2->id, $idList));
$this->assertFalse(in_array($case3->id, $idList));
$this->assertFalse(in_array($case4->id, $idList));
$this->assertTrue(in_array($case5->id, $idList));
$this->assertFalse(in_array($case1->getId(), $idList));
$this->assertFalse(in_array($case2->getId(), $idList));
$this->assertFalse(in_array($case3->getId(), $idList));
$this->assertFalse(in_array($case4->getId(), $idList));
$this->assertTrue(in_array($case5->getId(), $idList));
}
public function testCreateCase(): void
@@ -31,8 +31,6 @@ namespace tests\integration\Espo\Record;
use Espo\Core\Application;
use Espo\Core\Exceptions\BadRequest;
use Espo\Core\Exceptions\Conflict;
use Espo\Core\Exceptions\Forbidden;
use Espo\Core\Record\CreateParams;
use Espo\Core\Record\ServiceContainer;
use Espo\Core\Record\UpdateParams;
@@ -103,7 +101,7 @@ class FieldValidationTest extends BaseTestCase
->getByClass(ServiceContainer::class)
->get('Account')
->update(
$entity->id,
$entity->getId(),
(object) [
'name' => '',
],
@@ -48,9 +48,9 @@ class RestoreDeletedTest extends \tests\integration\Core\BaseTestCase
'name' => 'Test'
], CreateParams::create());
$service->delete($account->id, DeleteParams::create());
$service->delete($account->getId(), DeleteParams::create());
$account = $service->read($account->id, ReadParams::create());
$account = $service->read($account->getId(), ReadParams::create());
$this->assertNotNull($account);
@@ -69,11 +69,11 @@ class RestoreDeletedTest extends \tests\integration\Core\BaseTestCase
'name' => 'Test'
], CreateParams::create());
$service->delete($account->id, DeleteParams::create());
$service->delete($account->getId(), DeleteParams::create());
$service->restoreDeleted($account->id);
$service->restoreDeleted($account->getId());
$account = $service->read($account->id, ReadParams::create());
$account = $service->read($account->getId(), ReadParams::create());
$this->assertNotNull($account);