mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 22:35:01 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -14,14 +14,12 @@ namespace Export;
|
||||
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriodACLAwareRepositoryInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class AccompanyingCourseExportHelperTest extends KernelTestCase
|
||||
@@ -114,5 +112,4 @@ class AccompanyingCourseExportHelperTest extends KernelTestCase
|
||||
|
||||
return [$periodA, $periodB, $periodC];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -28,22 +28,20 @@ use Doctrine\ORM\QueryBuilder;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\Prophet;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* Test the export manager.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ExportManagerTest extends KernelTestCase
|
||||
@@ -111,23 +109,22 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$filters
|
||||
);
|
||||
|
||||
|
||||
$obtained = iterator_to_array($exportManager->getAggregatorsApplyingOn($exportFoo, $centers));
|
||||
$this->assertEquals(1, count($obtained));
|
||||
$this->assertEquals(1, \count($obtained));
|
||||
$this->assertContains('foo', array_keys($obtained));
|
||||
|
||||
$obtained = iterator_to_array($exportManager->getAggregatorsApplyingOn($exportBar, $centers));
|
||||
$this->assertEquals(1, count($obtained));
|
||||
$this->assertEquals(1, \count($obtained));
|
||||
$this->assertContains('bar', array_keys($obtained));
|
||||
|
||||
$obtained = iterator_to_array($exportManager->getAggregatorsApplyingOn($exportFooBar, $centers));
|
||||
$this->assertEquals(2, count($obtained));
|
||||
$this->assertEquals(2, \count($obtained));
|
||||
$this->assertContains('bar', array_keys($obtained));
|
||||
$this->assertContains('foo', array_keys($obtained));
|
||||
|
||||
// test with empty centers
|
||||
$obtained = iterator_to_array($exportManager->getAggregatorsApplyingOn($exportFooBar, []));
|
||||
$this->assertEquals(0, count($obtained));
|
||||
$this->assertEquals(0, \count($obtained));
|
||||
}
|
||||
|
||||
public function testFiltersApplyingOn()
|
||||
@@ -161,27 +158,27 @@ final class ExportManagerTest extends KernelTestCase
|
||||
);
|
||||
|
||||
$obtained = iterator_to_array($exportManager->getFiltersApplyingOn($exportFoo, $centers));
|
||||
$this->assertEquals(1, count($obtained));
|
||||
$this->assertEquals(1, \count($obtained));
|
||||
$this->assertContains('foo', array_keys($obtained));
|
||||
|
||||
$obtained = iterator_to_array($exportManager->getFiltersApplyingOn($exportBar, $centers));
|
||||
$this->assertEquals(1, count($obtained));
|
||||
$this->assertEquals(1, \count($obtained));
|
||||
$this->assertContains('bar', array_keys($obtained));
|
||||
|
||||
$obtained = iterator_to_array($exportManager->getFiltersApplyingOn($exportFooBar, $centers));
|
||||
$this->assertEquals(2, count($obtained));
|
||||
$this->assertEquals(2, \count($obtained));
|
||||
$this->assertContains('bar', array_keys($obtained));
|
||||
$this->assertContains('foo', array_keys($obtained));
|
||||
|
||||
$obtained = iterator_to_array($exportManager->getFiltersApplyingOn($exportFooBar, []));
|
||||
$this->assertEquals(0, count($obtained));
|
||||
$this->assertEquals(0, \count($obtained));
|
||||
}
|
||||
|
||||
public function testFormattersByTypes()
|
||||
{
|
||||
$exportManager = $this->createExportManager();
|
||||
|
||||
//create a formatter
|
||||
// create a formatter
|
||||
$formatterFoo = $this->prophet->prophesize();
|
||||
$formatterFoo->willImplement(\Chill\MainBundle\Export\FormatterInterface::class);
|
||||
$formatterFoo->getType()->willReturn('foo');
|
||||
@@ -259,7 +256,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
case '_header':
|
||||
return 'export';
|
||||
|
||||
default: throw new RuntimeException(sprintf('The value %s is not valid', $value));
|
||||
default: throw new \RuntimeException(sprintf('The value %s is not valid', $value));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -297,7 +294,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
'_header' => 'foo_header',
|
||||
'cat a' => 'label cat a',
|
||||
'cat b' => 'label cat b',
|
||||
default => throw new RuntimeException(sprintf('This value (%s) is not valid', $value)),
|
||||
default => throw new \RuntimeException(sprintf('This value (%s) is not valid', $value)),
|
||||
});
|
||||
$aggregator->addRole()->willReturn(null);
|
||||
$aggregator->addRole()->shouldBeCalled();
|
||||
@@ -314,7 +311,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$filters
|
||||
);
|
||||
|
||||
//add formatter interface
|
||||
// add formatter interface
|
||||
$formatter = new \Chill\MainBundle\Export\Formatter\SpreadSheetFormatter(
|
||||
self::$container->get(TranslatorInterface::class),
|
||||
$exportManager
|
||||
@@ -486,7 +483,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
|
||||
public function testNonExistingFormatter()
|
||||
{
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectException(\RuntimeException::class);
|
||||
|
||||
$exportManager = $this->createExportManager();
|
||||
|
||||
@@ -501,11 +498,11 @@ final class ExportManagerTest extends KernelTestCase
|
||||
* user 'center a_social' from database.
|
||||
*/
|
||||
protected function createExportManager(
|
||||
?LoggerInterface $logger = null,
|
||||
?EntityManagerInterface $em = null,
|
||||
?AuthorizationCheckerInterface $authorizationChecker = null,
|
||||
?AuthorizationHelper $authorizationHelper = null,
|
||||
?UserInterface $user = null,
|
||||
LoggerInterface $logger = null,
|
||||
EntityManagerInterface $em = null,
|
||||
AuthorizationCheckerInterface $authorizationChecker = null,
|
||||
AuthorizationHelper $authorizationHelper = null,
|
||||
UserInterface $user = null,
|
||||
array $exports = [],
|
||||
array $aggregators = [],
|
||||
array $filters = [],
|
||||
@@ -541,20 +538,26 @@ class DummyFilterWithApplying implements FilterInterface
|
||||
{
|
||||
return 'dummy';
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder) {}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
return ['dummy filter', []];
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return $this->role;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data) {}
|
||||
|
||||
public function applyOn()
|
||||
{
|
||||
return $this->applyOn;
|
||||
|
Reference in New Issue
Block a user