mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
add endpoint for getting permissions info
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Controller;
|
||||
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class PermissionApiControllerTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
|
||||
public function testNullObject()
|
||||
{
|
||||
$client = $this->getClientAuthenticated();
|
||||
|
||||
$client->request(
|
||||
'POST',
|
||||
'/api/1.0/main/permissions/info.json',
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server
|
||||
\json_encode([
|
||||
'object' => null,
|
||||
'class' => null,
|
||||
'roles' => ['ROLE_USER', 'ROLE_ADMIN']
|
||||
])
|
||||
);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
$data = \json_decode($client->getResponse()->getContent(), true);
|
||||
$this->assertTrue($data['roles']['ROLE_USER']);
|
||||
$this->assertFalse($data['roles']['ROLE_ADMIN']);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user