cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,12 +1,41 @@
<?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 Search\Utils;
use Chill\MainBundle\Search\Utils\ExtractDateFromPattern;
use DateTimeImmutable;
use PHPUnit\Framework\TestCase;
use function array_map;
/**
* @internal
* @coversNothing
*/
class ExtractDateFromPatternTest extends TestCase
{
public function provideSubjects()
{
yield ['15/06/1981', '', 1, '1981-06-15'];
yield ['15/06/1981 30/12/1987', '', 2, '1981-06-15', '1987-12-30'];
yield ['diallo 15/06/1981', 'diallo', 1, '1981-06-15'];
yield ['diallo 31/03/1981', 'diallo', 1, '1981-03-31'];
yield ['diallo 15-06-1981', 'diallo', 1, '1981-06-15'];
yield ['diallo 1981-12-08', 'diallo', 1, '1981-12-08'];
yield ['diallo', 'diallo', 0];
}
/**
* @dataProvider provideSubjects
@@ -18,28 +47,17 @@ class ExtractDateFromPatternTest extends TestCase
$this->assertCount($count, $result->getFound());
$this->assertEquals($filtered, $result->getFilteredSubject());
$this->assertContainsOnlyInstancesOf(\DateTimeImmutable::class, $result->getFound());
$this->assertContainsOnlyInstancesOf(DateTimeImmutable::class, $result->getFound());
$dates = \array_map(
function (\DateTimeImmutable $d) {
$dates = array_map(
function (DateTimeImmutable $d) {
return $d->format('Y-m-d');
}, $result->getFound()
},
$result->getFound()
);
foreach ($datesSearched as $date) {
$this->assertContains($date, $dates);
}
}
public function provideSubjects()
{
yield ["15/06/1981", "", 1, '1981-06-15'];
yield ["15/06/1981 30/12/1987", "", 2, '1981-06-15', '1987-12-30'];
yield ["diallo 15/06/1981", "diallo", 1, '1981-06-15'];
yield ["diallo 31/03/1981", "diallo", 1, '1981-03-31'];
yield ["diallo 15-06-1981", "diallo", 1, '1981-06-15'];
yield ["diallo 1981-12-08", "diallo", 1, '1981-12-08'];
yield ["diallo", "diallo", 0];
}
}