<?php declare(strict_types = 1);
namespace Drupal\Tests\opencase\Unit;
include "EntityTrait.php";
use Drupal\Tests\UnitTestCase;
class OCActorTest extends UnitTestCase{
use EntityTrait;
public function setUp(): void {
$this->etm = $this->getEntityTypeManager();
$this->setupContainer([
'entity_type.manager' => $this->etm
]);
}
public function testGetCountOfCaseProvisions(): void{
$storage = $this->getStorage($this->etm, 'oc_case_provision');
$query = $this->getQuery($storage);
$actor = $this->getMockBuilder('\\Drupal\\opencase_entities\\Entity\\OCActor')->disableOriginalConstructor()
->onlyMethods(['id'])
->getMock();
$actor->expects($this->once())->method('id')->willReturn(5);
$query->expects($this->once())->method('condition')->with('oc_provider', 5);
$query->expects($this->once())->method('execute')->willReturn([1,2,3,4]);
$count = $actor->getCountOfCaseProvisions();
$this->assertTrue($count == 4);