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

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Deriver\Evaluator\Execution\Demand;
6
7use Deriver\Deriver\Evaluator\Execution\Demand\DemandKind as Subject;
8use PHPUnit\Framework\Attributes\CoversNothing;
9use PHPUnit\Framework\TestCase;
10
11#[CoversNothing]
12final class DemandKindTest extends TestCase
13{
14    public function testCacheIdentitySeparatesDemandKindsAndPreservesTextualIdentity(): void
15    {
16        $value = new \Deriver\Deriver\Evaluator\Execution\Demand\Key('snapshot', 'App\\run', 'entry', Subject::Value, 'field', 'context', 'state', 'guard');
17        $location = new \Deriver\Deriver\Evaluator\Execution\Demand\Key('snapshot', 'App\\run', 'entry', Subject::Location, 'field', 'context', 'state', 'guard');
18        self::assertNotSame($value->id(), $location->id());
19        self::assertSame(hash('sha256', serialize(['snapshot', 'App\\run', 'entry', 'value', 'field', 'context', 'state', 'guard', 0])), $value->id());
20    }
21}
22