cs: Switch to a stricter way of coding - this might break in a lot of places.

This commit is contained in:
Pol Dellaiera
2021-11-30 13:33:18 +01:00
parent 28d2c42454
commit 47c5855a21
957 changed files with 9025 additions and 568 deletions

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* 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\ReportBundle\Tests\Timeline;
use Chill\MainBundle\Entity\Scope;
@@ -23,7 +32,7 @@ use function count;
* @internal
* @coversNothing
*/
class TimelineProviderTest extends WebTestCase
final class TimelineProviderTest extends WebTestCase
{
/**
* @var \Doctrine\ORM\EntityManager
@@ -45,12 +54,12 @@ class TimelineProviderTest extends WebTestCase
*/
public function setUp()
{
static::bootKernel();
self::bootKernel();
static::$em = static::$kernel->getContainer()
self::$em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$center = static::$em->getRepository('ChillMainBundle:Center')
$center = self::$em->getRepository('ChillMainBundle:Center')
->findOneBy(['name' => 'Center A']);
$person = (new Person(new DateTime('2015-05-01')))
@@ -58,18 +67,18 @@ class TimelineProviderTest extends WebTestCase
->setFirstName('Nelson')
->setLastName('Mandela')
->setCenter($center);
static::$em->persist($person);
self::$em->persist($person);
$this->person = $person;
$scopesSocial = array_filter(
static::$em
self::$em
->getRepository('ChillMainBundle:Scope')
->findAll(),
static function (Scope $scope) { return $scope->getName()['en'] === 'social'; }
);
$report = (new Report())
->setUser(static::$em->getRepository('ChillMainBundle:User')
->setUser(self::$em->getRepository('ChillMainBundle:User')
->findOneByUsername('center a_social'))
->setDate(new DateTime('2015-05-02'))
->setPerson($this->person)
@@ -78,10 +87,10 @@ class TimelineProviderTest extends WebTestCase
'house-desc' => 'blah blah', ])
->setScope(end($scopesSocial));
static::$em->persist($report);
self::$em->persist($report);
$this->report = $report;
static::$em->flush();
self::$em->flush();
}
public function tearDown()
@@ -94,7 +103,7 @@ class TimelineProviderTest extends WebTestCase
public function testReportIsNotVisibleToUngrantedUsers()
{
$client = static::createClient(
$client = self::createClient(
[],
MainTestHelper::getAuthenticatedClientOptions('center a_administrative')
);
@@ -115,7 +124,7 @@ class TimelineProviderTest extends WebTestCase
*/
public function testTimelineReport()
{
$client = static::createClient(
$client = self::createClient(
[],
MainTestHelper::getAuthenticatedClientOptions()
);
@@ -137,7 +146,7 @@ class TimelineProviderTest extends WebTestCase
public function testTimelineReportWithSummaryField()
{
//load the page
$client = static::createClient(
$client = self::createClient(
[],
MainTestHelper::getAuthenticatedClientOptions()
);
@@ -177,7 +186,7 @@ class TimelineProviderTest extends WebTestCase
*/
private function getHousingCustomFieldsGroup()
{
$groups = static::$em
$groups = self::$em
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
->findAll();