packages/deriver/tests/Unit/Deriver/Evaluator/Execution/Demand/KeyTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Deriver\Evaluator\Execution\Demand;
6
7use Deriver\Deriver\Evaluator\Execution\Demand\Key;
8use PHPUnit\Framework\Attributes\CoversClass;
9use PHPUnit\Framework\Attributes\Small;
10use PHPUnit\Framework\TestCase;
11
12/**
13 * @covers \Deriver\Deriver\Evaluator\Execution\Demand\Key
14 */
15#[CoversClass(Key::class)]
16#[Small]
17final class KeyTest extends TestCase
18{
19    public function testIdSeparatesStateProjectionContextAndGeneration(): void
20    {
21        $key = new Key('snapshot', 'f', 'entry', \Deriver\Deriver\Evaluator\Execution\Demand\DemandKind::Value, 'return', 'input', 'state', 'guard');
22        $epoch = new Key('snapshot', 'f', 'entry', \Deriver\Deriver\Evaluator\Execution\Demand\DemandKind::Value, 'return', 'input', 'state', 'guard', 1);
23        $projection = new Key('snapshot', 'f', 'entry', \Deriver\Deriver\Evaluator\Execution\Demand\DemandKind::Value, 'field', 'input', 'state', 'guard');
24        self::assertSame($key->id(), (clone $key)->id());
25        self::assertNotSame($key->id(), $epoch->id());
26        self::assertNotSame($key->id(), $projection->id());
27    }
28}
29