Commit 5a9f8c54 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Correction des dépendances ; abandon de la dépendance avec unicaen/app.

parent b34444fe
Pipeline #4509 passed with stage
in 35 seconds
......@@ -4,14 +4,14 @@
"repositories": [
{
"type": "composer",
"url": "https://dev.unicaen.fr/packagist"
"url": "https://gest.unicaen.fr/packagist"
}
],
"require": {
"unicaen/app": "dev-zf-3.x",
"zendframework/zend-test": "^3.0",
"phpunit/phpunit": "^5.6",
"phpspec/prophecy": "^1.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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment