26 lines
1.4 KiB
PHP
26 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Services\OpportunityReviewMateriality;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class EditorialLegalVersionTest extends TestCase
|
|
{
|
|
public function test_legal_decisions_cannot_be_carried_to_a_different_content_version_in_phase_one(): void
|
|
{
|
|
$service = new OpportunityReviewMateriality;
|
|
$before = ['hash' => str_repeat('a', 64), 'payload' => [], 'resources' => []];
|
|
$after = [...$before, 'hash' => str_repeat('b', 64)];
|
|
$review = ['decision' => 'approved', 'hash' => $before['hash'], 'scope_rule' => OpportunityReviewMateriality::VERSION];
|
|
$review['scope_hash'] = $service->hash($before, 'land_legal_review', $review);
|
|
$this->assertSame(['land_legal_review'], $service->reconcile($before, $after, ['land_legal_review' => $review], ['land_legal_review'])['retained']);
|
|
$strict = $service->reconcile($before, $after, ['land_legal_review' => $review], ['land_legal_review'], exactLegalVersion: true);
|
|
$this->assertSame([], $strict['reviews']);
|
|
$this->assertSame(['land_legal_review'], $strict['reopened']);
|
|
$this->assertFalse($service->matches($after, 'land_legal_review', [...$review, 'accepted_submission_hash' => $after['hash']], true));
|
|
$this->assertTrue($service->matches($before, 'land_legal_review', $review, true));
|
|
$this->assertSame($before['hash'], $review['hash']);
|
|
}
|
|
}
|