Fix: AuthorizationHelperTest: remove deprecated and deprecation of PrepareScopeTrait

This commit is contained in:
2023-07-27 23:51:57 +02:00
parent dba1d0548e
commit 5f6e506300
3 changed files with 29 additions and 94 deletions

View File

@@ -11,6 +11,8 @@ declare(strict_types=1);
namespace Chill\MainBundle\Test;
use Chill\MainBundle\Entity\Scope;
/**
* A trait to prepare center.
*
@@ -18,25 +20,24 @@ namespace Chill\MainBundle\Test;
* and use tearDownTrait after usage.
*
* @codeCoverageIgnore
*
* @deprecated use PrepareCircleTrait instead
*/
trait PrepareScopeTrait
{
use PrepareCircleTrait;
/**
* prepare a mocked center, with and id and name given.
* prepare a mocked scope, with and id and name given.
*
* @param int $id
* @param string $name
*
* @return \Chill\MainBundle\Entity\Center
*
* @deprecated
* The name will be present in both lang `fr` and `en`.
*/
protected function prepareScope($id, $name)
protected function prepareScope(int $id, string $name): Scope
{
return $this->prepareCircle($id, $name);
$scope = new Scope();
// set the name
$scope->setName(['fr' => $name, 'en' => $name]);
$reflection = new \ReflectionClass($scope);
$idProperty = $reflection->getProperty('id');
$idProperty->setAccessible(true);
$idProperty->setValue($scope, $id);
return $scope;
}
}