Skip to content
Snippets Groups Projects
Commit e0072332 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'zf-3.x'

parents e314adf8 6fe91aed
Branches
Tags
No related merge requests found
Pipeline #5265 failed
.idea/
vendor/
......@@ -4,14 +4,15 @@
"repositories": [
{
"type": "composer",
"url": "https://dev.unicaen.fr/packagist"
"url": "https://gest.unicaen.fr/packagist"
}
],
"require": {
"unicaen/app": "^1.3",
"zendframework/zend-test": "^2.4",
"phpunit/PHPUnit": "^5.6",
"phpspec/prophecy": "^1.6"
"php": "7.3.*",
"zendframework/zend-test": "^3.0",
"phpunit/phpunit": "^5.6",
"phpspec/prophecy": "^1.6",
"doctrine/orm": "^2.6"
},
"autoload": {
"psr-0": {
......
This diff is collapsed.
......@@ -6,8 +6,6 @@ use Doctrine\ORM\EntityManager;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
use Prophecy\Prophet;
use UnicaenAuth\Service\AuthorizeService;
use UnicaenAuth\Service\UserContext as UserContextService;
use Zend\ServiceManager\ServiceManager;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
......@@ -37,13 +35,13 @@ abstract class AbstractControllerTestCase extends AbstractHttpControllerTestCase
/**
* @param string $authorizeServiceClass
* @return ObjectProphecy|AuthorizeService
* @return ObjectProphecy|UnicaenAuth\Service\AuthorizeService
*/
protected function mockAuthorizeService($authorizeServiceClass)
{
$prophet = new Prophet();
/** @var ObjectProphecy|AuthorizeService $prophecy */
/** @var ObjectProphecy|UnicaenAuth\Service\AuthorizeService $prophecy */
$prophecy = $prophet->prophesize();
$prophecy->willExtend($authorizeServiceClass);
......@@ -61,13 +59,13 @@ abstract class AbstractControllerTestCase extends AbstractHttpControllerTestCase
/**
* @param string $userContextServiceClass
* @return ObjectProphecy|UserContextService
* @return ObjectProphecy|UnicaenAuth\Service\UserContext
*/
protected function mockUserContextService($userContextServiceClass)
{
$prophet = new Prophet();
/** @var ObjectProphecy|UserContextService $prophecy */
/** @var ObjectProphecy|UnicaenAuth\Service\UserContext $prophecy */
$prophecy = $prophet->prophesize();
$prophecy->willExtend($userContextServiceClass);
......
......@@ -4,7 +4,6 @@ namespace UnicaenTest\Entity\Db;
use Doctrine\ORM\EntityManager;
use SplStack;
use UnicaenApp\Service\EntityManagerAwareTrait;
use Zend\Stdlib\ArrayUtils;
/**
......@@ -14,7 +13,10 @@ use Zend\Stdlib\ArrayUtils;
*/
abstract class AbstractEntityProvider
{
use EntityManagerAwareTrait;
/**
* @var EntityManager
*/
protected $entityManager;
/**
* @var array
......@@ -33,7 +35,7 @@ abstract class AbstractEntityProvider
*/
public function __construct(EntityManager $entityManager, array $config = [])
{
$this->setEntityManager($entityManager);
$this->entityManager = $entityManager;
$this->config = ArrayUtils::merge($this->config, $config);
......@@ -42,6 +44,24 @@ abstract class AbstractEntityProvider
$this->newEntities = new SplStack();
}
/**
* @return EntityManager
*/
public function getEntityManager()
{
return $this->entityManager;
}
/**
* @param EntityManager $entityManager
* @return AbstractEntityProvider
*/
public function setEntityManager($entityManager)
{
$this->entityManager = $entityManager;
return $this;
}
/**
* @var string
*/
......@@ -79,13 +99,13 @@ abstract class AbstractEntityProvider
// $entity->setHistoDestruction(new \DateTime());
// }
// else {
$this->getEntityManager()->remove($entity);
$this->entityManager->remove($entity);
// }
$this->newEntities->next();
}
if ($flush) {
$this->getEntityManager()->flush();
$this->entityManager->flush();
}
return $this;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment