Skip to content

Beautiful Open-Source Form Builder

571 B
Raw Blame
<?php

use App\Rules\IntegrationLogicRule;
use Tests\TestCase;

uses(TestCase::class);

it('rejects unknown operators and malformed group nodes before traversal', function () {
    $rule = new IntegrationLogicRule();
    foreach ([['operatorIdentifier' => 'and'], ['operatorIdentifier' => 'and', 'children' => []], ['operatorIdentifier' => 'and', 'children' => ['invalid']], ['identifier' => 'x', 'value' => ['property_meta' => ['type' => 'not-a-type'], 'operator' => 'not-an-operator']]] as $node) {
        expect($rule->passes('logic', $node))->toBeFalse();
    }
});