mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
php cs fixes
This commit is contained in:
@@ -20,12 +20,15 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\AbstractQuery;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use ReflectionClass;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -47,10 +50,9 @@ final class SummaryBudgetTest extends TestCase
|
||||
],
|
||||
]);
|
||||
$queryCharges->setParameters(Argument::type('array'))
|
||||
->will(function ($args, $query) {
|
||||
->will(static function ($args, $query) {
|
||||
return $query;
|
||||
})
|
||||
;
|
||||
});
|
||||
|
||||
$queryResources = $this->prophesize(AbstractQuery::class);
|
||||
$queryResources->getResult()->willReturn([
|
||||
@@ -61,23 +63,23 @@ final class SummaryBudgetTest extends TestCase
|
||||
],
|
||||
]);
|
||||
$queryResources->setParameters(Argument::type('array'))
|
||||
->will(function ($args, $query) {
|
||||
->will(static function ($args, $query) {
|
||||
return $query;
|
||||
})
|
||||
;
|
||||
});
|
||||
|
||||
$em = $this->prophesize(EntityManagerInterface::class);
|
||||
$em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class))
|
||||
->will(function ($args) use ($queryResources, $queryCharges) {
|
||||
->will(static function ($args) use ($queryResources, $queryCharges) {
|
||||
if (false !== strpos($args[0], 'chill_budget.resource')) {
|
||||
return $queryResources->reveal();
|
||||
}
|
||||
|
||||
if (false !== strpos($args[0], 'chill_budget.charge')) {
|
||||
return $queryCharges->reveal();
|
||||
}
|
||||
throw new \RuntimeException('this query does not have a stub counterpart: '.$args[0]);
|
||||
})
|
||||
;
|
||||
|
||||
throw new RuntimeException('this query does not have a stub counterpart: ' . $args[0]);
|
||||
});
|
||||
|
||||
$chargeRepository = $this->prophesize(ChargeKindRepositoryInterface::class);
|
||||
$chargeRepository->findAll()->willReturn([
|
||||
@@ -98,24 +100,23 @@ final class SummaryBudgetTest extends TestCase
|
||||
$resourceRepository->findOneByKind('misc')->willReturn($misc);
|
||||
|
||||
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
|
||||
$translatableStringHelper->localize(Argument::type('array'))->will(function ($arg) {
|
||||
$translatableStringHelper->localize(Argument::type('array'))->will(static function ($arg) {
|
||||
return $arg[0]['fr'];
|
||||
});
|
||||
|
||||
$person = new Person();
|
||||
$personReflection = new \ReflectionClass($person);
|
||||
$personReflection = new ReflectionClass($person);
|
||||
$personIdReflection = $personReflection->getProperty('id');
|
||||
$personIdReflection->setAccessible(true);
|
||||
$personIdReflection->setValue($person, 1);
|
||||
|
||||
$household = new Household();
|
||||
$householdReflection = new \ReflectionClass($household);
|
||||
$householdReflection = new ReflectionClass($household);
|
||||
$householdId = $householdReflection->getProperty('id');
|
||||
$householdId->setAccessible(true);
|
||||
$householdId->setValue($household, 1);
|
||||
$householdMember = (new HouseholdMember())->setPerson($person)
|
||||
->setStartDate(new \DateTimeImmutable('1 month ago'))
|
||||
;
|
||||
->setStartDate(new DateTimeImmutable('1 month ago'));
|
||||
$household->addMember($householdMember);
|
||||
|
||||
$summaryBudget = new SummaryBudget(
|
||||
|
Reference in New Issue
Block a user