mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Controller;
|
||||
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use function array_pop;
|
||||
use function json_decode;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class SocialIssueApiControllerTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
@@ -17,21 +30,6 @@ class SocialIssueApiControllerTest extends WebTestCase
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
public function testList(): array
|
||||
{
|
||||
$client = $this->getClientAuthenticated();
|
||||
$client->request(Request::METHOD_GET, '/api/1.0/person/social-work/social-issue.json');
|
||||
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$data = \json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertGreaterThan(0, $data['count']);
|
||||
$this->assertGreaterThan(0, count($data['results']));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testList
|
||||
*/
|
||||
@@ -39,17 +37,31 @@ class SocialIssueApiControllerTest extends WebTestCase
|
||||
{
|
||||
$socialIssues = $data['results'];
|
||||
shuffle($socialIssues);
|
||||
$socialIssue = \array_pop($socialIssues);
|
||||
|
||||
$socialIssue = array_pop($socialIssues);
|
||||
|
||||
$client = $this->getClientAuthenticated();
|
||||
$client->request(Request::METHOD_GET, sprintf('/api/1.0/person/social-work/social-issue/%d.json', $socialIssue['id']));
|
||||
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$data = \json_decode($client->getResponse()->getContent(), true);
|
||||
$data = json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertArrayHasKey('id', $data);
|
||||
$this->assertArrayHasKey('type', $data);
|
||||
}
|
||||
|
||||
public function testList(): array
|
||||
{
|
||||
$client = $this->getClientAuthenticated();
|
||||
$client->request(Request::METHOD_GET, '/api/1.0/person/social-work/social-issue.json');
|
||||
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$data = json_decode($client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertGreaterThan(0, $data['count']);
|
||||
$this->assertGreaterThan(0, count($data['results']));
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user