34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php declare(strict_types = 1);
|
|
|
|
namespace Drupal\Tests\opencase\Unit;
|
|
|
|
use Drupal\Tests\UnitTestCase;
|
|
|
|
class OCCaseTest extends UnitTestCase{
|
|
|
|
use EntityTrait;
|
|
|
|
private $case;
|
|
|
|
public function setUp(): void {
|
|
$this->etm = $this->getEntityTypeManager();
|
|
$this->getContainer([
|
|
'entity_type.manager' => $this->etm
|
|
]);
|
|
$this->case = $this->getMockBuilder('\\Drupal\\opencase_cases\\Entity\\OCCase')->disableOriginalConstructor()
|
|
->onlyMethods(['id'])
|
|
->getMock();
|
|
}
|
|
|
|
public function testGetCaseProvisionIds(): void{
|
|
$storage = $this->getStorage($this->etm, 'oc_case_provision');
|
|
$query = $this->getQuery($storage);
|
|
$this->case->expects($this->once())->method('id')->willReturn(5);
|
|
$query->expects($this->once())->method('condition')->withConsecutive(
|
|
['oc_case.target_id', 5]);
|
|
$query->expects($this->once())->method('execute')->willReturn([1,2,3,4]);
|
|
$ids = $this->case->getCaseProvisionIds($this->etm);
|
|
$this->assertTrue($ids == [1,2,3,4]);
|
|
}
|
|
}
|