mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Change attribute in test and add new test method
Updated an existing test to use the 'EDIT' attribute instead of 'SEE' in AbstractStoredObjectVoterTest.php. Added a new test method to check the 'SEE' attribute when the workflow is allowed, ensuring proper access validation.
This commit is contained in:
parent
5fed42a623
commit
564813ef3d
@ -143,10 +143,26 @@ class AbstractStoredObjectVoterTest extends TestCase
|
|||||||
$voter = $this->buildStoredObjectVoter(true, $this->repository, $this->security, $this->workflowDocumentService);
|
$voter = $this->buildStoredObjectVoter(true, $this->repository, $this->security, $this->workflowDocumentService);
|
||||||
|
|
||||||
// Test voteOnAttribute method
|
// Test voteOnAttribute method
|
||||||
$attribute = StoredObjectRoleEnum::SEE;
|
$attribute = StoredObjectRoleEnum::EDIT;
|
||||||
$result = $voter->voteOnAttribute($attribute, $subject, $token);
|
$result = $voter->voteOnAttribute($attribute, $subject, $token);
|
||||||
|
|
||||||
// Assert that access is denied when workflow is not allowed
|
// Assert that access is denied when workflow is not allowed
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testVoteOnAttributeAllowedWorkflowAllowedToSeeDocument(): void
|
||||||
|
{
|
||||||
|
list($user, $token, $subject, $entity) = $this->setupMockObjects();
|
||||||
|
|
||||||
|
// Setup mocks for voteOnAttribute method
|
||||||
|
$this->setupMocksForVoteOnAttribute($user, $token, true, $entity, false);
|
||||||
|
$voter = $this->buildStoredObjectVoter(true, $this->repository, $this->security, $this->workflowDocumentService);
|
||||||
|
|
||||||
|
// Test voteOnAttribute method
|
||||||
|
$attribute = StoredObjectRoleEnum::SEE;
|
||||||
|
$result = $voter->voteOnAttribute($attribute, $subject, $token);
|
||||||
|
|
||||||
|
// Assert that access is denied when workflow is not allowed
|
||||||
|
$this->assertTrue($result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user