added method to case to get case provisions
This commit is contained in:
33
tests/src/Unit/OCCaseTest.php
Normal file
33
tests/src/Unit/OCCaseTest.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?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]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user