Started adding HookHelper and tests but the tests aren't working

This commit is contained in:
naomi 2022-04-21 08:29:32 +01:00
parent 797da77803
commit 22640f02b6
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<?php
namespace Drupal\opencase_cases\Helper;
class HookHelper {
public static function onCaseFeeUpdate(\Drupal\opencase_cases\Entity\OCCaseFee $caseFee) {
}
}

View File

@ -0,0 +1,16 @@
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
include '../../../modules/opencase_cases/src/Entity/OCCase.php';
final class HookHelperTest extends TestCase
{
public function testOnCaseFeeUpdate(): void
{
$caseStub = $this->createStub(\Drupal\opencase_cases\Entity\OCCase::class);
$caseStub->total_fee = 5;
$caseFeeStub = $this->createStub(\Drupal\opencase_cases\Entity\OCCaseFee::class);
$caseFeeStub->amount = 10;
$caseFeeStub->method('getCase')->will($this->returnValue($caseStub));
$this->assertSame(5,5);
}
}