mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?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.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chill\MainBundle\Test;
|
|
|
|
/**
|
|
* A trait to prepare center.
|
|
*
|
|
* **Usage :** You must set up trait with `setUpTrait` before use
|
|
* and use tearDownTrait after usage.
|
|
*
|
|
* @codeCoverageIgnore
|
|
*/
|
|
trait PrepareCenterTrait
|
|
{
|
|
private $centerProphet;
|
|
|
|
/**
|
|
* prepare a mocked center, with and id and name given.
|
|
*
|
|
* @param int $id
|
|
* @param string $name
|
|
*
|
|
* @return \Chill\MainBundle\Entity\Center
|
|
*/
|
|
protected function prepareCenter($id, $name)
|
|
{
|
|
if (null === $this->centerProphet) {
|
|
$this->centerProphet = new \Prophecy\Prophet();
|
|
}
|
|
|
|
$center = $this->centerProphet->prophesize();
|
|
$center->willExtend('\Chill\MainBundle\Entity\Center');
|
|
$center->getId()->willReturn($id);
|
|
$center->getName()->willReturn($name);
|
|
|
|
return $center->reveal();
|
|
}
|
|
}
|