getClientAuthenticated(); $client->request( 'POST', '/api/1.0/main/permissions/info.json', [], // parameters [], // files [], // server json_encode([ 'object' => [ 'datetime' => '1969-07-09T00:00:00+0100', ], 'class' => \DateTime::class, 'roles' => ['FOO_ROLE'], ]) ); $this->assertResponseIsSuccessful(); $data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR); $this->assertFalse($data['roles']['FOO_ROLE']); } 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, 512, JSON_THROW_ON_ERROR); $this->assertTrue($data['roles']['ROLE_USER']); $this->assertFalse($data['roles']['ROLE_ADMIN']); } }