mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Merge branch '3.6' of github.com:alchemy-fr/Phraseanet into 3.6
This commit is contained in:
@@ -16,6 +16,7 @@ rewrite ^/admin/typeahead/.*$ /admin/router.php last;
|
|||||||
rewrite ^/prod/records/edit/.*$ /prod/router.php last;
|
rewrite ^/prod/records/edit/.*$ /prod/router.php last;
|
||||||
rewrite ^/prod/records/movecollection/.*$ /prod/router.php last;
|
rewrite ^/prod/records/movecollection/.*$ /prod/router.php last;
|
||||||
rewrite ^/prod/bridge/.*$ /prod/router.php last;
|
rewrite ^/prod/bridge/.*$ /prod/router.php last;
|
||||||
|
rewrite ^/prod/lists/.*$ /prod/router.php last;
|
||||||
rewrite ^/prod/feeds/.*$ /prod/router.php last;
|
rewrite ^/prod/feeds/.*$ /prod/router.php last;
|
||||||
rewrite ^/prod/tooltip/.*$ /prod/router.php last;
|
rewrite ^/prod/tooltip/.*$ /prod/router.php last;
|
||||||
rewrite ^/prod/printer/.*$ /prod/router.php last;
|
rewrite ^/prod/printer/.*$ /prod/router.php last;
|
||||||
|
@@ -41,6 +41,7 @@ return call_user_func(function()
|
|||||||
$app->mount('/baskets', new Controller\Basket());
|
$app->mount('/baskets', new Controller\Basket());
|
||||||
$app->mount('/story', new Controller\Story());
|
$app->mount('/story', new Controller\Story());
|
||||||
$app->mount('/WorkZone', new Controller\WorkZone());
|
$app->mount('/WorkZone', new Controller\WorkZone());
|
||||||
|
$app->mount('/lists', new Controller\UsrLists());
|
||||||
$app->mount('/records/edit', new Controller\Edit());
|
$app->mount('/records/edit', new Controller\Edit());
|
||||||
$app->mount('/records/movecollection', new Controller\MoveCollection());
|
$app->mount('/records/movecollection', new Controller\MoveCollection());
|
||||||
$app->mount('/bridge/', new Controller\Bridge());
|
$app->mount('/bridge/', new Controller\Bridge());
|
||||||
|
@@ -15,7 +15,8 @@ use Silex\Application,
|
|||||||
Silex\ControllerProviderInterface,
|
Silex\ControllerProviderInterface,
|
||||||
Silex\ControllerCollection;
|
Silex\ControllerCollection;
|
||||||
use Alchemy\Phrasea\Helper\Record as RecordHelper,
|
use Alchemy\Phrasea\Helper\Record as RecordHelper,
|
||||||
Alchemy\Phrasea\Out\Module\PDF as PDFExport;
|
Alchemy\Phrasea\Out\Module\PDF as PDFExport,
|
||||||
|
Alchemy\Phrasea\Controller\Exception as ControllerException;
|
||||||
use Symfony\Component\HttpFoundation\Response,
|
use Symfony\Component\HttpFoundation\Response,
|
||||||
Symfony\Component\HttpFoundation\RedirectResponse;
|
Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
/**
|
/**
|
||||||
* Get all lists
|
* Get all lists
|
||||||
*/
|
*/
|
||||||
$controllers->get('/list/all/', function() use ($app)
|
$controllers->get('/list/all/', function(Application $app)
|
||||||
{
|
{
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
|
|
||||||
@@ -47,7 +48,6 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
|
|
||||||
foreach ($lists as $list)
|
foreach ($lists as $list)
|
||||||
{
|
{
|
||||||
|
|
||||||
$owners = $entries = array();
|
$owners = $entries = array();
|
||||||
|
|
||||||
foreach ($list->getOwners() as $owner)
|
foreach ($list->getOwners() as $owner)
|
||||||
@@ -63,7 +63,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($list->getUsers() as $entry)
|
foreach ($list->getEntries() as $entry)
|
||||||
{
|
{
|
||||||
$entries[] = array(
|
$entries[] = array(
|
||||||
'usr_id' => $owner->getUser()->get_id(),
|
'usr_id' => $owner->getUser()->get_id(),
|
||||||
@@ -95,18 +95,26 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
/**
|
/**
|
||||||
* Creates a list
|
* Creates a list
|
||||||
*/
|
*/
|
||||||
$controllers->post('/list/', function() use ($app)
|
$controllers->post('/list/', function(Application $app)
|
||||||
{
|
{
|
||||||
$request = $app['request'];
|
$request = $app['request'];
|
||||||
|
|
||||||
$list_name = $request->get('name');
|
$list_name = $request->get('name');
|
||||||
|
|
||||||
|
$datas = array(
|
||||||
|
'success' => false
|
||||||
|
, 'message' => sprintf(_('Unable to create list %s'), $list_name)
|
||||||
|
);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if(!$list_name)
|
||||||
|
{
|
||||||
|
throw new ControllerException(_('List name is required'));
|
||||||
|
}
|
||||||
|
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
|
|
||||||
$repository = $em->getRepository('\Entities\Usr');
|
|
||||||
|
|
||||||
$List = new \Entities\UsrList();
|
$List = new \Entities\UsrList();
|
||||||
|
|
||||||
$Owner = new \Entities\UsrListOwner();
|
$Owner = new \Entities\UsrListOwner();
|
||||||
@@ -123,15 +131,14 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'success' => true
|
'success' => true
|
||||||
, 'message' => ''
|
, 'message' => sprintf(_('List %s has been created'), $list_name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (ControllerException $e)
|
||||||
{
|
{
|
||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'success' => false
|
'success' => false
|
||||||
, 'message' => sprintf(_('Unable to create list %s'), $list_name)
|
, 'message' => $e->getMessage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +151,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
/**
|
/**
|
||||||
* Gets a list
|
* Gets a list
|
||||||
*/
|
*/
|
||||||
$controllers->get('/list/{list_id}/', function() use ($app)
|
$controllers->get('/list/{list_id}/', function(Application $app, $list_id)
|
||||||
{
|
{
|
||||||
$user = $app['Core']->getAuthenticatedUser();
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
@@ -152,7 +159,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
$repository = $em->getRepository('\Entities\UsrList');
|
$repository = $em->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($user, $list_id);
|
$list = $repository->findUserListByUserAndId($user, $list_id);
|
||||||
|
|
||||||
$owners = $entries = $lists = array();
|
$owners = $entries = $lists = array();
|
||||||
|
|
||||||
foreach ($list->getOwners() as $owner)
|
foreach ($list->getOwners() as $owner)
|
||||||
@@ -168,7 +175,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($list->getUsers() as $entry)
|
foreach ($list->getEntries() as $entry)
|
||||||
{
|
{
|
||||||
$entries[] = array(
|
$entries[] = array(
|
||||||
'usr_id' => $owner->getUser()->get_id(),
|
'usr_id' => $owner->getUser()->get_id(),
|
||||||
@@ -200,35 +207,46 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
/**
|
/**
|
||||||
* Update a list
|
* Update a list
|
||||||
*/
|
*/
|
||||||
$controllers->post('/list/{list_id}/update/', function() use ($app)
|
$controllers->post('/list/{list_id}/update/', function(Application $app, $list_id)
|
||||||
{
|
{
|
||||||
$user = $app['Core']->getAuthenticatedUser();
|
$request = $app['request'];
|
||||||
$em = $app['Core']->getEntityManager();
|
|
||||||
|
|
||||||
|
$datas = array(
|
||||||
|
'success' => false
|
||||||
|
, 'message' => _('Unable to update list')
|
||||||
|
);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$request = $app['request'];
|
$list_name = $request->get('name');
|
||||||
|
|
||||||
|
if(!$list_name)
|
||||||
|
{
|
||||||
|
throw new ControllerException(_('List name is required'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
$em = $app['Core']->getEntityManager();
|
||||||
|
|
||||||
$repository = $em->getRepository('\Entities\UsrList');
|
$repository = $em->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($user, $list_id);
|
$list = $repository->findUserListByUserAndId($user, $list_id);
|
||||||
|
|
||||||
$list->setName($request->get('name'));
|
$list->setName($list_name);
|
||||||
|
|
||||||
$em->merge($list);
|
$em->merge($list);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'success' => true
|
'success' => true
|
||||||
, 'message' => ''
|
, 'message' => _('List has been updated')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (ControllerException $e)
|
||||||
{
|
{
|
||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'success' => false
|
'success' => false
|
||||||
, 'message' => sprintf(_('Unable to create list %s'), $list_name)
|
, 'message' => $e->getMessage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,16 +259,16 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
/**
|
/**
|
||||||
* Delete a list
|
* Delete a list
|
||||||
*/
|
*/
|
||||||
$controllers->post('/list/{list_id}/delete/', function() use ($app)
|
$controllers->post('/list/{list_id}/delete/', function(Application $app, $list_id)
|
||||||
{
|
{
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
|
|
||||||
$repository = $em->getRepository('\Entities\Usr');
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$repository = $em->getRepository('\Entities\UsrList');
|
$repository = $em->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($user, $list_id);
|
$list = $repository->findUserListByUserAndId($user, $list_id);
|
||||||
|
|
||||||
$em->remove($list);
|
$em->remove($list);
|
||||||
@@ -280,13 +298,15 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
/**
|
/**
|
||||||
* Remove a usr_id from a list
|
* Remove a usr_id from a list
|
||||||
*/
|
*/
|
||||||
$controllers->post('/list/{list_id}/remove/{entry_id}/', function() use ($app)
|
$controllers->post('/list/{list_id}/remove/{entry_id}/', function(Application $app, $list_id, $entry_id)
|
||||||
{
|
{
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$repository = $em->getRepository('\Entities\UsrList');
|
$repository = $em->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($user, $list_id);
|
$list = $repository->findUserListByUserAndId($user, $list_id);
|
||||||
/* @var $list \Entities\UsrList */
|
/* @var $list \Entities\UsrList */
|
||||||
@@ -299,7 +319,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'success' => false
|
'success' => true
|
||||||
, 'message' => _('Entry removed from list')
|
, 'message' => _('Entry removed from list')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -321,7 +341,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
/**
|
/**
|
||||||
* Adds a usr_id to a list
|
* Adds a usr_id to a list
|
||||||
*/
|
*/
|
||||||
$controllers->post('/list/{list_id}/add/{usr_id}/', function() use ($app)
|
$controllers->post('/list/{list_id}/add/{usr_id}/', function(Application $app, $list_id, $usr_id)
|
||||||
{
|
{
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
|
|
||||||
@@ -345,7 +365,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'success' => false
|
'success' => true
|
||||||
, 'message' => _('Usr added to list')
|
, 'message' => _('Usr added to list')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -367,7 +387,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
/**
|
/**
|
||||||
* Share a list to a user with an optionnal role
|
* Share a list to a user with an optionnal role
|
||||||
*/
|
*/
|
||||||
$controllers->post('/list/{list_id}/share/{usr_id}/', function() use ($app)
|
$controllers->post('/list/{list_id}/share/{usr_id}/', function(Application $app, $list_id, $usr_id)
|
||||||
{
|
{
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
$user = $app['Core']->getAuthenticatedUser();
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
@@ -410,8 +430,8 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'success' => false
|
'success' => true
|
||||||
, 'message' => _('Usr added to list')
|
, 'message' => _('List shared to user')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
@@ -419,7 +439,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'success' => false
|
'success' => false
|
||||||
, 'message' => _('Unable to add usr to list')
|
, 'message' => _('Unable to share the list with the usr')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,7 +451,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
/**
|
/**
|
||||||
* UnShare a list to a user
|
* UnShare a list to a user
|
||||||
*/
|
*/
|
||||||
$controllers->post('/list/{list_id}/unshare/{owner_id}/', function() use ($app)
|
$controllers->post('/list/{list_id}/unshare/{owner_id}/', function(Application $app, $list_id, $owner_id)
|
||||||
{
|
{
|
||||||
$em = $app['Core']->getEntityManager();
|
$em = $app['Core']->getEntityManager();
|
||||||
$user = $app['Core']->getAuthenticatedUser();
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
@@ -456,7 +476,7 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'success' => false
|
'success' => true
|
||||||
, 'message' => _('Owner removed from list')
|
, 'message' => _('Owner removed from list')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -47,12 +47,12 @@ class UsrList
|
|||||||
/**
|
/**
|
||||||
* @var Entities\UsrListEntry
|
* @var Entities\UsrListEntry
|
||||||
*/
|
*/
|
||||||
private $users;
|
private $entries;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->owners = new \Doctrine\Common\Collections\ArrayCollection();
|
$this->owners = new \Doctrine\Common\Collections\ArrayCollection();
|
||||||
$this->users = new \Doctrine\Common\Collections\ArrayCollection();
|
$this->entries = new \Doctrine\Common\Collections\ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,23 +173,23 @@ class UsrList
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add users
|
* Add entry
|
||||||
*
|
*
|
||||||
* @param Entities\UsrListContent $users
|
* @param Entities\UsrListEntry $entry
|
||||||
*/
|
*/
|
||||||
public function addUsrListEntry(\Entities\UsrListEntry $users)
|
public function addUsrListEntry(\Entities\UsrListEntry $entry)
|
||||||
{
|
{
|
||||||
$this->users[] = $users;
|
$this->entries[] = $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get users
|
* Get entries
|
||||||
*
|
*
|
||||||
* @return Doctrine\Common\Collections\Collection
|
* @return Doctrine\Common\Collections\Collection
|
||||||
*/
|
*/
|
||||||
public function getUsers()
|
public function getEntries()
|
||||||
{
|
{
|
||||||
return $this->users;
|
return $this->entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -102,22 +102,22 @@ class EntitiesUsrListProxy extends \Entities\UsrList implements \Doctrine\ORM\Pr
|
|||||||
return parent::getOwner($user);
|
return parent::getOwner($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addUsrListEntry(\Entities\UsrListEntry $users)
|
public function addUsrListEntry(\Entities\UsrListEntry $entry)
|
||||||
{
|
{
|
||||||
$this->__load();
|
$this->__load();
|
||||||
return parent::addUsrListEntry($users);
|
return parent::addUsrListEntry($entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUsers()
|
public function getEntries()
|
||||||
{
|
{
|
||||||
$this->__load();
|
$this->__load();
|
||||||
return parent::getUsers();
|
return parent::getEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function __sleep()
|
public function __sleep()
|
||||||
{
|
{
|
||||||
return array('__isInitialized__', 'id', 'name', 'created', 'updated', 'owners', 'users');
|
return array('__isInitialized__', 'id', 'name', 'created', 'updated', 'owners', 'entries');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __clone()
|
public function __clone()
|
||||||
|
@@ -121,7 +121,7 @@ class ACL implements cache_cacheableInterface
|
|||||||
|
|
||||||
$this->load_hd_grant();
|
$this->load_hd_grant();
|
||||||
|
|
||||||
$key = $record->get_base_id() . '_' . $record->get_record_id();
|
$key = $record->get_serialize_key();
|
||||||
|
|
||||||
if (array_key_exists($key, $this->_rights_records_document))
|
if (array_key_exists($key, $this->_rights_records_document))
|
||||||
return true;
|
return true;
|
||||||
@@ -188,7 +188,7 @@ class ACL implements cache_cacheableInterface
|
|||||||
|
|
||||||
$this->load_hd_grant();
|
$this->load_hd_grant();
|
||||||
|
|
||||||
$key = $record->get_base_id() . '_' . $record->get_record_id();
|
$key = $record->get_serialize_key();
|
||||||
|
|
||||||
if (array_key_exists($key, $this->_rights_records_preview))
|
if (array_key_exists($key, $this->_rights_records_preview))
|
||||||
return true;
|
return true;
|
||||||
@@ -230,7 +230,7 @@ class ACL implements cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$granted = true;
|
$granted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $granted;
|
return $granted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ Entities\UsrList:
|
|||||||
targetEntity: UsrListOwner
|
targetEntity: UsrListOwner
|
||||||
mappedBy: list
|
mappedBy: list
|
||||||
cascade: ["ALL"]
|
cascade: ["ALL"]
|
||||||
users:
|
entries:
|
||||||
targetEntity: UsrListEntry
|
targetEntity: UsrListEntry
|
||||||
mappedBy: list
|
mappedBy: list
|
||||||
cascade: ["ALL"]
|
cascade: ["ALL"]
|
||||||
|
45
lib/conf.d/PhraseaFixture/UsrLists/ListAbstract.php
Normal file
45
lib/conf.d/PhraseaFixture/UsrLists/ListAbstract.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2010 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
namespace PhraseaFixture\UsrLists;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
abstract class ListAbstract extends \Doctrine\Common\DataFixtures\AbstractFixture
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
protected $list;
|
||||||
|
|
||||||
|
public function getUser()
|
||||||
|
{
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUser(\User_Adapter $user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getList()
|
||||||
|
{
|
||||||
|
return $this->list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setList(\Entities\UsrList $list)
|
||||||
|
{
|
||||||
|
$this->list = $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
53
lib/conf.d/PhraseaFixture/UsrLists/UsrList.php
Normal file
53
lib/conf.d/PhraseaFixture/UsrLists/UsrList.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2010 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PhraseaFixture\UsrLists;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityManager;
|
||||||
|
use Doctrine\Common\DataFixtures\FixtureInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
class UsrList extends ListAbstract implements FixtureInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var \Entities\UsrList
|
||||||
|
*/
|
||||||
|
public $list;
|
||||||
|
|
||||||
|
public function load($manager)
|
||||||
|
{
|
||||||
|
$list = new \Entities\UsrList();
|
||||||
|
|
||||||
|
$owner = $this->getReference('one-listowner');
|
||||||
|
|
||||||
|
$list->setName('new list');
|
||||||
|
$list->addUsrListOwner($owner);
|
||||||
|
|
||||||
|
/* @var $owner \Entities\UsrListOwner */
|
||||||
|
$owner->setList($list);
|
||||||
|
|
||||||
|
$manager->persist($list);
|
||||||
|
$manager->merge($owner);
|
||||||
|
$manager->flush();
|
||||||
|
|
||||||
|
$this->list = $list;
|
||||||
|
|
||||||
|
$this->addReference('one-list', $list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
64
lib/conf.d/PhraseaFixture/UsrLists/UsrListEntry.php
Normal file
64
lib/conf.d/PhraseaFixture/UsrLists/UsrListEntry.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2010 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PhraseaFixture\UsrLists;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityManager;
|
||||||
|
use Doctrine\Common\DataFixtures\FixtureInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
class UsrListEntry extends ListAbstract implements FixtureInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var \Entities\UsrListEntry
|
||||||
|
*/
|
||||||
|
public $entry;
|
||||||
|
|
||||||
|
public function load($manager)
|
||||||
|
{
|
||||||
|
$entry = new \Entities\UsrListEntry();
|
||||||
|
|
||||||
|
if (null === $this->user)
|
||||||
|
{
|
||||||
|
throw new \LogicException('Fill a user to store a new basket');
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = $this->getReference('one-list');
|
||||||
|
|
||||||
|
$entry->setUser($this->user);
|
||||||
|
$entry->setList($list);
|
||||||
|
|
||||||
|
/* @var $list \Entities\UsrList */
|
||||||
|
$list->addUsrListEntry($entry);
|
||||||
|
|
||||||
|
$manager->persist($entry);
|
||||||
|
$manager->flush();
|
||||||
|
|
||||||
|
$this->entry = $entry;
|
||||||
|
|
||||||
|
$this->addReference('one-entry', $entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
51
lib/conf.d/PhraseaFixture/UsrLists/UsrListOwner.php
Normal file
51
lib/conf.d/PhraseaFixture/UsrLists/UsrListOwner.php
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2010 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
namespace PhraseaFixture\UsrLists;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityManager;
|
||||||
|
use Doctrine\Common\DataFixtures\FixtureInterface;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
class UsrListOwner extends ListAbstract implements FixtureInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var \Entities\StoryWZ
|
||||||
|
*/
|
||||||
|
public $owner;
|
||||||
|
|
||||||
|
public function load($manager)
|
||||||
|
{
|
||||||
|
$owner = new \Entities\UsrListOwner();
|
||||||
|
|
||||||
|
$owner->setRole(\Entities\UsrListOwner::ROLE_ADMIN);
|
||||||
|
|
||||||
|
if (null === $this->user)
|
||||||
|
{
|
||||||
|
throw new \LogicException('Fill a user to store a new basket');
|
||||||
|
}
|
||||||
|
|
||||||
|
$owner->setUser($this->user);
|
||||||
|
|
||||||
|
$manager->persist($owner);
|
||||||
|
$manager->flush();
|
||||||
|
|
||||||
|
$this->owner = $owner;
|
||||||
|
|
||||||
|
$this->addReference('one-listowner', $owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -42,19 +42,286 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->client = $this->createClient();
|
$this->client = $this->createClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default route test
|
* Default route test
|
||||||
*/
|
*/
|
||||||
public function testRouteSlash()
|
public function testRouteSlash()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete(
|
$entry1 = $this->insertOneUsrListEntry(self::$user,self::$user);
|
||||||
'This test has not been implemented yet.'
|
$entry2 = $this->insertOneUsrListEntry(self::$user,self::$user_alt1);
|
||||||
);
|
$entry3 = $this->insertOneUsrListEntry(self::$user, self::$user);
|
||||||
|
$entry4 = $this->insertOneUsrListEntry(self::$user,self::$user_alt1);
|
||||||
|
$entry5 = $this->insertOneUsrListEntry(self::$user_alt1,self::$user_alt1);
|
||||||
|
$entry6 = $this->insertOneUsrListEntry(self::$user_alt1,self::$user_alt2);
|
||||||
|
|
||||||
|
$route = '/lists/list/all/';
|
||||||
|
|
||||||
|
$this->client->request('GET', $route);
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$datas = (array) json_decode($response->getContent());
|
||||||
|
|
||||||
|
$this->assertEquals(4, count($datas['lists']));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkList($list, $owners = true, $users = true)
|
||||||
|
{
|
||||||
|
$this->assertInstanceOf('stdClass', $list);
|
||||||
|
$this->assertObjectHasAttribute('name', $list);
|
||||||
|
$this->assertObjectHasAttribute('created', $list);
|
||||||
|
$this->assertObjectHasAttribute('updated', $list);
|
||||||
|
$this->assertObjectHasAttribute('owners', $list);
|
||||||
|
$this->assertObjectHasAttribute('users', $list);
|
||||||
|
|
||||||
|
if($owners)
|
||||||
|
$this->assertTrue(count($list->owners) > 0);
|
||||||
|
|
||||||
|
foreach($list->owners as $owner)
|
||||||
|
{
|
||||||
|
$this->checkOwner($owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($users)
|
||||||
|
$this->assertTrue(count($list->users) > 0);
|
||||||
|
|
||||||
|
foreach($list->users as $user)
|
||||||
|
{
|
||||||
|
$this->checkUser($user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPostList()
|
||||||
|
{
|
||||||
|
$route = '/lists/list/';
|
||||||
|
|
||||||
|
$this->client->request('POST', $route);
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$datas = (array) json_decode($response->getContent());
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('success', $datas);
|
||||||
|
$this->assertArrayHasKey('message', $datas);
|
||||||
|
|
||||||
|
$this->assertFalse($datas['success']);
|
||||||
|
|
||||||
|
$this->client->request('POST', $route, array('name'=>'New List'));
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$datas = (array) json_decode($response->getContent());
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('success', $datas);
|
||||||
|
$this->assertArrayHasKey('message', $datas);
|
||||||
|
|
||||||
|
$this->assertTrue($datas['success']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetList()
|
||||||
|
{
|
||||||
|
$entry = $this->insertOneUsrListEntry(self::$user,self::$user_alt1);
|
||||||
|
$list_id = $entry->getList()->getId();
|
||||||
|
|
||||||
|
$route = '/lists/list/' . $list_id . '/';
|
||||||
|
|
||||||
|
$this->client->request('GET', $route);
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$datas = (array) json_decode($response->getContent());
|
||||||
|
|
||||||
|
$this->assertTrue(is_array($datas));
|
||||||
|
$this->assertArrayhasKey('list', $datas);
|
||||||
|
$this->checkList($datas['list']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPostUpdate()
|
||||||
|
{
|
||||||
|
$entry = $this->insertOneUsrListEntry(self::$user,self::$user_alt1);
|
||||||
|
$list_id = $entry->getList()->getId();
|
||||||
|
|
||||||
|
$route = '/lists/list/' . $list_id . '/update/';
|
||||||
|
|
||||||
|
$this->client->request('POST', $route);
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$datas = (array) json_decode($response->getContent());
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('success', $datas);
|
||||||
|
$this->assertArrayHasKey('message', $datas);
|
||||||
|
|
||||||
|
$this->assertFalse($datas['success']);
|
||||||
|
|
||||||
|
|
||||||
|
$this->client->request('POST', $route, array('name'=>'New NAME'));
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$datas = (array) json_decode($response->getContent());
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('success', $datas);
|
||||||
|
$this->assertArrayHasKey('message', $datas);
|
||||||
|
|
||||||
|
$this->assertTrue($datas['success']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function testPostDelete()
|
||||||
|
{
|
||||||
|
$entry = $this->insertOneUsrListEntry(self::$user,self::$user_alt1);
|
||||||
|
$list_id = $entry->getList()->getId();
|
||||||
|
|
||||||
|
$route = '/lists/list/' . $list_id . '/delete/';
|
||||||
|
|
||||||
|
$this->client->request('POST', $route);
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$datas = (array) json_decode($response->getContent());
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('success', $datas);
|
||||||
|
$this->assertArrayHasKey('message', $datas);
|
||||||
|
|
||||||
|
$this->assertTrue($datas['success']);
|
||||||
|
|
||||||
|
$repository = self::$core->getEntityManager()->getRepository('Entities\UsrList');
|
||||||
|
|
||||||
|
$this->assertNull($repository->find($list_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPostRemoveEntry()
|
||||||
|
{
|
||||||
|
$entry = $this->insertOneUsrListEntry(self::$user,self::$user_alt1);
|
||||||
|
$list_id = $entry->getList()->getId();
|
||||||
|
$entry_id = $entry->getId();
|
||||||
|
|
||||||
|
$route = '/lists/list/' . $list_id . '/remove/' . $entry_id . '/';
|
||||||
|
|
||||||
|
$this->client->request('POST', $route);
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$datas = (array) json_decode($response->getContent());
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('success', $datas);
|
||||||
|
$this->assertArrayHasKey('message', $datas);
|
||||||
|
|
||||||
|
$this->assertTrue($datas['success']);
|
||||||
|
|
||||||
|
$repository = self::$core->getEntityManager()->getRepository('Entities\UsrListEntry');
|
||||||
|
|
||||||
|
$this->assertNull($repository->find($entry_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPostAddEntry()
|
||||||
|
{
|
||||||
|
$list = $this->insertOneUsrList(self::$user);
|
||||||
|
|
||||||
|
$this->assertEquals(0, $list->getEntries()->count());
|
||||||
|
|
||||||
|
$route = '/lists/list/' . $list->getId() . '/add/' . self::$user->get_id() . '/';
|
||||||
|
|
||||||
|
$this->client->request('POST', $route);
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$datas = (array) json_decode($response->getContent());
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('success', $datas);
|
||||||
|
$this->assertArrayHasKey('message', $datas);
|
||||||
|
|
||||||
|
$this->assertTrue($datas['success']);
|
||||||
|
|
||||||
|
$repository = self::$core->getEntityManager()->getRepository('Entities\UsrList');
|
||||||
|
|
||||||
|
$list = $repository->find($list->getId());
|
||||||
|
|
||||||
|
$this->assertEquals(1, $list->getEntries()->count());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPostShareList()
|
||||||
|
{
|
||||||
|
$list = $this->insertOneUsrList(self::$user);
|
||||||
|
|
||||||
|
$this->assertEquals(1, $list->getOwners()->count());
|
||||||
|
|
||||||
|
$route = '/lists/list/' . $list->getId() . '/share/' . self::$user_alt1->get_id() . '/';
|
||||||
|
|
||||||
|
$this->client->request('POST', $route);
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$datas = (array) json_decode($response->getContent());
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('success', $datas);
|
||||||
|
$this->assertArrayHasKey('message', $datas);
|
||||||
|
|
||||||
|
$this->assertTrue($datas['success']);
|
||||||
|
|
||||||
|
$repository = self::$core->getEntityManager()->getRepository('Entities\UsrList');
|
||||||
|
|
||||||
|
$list = $repository->find($list->getId());
|
||||||
|
|
||||||
|
$this->assertEquals(2, $list->getOwners()->count());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function checkOwner($owner)
|
||||||
|
{
|
||||||
|
$this->assertInstanceOf('stdClass', $owner);
|
||||||
|
$this->assertObjectHasAttribute('usr_id', $owner);
|
||||||
|
$this->assertObjectHasAttribute('display_name', $owner);
|
||||||
|
$this->assertObjectHasAttribute('position', $owner);
|
||||||
|
$this->assertObjectHasAttribute('job', $owner);
|
||||||
|
$this->assertObjectHasAttribute('company', $owner);
|
||||||
|
$this->assertObjectHasAttribute('email', $owner);
|
||||||
|
$this->assertObjectHasAttribute('role', $owner);
|
||||||
|
$this->assertTrue(ctype_digit($owner->role));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkUser($user)
|
||||||
|
{
|
||||||
|
$this->assertInstanceOf('stdClass', $user);
|
||||||
|
$this->assertObjectHasAttribute('usr_id', $user);
|
||||||
|
$this->assertObjectHasAttribute('display_name', $user);
|
||||||
|
$this->assertObjectHasAttribute('position', $user);
|
||||||
|
$this->assertObjectHasAttribute('job', $user);
|
||||||
|
$this->assertObjectHasAttribute('company', $user);
|
||||||
|
$this->assertObjectHasAttribute('email', $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,6 @@ use Silex\WebTestCase;
|
|||||||
use Symfony\Component\HttpKernel\Client;
|
use Symfony\Component\HttpKernel\Client;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Doctrine\Common\DataFixtures\Loader;
|
use Doctrine\Common\DataFixtures\Loader;
|
||||||
use PhraseaFixture\Basket as MyFixture;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -504,11 +503,11 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
*
|
*
|
||||||
* @param Doctrine\Common\DataFixtures\Loader $fixtureLoader
|
* @param Doctrine\Common\DataFixtures\Loader $fixtureLoader
|
||||||
*/
|
*/
|
||||||
public function insertFixtureInDatabase(Doctrine\Common\DataFixtures\Loader $fixtureLoader)
|
public function insertFixtureInDatabase(Doctrine\Common\DataFixtures\Loader $fixtureLoader, $append = true)
|
||||||
{
|
{
|
||||||
$purger = new Doctrine\Common\DataFixtures\Purger\ORMPurger();
|
$purger = new Doctrine\Common\DataFixtures\Purger\ORMPurger();
|
||||||
$executor = new Doctrine\Common\DataFixtures\Executor\ORMExecutor(self::$core->getEntityManager(), $purger);
|
$executor = new Doctrine\Common\DataFixtures\Executor\ORMExecutor(self::$core->getEntityManager(), $purger);
|
||||||
$executor->execute($fixtureLoader->getFixtures(), true);
|
$executor->execute($fixtureLoader->getFixtures(), $append);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -543,7 +542,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$basketFixture = new MyFixture\LoadOneBasket();
|
$basketFixture = new PhraseaFixture\Basket\LoadOneBasket();
|
||||||
|
|
||||||
$basketFixture->setUser(self::$user);
|
$basketFixture->setUser(self::$user);
|
||||||
|
|
||||||
@@ -559,6 +558,70 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
$this->fail('Fail load one Basket : ' . $e->getMessage());
|
$this->fail('Fail load one Basket : ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function insertOneUsrList(\User_Adapter $user)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$loader = new Loader();
|
||||||
|
|
||||||
|
$UsrOwner = new PhraseaFixture\UsrLists\UsrListOwner();
|
||||||
|
$UsrOwner->setUser($user);
|
||||||
|
|
||||||
|
$loader->addFixture($UsrOwner);
|
||||||
|
|
||||||
|
$UsrList = new PhraseaFixture\UsrLists\UsrList();
|
||||||
|
|
||||||
|
$loader->addFixture($UsrList);
|
||||||
|
|
||||||
|
|
||||||
|
$this->insertFixtureInDatabase($loader);
|
||||||
|
|
||||||
|
return $UsrList->list;
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
$this->fail('Fail load one UsrList : ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param \Entities\UsrList $UsrList
|
||||||
|
* @return \Entities\UsrListEntry
|
||||||
|
*/
|
||||||
|
protected function insertOneUsrListEntry(\User_adapter $owner, \User_adapter $user)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$loader = new Loader();
|
||||||
|
|
||||||
|
$UsrOwner = new PhraseaFixture\UsrLists\UsrListOwner();
|
||||||
|
$UsrOwner->setUser($owner);
|
||||||
|
|
||||||
|
$loader->addFixture($UsrOwner);
|
||||||
|
|
||||||
|
$UsrList = new PhraseaFixture\UsrLists\UsrList();
|
||||||
|
|
||||||
|
$loader->addFixture($UsrList);
|
||||||
|
|
||||||
|
$UsrEntry = new PhraseaFixture\UsrLists\UsrListEntry();
|
||||||
|
// $UsrEntry->setList($UsrList);
|
||||||
|
$UsrEntry->setUser($user);
|
||||||
|
|
||||||
|
$loader->addFixture($UsrEntry);
|
||||||
|
|
||||||
|
|
||||||
|
$this->insertFixtureInDatabase($loader);
|
||||||
|
|
||||||
|
return $UsrEntry->entry;
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
$this->fail('Fail load one UsrListEntry : ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert five baskets and set current authenticated user as owner
|
* Insert five baskets and set current authenticated user as owner
|
||||||
@@ -569,7 +632,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$basketFixture = new MyFixture\LoadFiveBaskets();
|
$basketFixture = new PhraseaFixture\Basket\LoadFiveBaskets();
|
||||||
|
|
||||||
$basketFixture->setUser(self::$user);
|
$basketFixture->setUser(self::$user);
|
||||||
|
|
||||||
@@ -671,7 +734,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
$em = self::$core->getEntityManager();
|
$em = self::$core->getEntityManager();
|
||||||
/* @var $em \Doctrine\ORM\EntityManager */
|
/* @var $em \Doctrine\ORM\EntityManager */
|
||||||
|
|
||||||
$basketFixture = new MyFixture\LoadOneBasketEnv();
|
$basketFixture = new PhraseaFixture\Basket\LoadOneBasketEnv();
|
||||||
|
|
||||||
$basketFixture->setUser(self::$user);
|
$basketFixture->setUser(self::$user);
|
||||||
|
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
RewriteRule ^prod/bridge/.*$ /prod/router.php [L]
|
RewriteRule ^prod/bridge/.*$ /prod/router.php [L]
|
||||||
RewriteRule ^prod/feeds/.*$ /prod/router.php [L]
|
RewriteRule ^prod/feeds/.*$ /prod/router.php [L]
|
||||||
RewriteRule ^prod/tooltip/.*$ /prod/router.php [L]
|
RewriteRule ^prod/tooltip/.*$ /prod/router.php [L]
|
||||||
|
RewriteRule ^prod/lists/.*$ /prod/router.php [L]
|
||||||
RewriteRule ^prod/baskets/.*$ /prod/router.php [L]
|
RewriteRule ^prod/baskets/.*$ /prod/router.php [L]
|
||||||
RewriteRule ^prod/push/.*$ /prod/router.php [L]
|
RewriteRule ^prod/push/.*$ /prod/router.php [L]
|
||||||
RewriteRule ^prod/printer/.*$ /prod/router.php [L]
|
RewriteRule ^prod/printer/.*$ /prod/router.php [L]
|
||||||
|
Reference in New Issue
Block a user