- Add /api/rules CRUD, nested actions, and expr validation - Add rules migration, models, and RuleEngine/Expression services - Run ORDER_CREATED rules after order create (non-blocking) and refresh tests - Update OpenAPI tags/schemas/paths and bundled docs
25 lines
588 B
PHP
25 lines
588 B
PHP
<?php
|
|
|
|
namespace Tests\Unit\Rules;
|
|
|
|
use App\Services\RuleExpressionService;
|
|
use CodeIgniter\Test\CIUnitTestCase;
|
|
|
|
class RuleExpressionServiceTest extends CIUnitTestCase
|
|
{
|
|
public function testEvaluateBooleanWithArrayContext(): void
|
|
{
|
|
$svc = new RuleExpressionService();
|
|
|
|
$ok = $svc->evaluateBoolean('order["SiteID"] == 1', [
|
|
'order' => ['SiteID' => 1],
|
|
]);
|
|
$this->assertTrue($ok);
|
|
|
|
$no = $svc->evaluateBoolean('order["SiteID"] == 2', [
|
|
'order' => ['SiteID' => 1],
|
|
]);
|
|
$this->assertFalse($no);
|
|
}
|
|
}
|