Fixed codestyle

This commit is contained in:
Andrey
2013-06-11 18:02:38 +02:00
parent bc5b69fae4
commit dec41aeb4f
14 changed files with 176 additions and 225 deletions

View File

@@ -38,7 +38,7 @@ class Publications implements ControllerProviderInterface
$controllers->get('/list/', function(PhraseaApplication $app) { $controllers->get('/list/', function(PhraseaApplication $app) {
$feeds = $app["EM"]->getRepository("Entities\Feed")->getAllForUser( $feeds = $app['EM']->getRepository('Entities\Feed')->getAllForUser(
$app['authentication']->getUser() $app['authentication']->getUser()
); );
@@ -54,11 +54,12 @@ class Publications implements ControllerProviderInterface
$publisher->setFeed($feed); $publisher->setFeed($feed);
$publisher->setUsrId($app['authentication']->getUser()->get_id()); $publisher->setUsrId($app['authentication']->getUser()->get_id());
$publisher->setOwner(true); $publisher->setIsOwner(true);
$feed->addPublisher($publisher); $feed->addPublisher($publisher);
$feed->setTitle($request->request->get('title')); $feed->setTitle($request->request->get('title'));
$feed->setSubtitle($request->request->get('subtitle')); $feed->setSubtitle($request->request->get('subtitle'));
$feed->setIconUrl(false);
if ($request->request->get('public') == '1') { if ($request->request->get('public') == '1') {
$feed->setPublic(true); $feed->setPublic(true);
@@ -68,16 +69,16 @@ class Publications implements ControllerProviderInterface
$publisher->setFeed($feed); $publisher->setFeed($feed);
$app["EM"]->persist($feed); $app['EM']->persist($feed);
$app["EM"]->persist($publisher); $app['EM']->persist($publisher);
$app["EM"]->flush(); $app['EM']->flush();
return $app->redirectPath('admin_feeds_list'); return $app->redirectPath('admin_feeds_list');
})->bind('admin_feeds_create'); })->bind('admin_feeds_create');
$controllers->get('/feed/{id}/', function(PhraseaApplication $app, Request $request, $id) { $controllers->get('/feed/{id}/', function(PhraseaApplication $app, Request $request, $id) {
$feed = $app["EM"]->getRepository("Entities\Feed")->findOneBy(array("id" => $id)); $feed = $app["EM"]->find('Entities\Feed', $id);
return $app['twig'] return $app['twig']
->render('admin/publications/fiche.html.twig', array('feed' => $feed, 'error' => $app['request']->query->get('error'))); ->render('admin/publications/fiche.html.twig', array('feed' => $feed, 'error' => $app['request']->query->get('error')));
@@ -87,27 +88,27 @@ class Publications implements ControllerProviderInterface
$controllers->post('/feed/{id}/update/', function(PhraseaApplication $app, Request $request, $id) { $controllers->post('/feed/{id}/update/', function(PhraseaApplication $app, Request $request, $id) {
$feed = $app["EM"]->getRepository("Entities\Feed")->findOneBy(array("id" => $id)); $feed = $app["EM"]->find('Entities\Feed', $id);
try { try {
$collection = \collection::get_from_base_id($app, $request->request->get('base_id')); $collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
} catch (\Exception $e) { } catch (\Exception $e) {
$collection = null; $collection = null;
} }
if (null !== $request->request->get('title')) { if (null !== $title = $request->request->get('title')) {
$feed->setTitle($request->request->get('title')); $feed->setTitle($title);
} }
if (null !== $request->request->get('subtitle')) { if (null !== $subtitle = $request->request->get('subtitle')) {
$feed->setSubtitle($request->request->get('subtitle')); $feed->setSubtitle($subtitle);
} }
$feed->setCollection($collection); $feed->setCollection($collection);
$feed->setPublic($request->request->get('public') === '1' ? true : false); $feed->setPublic($request->request->get('public') === '1' ? true : false);
$app["EM"]->persist($feed); $app['EM']->persist($feed);
$app["EM"]->flush(); $app['EM']->flush();
return $app->redirectPath('admin_feeds_list'); return $app->redirectPath('admin_feeds_list');
})->before(function(Request $request) use ($app) { })->before(function(Request $request) use ($app) {
$feed = $app["EM"]->getRepository("Entities\Feed")->findOneBy(array("id" => $request->attributes->get('id'))); $feed = $app["EM"]->find('Entities\Feed', $request->attributes->get('id'));
if (!$feed->getOwner($app['authentication']->getUser())) { if (!$feed->getOwner($app['authentication']->getUser())) {
return $app->redirectPath('admin_feeds_feed', array('id' => $request->attributes->get('id'), 'error' => _('You are not the owner of this feed, you can not edit it'))); return $app->redirectPath('admin_feeds_feed', array('id' => $request->attributes->get('id'), 'error' => _('You are not the owner of this feed, you can not edit it')));
@@ -121,7 +122,7 @@ class Publications implements ControllerProviderInterface
'success' => false, 'success' => false,
'message' => '', 'message' => '',
); );
$feed = $app["EM"]->getRepository("Entities\Feed")->findOneBy(array("id" => $id)); $feed = $app["EM"]->find('Entities\Feed', $id);
$request = $app["request"]; $request = $app["request"];
@@ -173,7 +174,7 @@ class Publications implements ControllerProviderInterface
$datas['success'] = true; $datas['success'] = true;
} catch (\Exception $e) { } catch (\Exception $e) {
$datas['message'] = _('Unable to add file to Phraseanet'); $datas['message'] = _('Unable to add file to Phraseanet') . $e->getMessage();
} }
return $app->json($datas); return $app->json($datas);
@@ -186,19 +187,19 @@ class Publications implements ControllerProviderInterface
try { try {
$request = $app['request']; $request = $app['request'];
$user = \User_Adapter::getInstance($request->request->get('usr_id'), $app); $user = \User_Adapter::getInstance($request->request->get('usr_id'), $app);
$feed = $app["EM"]->getRepository("Entities\Feed")->findOneBy(array("id" => $id)); $feed = $app["EM"]->find('Entities\Feed', $id);
$publisher = new FeedPublisher(); $publisher = new FeedPublisher();
$publisher->setUsrId($user->get_id()); $publisher->setUsrId($user->get_id());
$publisher->setOwner(false); $publisher->setIsOwner(false);
$publisher->setFeed($feed); $publisher->setFeed($feed);
$feed->addPublisher($publisher); $feed->addPublisher($publisher);
$app["EM"]->persist($feed); $app['EM']->persist($feed);
$app["EM"]->persist($publisher); $app['EM']->persist($publisher);
$app["EM"]->flush(); $app['EM']->flush();
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
} }
@@ -212,9 +213,9 @@ class Publications implements ControllerProviderInterface
try { try {
$request = $app['request']; $request = $app['request'];
$feed = $app["EM"]->getRepository("Entities\Feed")->findOneBy(array("id" => $id)); $feed = $app["EM"]->find('Entities\Feed', $id);
$publisher = $app["EM"]->getRepository("Entities\FeedPublisher")->findOneBy(array("id" => $request->request->get('publisher_id'))); $publisher = $app["EM"]->find('Entities\FeedPublisher', $request->request->get('publisher_id'));
if (null === $publisher) { if (null === $publisher) {
throw new \Exception_Feed_PublisherNotFound(); throw new \Exception_Feed_PublisherNotFound();
} }
@@ -223,8 +224,8 @@ class Publications implements ControllerProviderInterface
if ($feed->isPublisher($user) === true && $feed->isOwner($user) === false) { if ($feed->isPublisher($user) === true && $feed->isOwner($user) === false) {
$feed->removePublisher($publisher); $feed->removePublisher($publisher);
$app["EM"]->remove($publisher); $app['EM']->remove($publisher);
$app["EM"]->flush(); $app['EM']->flush();
} }
} catch (\Exception $e) { } catch (\Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
@@ -236,13 +237,13 @@ class Publications implements ControllerProviderInterface
->assert('id', '\d+'); ->assert('id', '\d+');
$controllers->post('/feed/{id}/delete/', function(PhraseaApplication $app, $id) { $controllers->post('/feed/{id}/delete/', function(PhraseaApplication $app, $id) {
$feed = $app["EM"]->getRepository("Entities\Feed")->findOneBy(array("id" => $id)); $feed = $app["EM"]->find('Entities\Feed', $id);
$publishers = $feed->getPublishers(); $publishers = $feed->getPublishers();
foreach ($publishers as $publisher) { foreach ($publishers as $publisher) {
$app["EM"]->remove($publisher); $app['EM']->remove($publisher);
} }
$app["EM"]->remove($feed); $app['EM']->remove($feed);
$app["EM"]->flush(); $app['EM']->flush();
return $app->redirectPath('admin_feeds_list'); return $app->redirectPath('admin_feeds_list');
}) })

View File

@@ -160,7 +160,7 @@ class Lightbox implements ControllerProviderInterface
$controllers->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function(SilexApplication $app, $entry_id, $item_id) { $controllers->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function(SilexApplication $app, $entry_id, $item_id) {
$entry = $app['EM']->getRepository("Entities\FeedEntry")->find($entry_id); $entry = $app['EM']->getRepository('Entities\FeedEntry')->find($entry_id);
$item = $entry->getItems()->getItem($item_id); $item = $entry->getItems()->getItem($item_id);
if ($app['browser']->isMobile()) { if ($app['browser']->isMobile()) {
@@ -313,7 +313,7 @@ class Lightbox implements ControllerProviderInterface
return $app->redirectPath('logout'); return $app->redirectPath('logout');
} }
$feed_entry = $app['EM']->getEntity("Entities\FeedEntry")->find($entry_id); $feed_entry = $app['EM']->getEntity('Entities\FeedEntry')->find($entry_id);
$template = 'lightbox/feed.html.twig'; $template = 'lightbox/feed.html.twig';

View File

@@ -44,7 +44,7 @@ class Feed implements ControllerProviderInterface
* I got a selection of docs, which publications are available forthese docs ? * I got a selection of docs, which publications are available forthese docs ?
*/ */
$controllers->post('/requestavailable/', function(Application $app, Request $request) { $controllers->post('/requestavailable/', function(Application $app, Request $request) {
$feeds = $app["EM"]->getRepository("Entities\Feed")->getAllForUser($app['authentication']->getUser()); $feeds = $app['EM']->getRepository('Entities\Feed')->getAllForUser($app['authentication']->getUser());
$publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub')); $publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub'));
return $app['twig']->render('prod/actions/publish/publish.html.twig', array('publishing' => $publishing, 'feeds' => $feeds)); return $app['twig']->render('prod/actions/publish/publish.html.twig', array('publishing' => $publishing, 'feeds' => $feeds));
@@ -55,8 +55,8 @@ class Feed implements ControllerProviderInterface
*/ */
$controllers->post('/entry/create/', function(Application $app, Request $request) { $controllers->post('/entry/create/', function(Application $app, Request $request) {
try { try {
$feed = $app["EM"]->getRepository("Entities\Feed")->find($request->request->get('feed_id')); $feed = $app['EM']->getRepository('Entities\Feed')->find($request->request->get('feed_id'));
$publisher = $app["EM"]->getRepository("Entities\FeedPublisher")->findByUser($feed, $app['authentication']->getUser()); $publisher = $app['EM']->getRepository('Entities\FeedPublisher')->findByUser($feed, $app['authentication']->getUser());
$title = $request->request->get('title'); $title = $request->request->get('title');
$subtitle = $request->request->get('subtitle'); $subtitle = $request->request->get('subtitle');
$author_name = $request->request->get('author_name'); $author_name = $request->request->get('author_name');
@@ -79,12 +79,12 @@ class Feed implements ControllerProviderInterface
$item->setRecordId($record->get_record_id()); $item->setRecordId($record->get_record_id());
$item->setSbasId($record->get_sbas_id()); $item->setSbasId($record->get_sbas_id());
$entry->addItem($item); $entry->addItem($item);
$app["EM"]->persist($item); $app['EM']->persist($item);
} }
$app["EM"]->persist($entry); $app['EM']->persist($entry);
$app["EM"]->persist($feed); $app['EM']->persist($feed);
$app["EM"]->flush(); $app['EM']->flush();
$app['events-manager']->trigger('__FEED_ENTRY_CREATE__', array('entry_id' => $entry->getId()), $entry); $app['events-manager']->trigger('__FEED_ENTRY_CREATE__', array('entry_id' => $entry->getId()), $entry);
@@ -101,13 +101,13 @@ class Feed implements ControllerProviderInterface
}); });
$controllers->get('/entry/{id}/edit/', function(Application $app, Request $request, $id) { $controllers->get('/entry/{id}/edit/', function(Application $app, Request $request, $id) {
$entry = $app["EM"]->getRepository("Entities\FeedEntry")->find($id); $entry = $app['EM']->getRepository('Entities\FeedEntry')->find($id);
if (!$entry->isPublisher($app['authentication']->getUser())) { if (!$entry->isPublisher($app['authentication']->getUser())) {
throw new AccessDeniedHttpException(); throw new AccessDeniedHttpException();
} }
$feeds = $app["EM"]->getRepository("Entities\Feed")->findAll(); $feeds = $app['EM']->getRepository('Entities\Feed')->findAll();
$datas = $app['twig']->render('prod/actions/publish/publish_edit.html.twig', array('entry' => $entry, 'feeds' => $feeds)); $datas = $app['twig']->render('prod/actions/publish/publish_edit.html.twig', array('entry' => $entry, 'feeds' => $feeds));
@@ -121,75 +121,62 @@ class Feed implements ControllerProviderInterface
$controllers->post('/entry/{id}/update/', function(Application $app, Request $request, $id) { $controllers->post('/entry/{id}/update/', function(Application $app, Request $request, $id) {
$datas = array('error' => true, 'message' => '', 'datas' => ''); $datas = array('error' => true, 'message' => '', 'datas' => '');
try { $entry = $app['EM']->getRepository('Entities\FeedEntry')->find($id);
$entry = $app["EM"]->getRepository("Entities\FeedEntry")->find($id);
if (null === $entry) { if (null === $entry) {
throw new NotFoundHttpException(); $app->abort(404, 'Entry not found');
}
if (!$entry->isPublisher($app['authentication']->getUser())) {
throw new AccessDeniedHttpException();
}
$title = $request->request->get('title');
$subtitle = $request->request->get('subtitle');
$author_name = $request->request->get('author_name');
$author_mail = $request->request->get('author_mail');
$entry->setAuthorEmail($author_mail)
->setAuthorName($author_name)
->setTitle($title)
->setSubtitle($subtitle);
$current_feed_id = $entry->getFeed()->getId();
$new_feed_id = $request->request->get('feed_id', $current_feed_id);
if ($current_feed_id != $new_feed_id) {
try {
$new_feed = $app["EM"]->getRepository("Entities\Feed")->loadWithUser($app, $app['authentication']->getUser(), $new_feed_id);
} catch (NotFoundHttpException $e) {
throw new AccessDeniedHttpException('You have no access to this feed');
}
if ($new_feed === null) {
throw new NotFoundHttpException();
}
if (!$new_feed->isPublisher($app['authentication']->getUser())) {
throw new \Exception_Forbidden('You are not publisher of this feed');
}
$entry->setFeed($new_feed);
}
$items = explode(';', $request->request->get('sorted_lst'));
foreach ($items as $item_sort) {
$item_sort_datas = explode('_', $item_sort);
if (count($item_sort_datas) != 2) {
continue;
}
$item = new FeedItem($entry, $item_sort_datas[0]);
$item->setEntry($entry);
$entry->addItem($item);
$item->setOrd($item_sort_datas[1]);
$app["EM"]->persist($item);
}
$app["EM"]->persist($entry);
$app["EM"]->flush();
$entry = $app['twig']->render('prod/feeds/entry.html.twig', array('entry' => $entry));
$datas = array('error' => false, 'message' => 'succes', 'datas' => $entry);
} catch (\Exception_Feed_EntryNotFound $e) {
$datas['message'] = _('Feed entry not found');
} catch (NotFoundHttpException $e) {
$datas['message'] = _('Feed not found');
} catch (AccessDeniedHttpException $e) {
$datas['message'] = _('You are not authorized to access this feed');
} catch (\Exception $e) {
$datas['message'] = $e->getMessage();
} }
if (!$entry->isPublisher($app['authentication']->getUser())) {
$app->abort(403, 'Unathorized action');
}
$title = $request->request->get('title');
$subtitle = $request->request->get('subtitle');
$author_name = $request->request->get('author_name');
$author_mail = $request->request->get('author_mail');
$entry->setAuthorEmail($author_mail)
->setAuthorName($author_name)
->setTitle($title)
->setSubtitle($subtitle);
$current_feed_id = $entry->getFeed()->getId();
$new_feed_id = $request->request->get('feed_id', $current_feed_id);
if ($current_feed_id != $new_feed_id) {
$new_feed = $app['EM']->getRepository('Entities\Feed')->find($new_feed_id);
if ($new_feed === null) {
$app->abort(404, 'Feed not found');
}
if (!$new_feed->isPublisher($app['authentication']->getUser())) {
$app->abort(403, 'You are not publisher of this feed');
}
$entry->setFeed($new_feed);
}
$items = explode(';', $request->request->get('sorted_lst'));
foreach ($items as $item_sort) {
$item_sort_datas = explode('_', $item_sort);
if (count($item_sort_datas) != 2) {
continue;
}
$item = new FeedItem($entry, $item_sort_datas[0]);
$item->setEntry($entry);
$entry->addItem($item);
$item->setOrd($item_sort_datas[1]);
$app['EM']->persist($item);
}
$app['EM']->persist($entry);
$app['EM']->flush();
$entry = $app['twig']->render('prod/feeds/entry.html.twig', array('entry' => $entry));
$datas = array('error' => false, 'message' => 'succes', 'datas' => $entry);
return $app->json($datas); return $app->json($datas);
}) })
@@ -200,25 +187,20 @@ class Feed implements ControllerProviderInterface
$controllers->post('/entry/{id}/delete/', function(Application $app, Request $request, $id) { $controllers->post('/entry/{id}/delete/', function(Application $app, Request $request, $id) {
$datas = array('error' => true, 'message' => ''); $datas = array('error' => true, 'message' => '');
try {
$entry = $app["EM"]->getRepository("Entities\FeedEntry")->find($id); $entry = $app['EM']->getRepository('Entities\FeedEntry')->find($id);
if (null === $entry) { if (null === $entry) {
throw new NotFoundHttpException(); $app->abort(404, 'Entry not found');
}
if (!$entry->isPublisher($app['authentication']->getUser()) && $entry->getFeed()->isOwner($app['authentication']->getUser()) === false) {
throw new AccessDeniedHttpException(_('Action Forbidden : You are not the publisher'));
}
$app["EM"]->remove($entry);
$app["EM"]->flush();
$datas = array('error' => false, 'message' => 'succes');
} catch (NotFoundHttpException $e) {
$datas['message'] = _('Feed entry not found');
} catch (\Exception $e) {
$datas['message'] = $e->getMessage();
} }
if (!$entry->isPublisher($app['authentication']->getUser()) && $entry->getFeed()->isOwner($app['authentication']->getUser()) === false) {
$app->abort(403, _('Action Forbidden : You are not the publisher'));
}
$app['EM']->remove($entry);
$app['EM']->flush();
$datas = array('error' => false, 'message' => 'succes');
return $app->json($datas); return $app->json($datas);
}) })
@@ -232,12 +214,12 @@ class Feed implements ControllerProviderInterface
$page = (int) $request->query->get('page'); $page = (int) $request->query->get('page');
$page = $page > 0 ? $page : 1; $page = $page > 0 ? $page : 1;
$feeds = $app["EM"]->getRepository("Entities\Feed")->findAll(); $feeds = $app['EM']->getRepository('Entities\Feed')->findAll();
$datas = $app['twig']->render('prod/feeds/feeds.html.twig' $datas = $app['twig']->render('prod/feeds/feeds.html.twig'
, array( , array(
'feeds' => $feeds 'feeds' => $feeds
, 'feed' => new Aggregate($app["EM"], $feeds) , 'feed' => new Aggregate($app['EM'], $feeds)
, 'page' => $page , 'page' => $page
) )
); );
@@ -249,8 +231,8 @@ class Feed implements ControllerProviderInterface
$page = (int) $request->query->get('page'); $page = (int) $request->query->get('page');
$page = $page > 0 ? $page : 1; $page = $page > 0 ? $page : 1;
$feed = $app["EM"]->getRepository("Entities\Feed")->loadWithUser($app, $app['authentication']->getUser(), $id); $feed = $app['EM']->getRepository('Entities\Feed')->loadWithUser($app, $app['authentication']->getUser(), $id);
$feeds = $app["EM"]->getRepository("Entities\Feed")->findAll(); $feeds = $app['EM']->getRepository('Entities\Feed')->findAll();
$datas = $app['twig']->render('prod/feeds/feeds.html.twig', array('feed' => $feed, 'feeds' => $feeds, 'page' => $page)); $datas = $app['twig']->render('prod/feeds/feeds.html.twig', array('feed' => $feed, 'feeds' => $feeds, 'page' => $page));
@@ -262,9 +244,9 @@ class Feed implements ControllerProviderInterface
$controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) { $controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) {
$renew = ($request->query->get('renew') === 'true'); $renew = ($request->query->get('renew') === 'true');
$feeds = $app["EM"]->getRepository("Entities\Feed")->findAll(); $feeds = $app['EM']->getRepository('Entities\Feed')->findAll();
$aggregate = new Aggregate($app["EM"], $feeds); $aggregate = new Aggregate($app['EM'], $feeds);
$link = $app['feed.aggregate-link-generator']->generate($aggregate, $app['authentication']->getUser(), AggregateLinkGenerator::FORMAT_RSS, null, $renew); $link = $app['feed.aggregate-link-generator']->generate($aggregate, $app['authentication']->getUser(), AggregateLinkGenerator::FORMAT_RSS, null, $renew);
@@ -281,7 +263,7 @@ class Feed implements ControllerProviderInterface
$controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) { $controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) {
$renew = ($request->query->get('renew') === 'true'); $renew = ($request->query->get('renew') === 'true');
$feed = $app["EM"]->getRepository("Entities\Feed")->loadWithUser($app, $app['authentication']->getUser(), $id); $feed = $app['EM']->getRepository('Entities\Feed')->loadWithUser($app, $app['authentication']->getUser(), $id);
$link = $app['feed.user-link-generator']->generate($feed, $app['authentication']->getUser(), FeedLinkGenerator::FORMAT_RSS, null, $renew); $link = $app['feed.user-link-generator']->generate($feed, $app['authentication']->getUser(), FeedLinkGenerator::FORMAT_RSS, null, $renew);

View File

@@ -73,7 +73,7 @@ class Root implements ControllerProviderInterface
$cssfile = '000000'; $cssfile = '000000';
} }
$feeds = $app["EM"]->getRepository("Entities\Feed")->getAllForUser($app['authentication']->getUser()); $feeds = $app['EM']->getRepository('Entities\Feed')->getAllForUser($app['authentication']->getUser());
$thjslist = ""; $thjslist = "";

View File

@@ -30,7 +30,7 @@ class RSSFeeds implements ControllerProviderInterface
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->get('/feed/{id}/{format}/', function(Application $app, $id, $format) { $controllers->get('/feed/{id}/{format}/', function(Application $app, $id, $format) {
$feed = $app["EM"]->getRepository("Entities\Feed")->find($id); $feed = $app['EM']->getRepository('Entities\Feed')->find($id);
if (!$feed) { if (!$feed) {
return new Response('Not Found', 404); return new Response('Not Found', 404);
@@ -52,7 +52,7 @@ class RSSFeeds implements ControllerProviderInterface
->assert('format', '(rss|atom)'); ->assert('format', '(rss|atom)');
$controllers->get('/userfeed/{token}/{id}/{format}/', function(Application $app, $token, $id, $format) { $controllers->get('/userfeed/{token}/{id}/{format}/', function(Application $app, $token, $id, $format) {
$token = $app["EM"]->getRepository("Entities\FeedToken")->findOneBy(array("id" => $id)); $token = $app["EM"]->find('Entities\FeedToken', $id);
$feed = $token->getFeed(); $feed = $token->getFeed();
$usrId = $token->getUsrId(); $usrId = $token->getUsrId();
@@ -70,14 +70,14 @@ class RSSFeeds implements ControllerProviderInterface
->assert('format', '(rss|atom)'); ->assert('format', '(rss|atom)');
$controllers->get('/userfeed/aggregated/{token}/{format}/', function(Application $app, $token, $format) { $controllers->get('/userfeed/aggregated/{token}/{format}/', function(Application $app, $token, $format) {
$token = $app["EM"]->getRepository("Entities\AggregateToken")->findOneBy(array("value" => $token)); $token = $app['EM']->getRepository('Entities\AggregateToken')->findOneBy(array("value" => $token));
$usrId = $token->getUsrId(); $usrId = $token->getUsrId();
$user = \User_Adapter::getInstance($usrId, $app); $user = \User_Adapter::getInstance($usrId, $app);
$feeds = $app["EM"]->getRepository('Entities\Feed')->getAllForUser($user); $feeds = $app['EM']->getRepository('Entities\Feed')->getAllForUser($user);
$aggregate = new Aggregate($app["EM"], $feeds, $token); $aggregate = new Aggregate($app['EM'], $feeds, $token);
$request = $app['request']; $request = $app['request'];
@@ -90,8 +90,8 @@ class RSSFeeds implements ControllerProviderInterface
->assert('format', '(rss|atom)'); ->assert('format', '(rss|atom)');
$controllers->get('/aggregated/{format}/', function(Application $app, $format) { $controllers->get('/aggregated/{format}/', function(Application $app, $format) {
$feeds = $app["EM"]->getRepository("Entities\Feed")->findAllPublic(); $feeds = $app['EM']->getRepository('Entities\Feed')->findAllPublic();
$feed = new Aggregate($app["EM"], $feeds); $feed = new Aggregate($app['EM'], $feeds);
$request = $app['request']; $request = $app['request'];
$page = (int) $request->query->get('page'); $page = (int) $request->query->get('page');
@@ -103,8 +103,8 @@ class RSSFeeds implements ControllerProviderInterface
->assert('format', '(rss|atom)'); ->assert('format', '(rss|atom)');
$controllers->get('/cooliris/', function(Application $app) { $controllers->get('/cooliris/', function(Application $app) {
$feeds = $app["EM"]->getRepository("Entities\Feed")->findAllPublic(); $feeds = $app['EM']->getRepository('Entities\Feed')->findAllPublic();
$feed = new Aggregate($app["EM"], $feeds); $feed = new Aggregate($app['EM'], $feeds);
$request = $app['request']; $request = $app['request'];
$page = (int) $request->query->get('page'); $page = (int) $request->query->get('page');

View File

@@ -145,7 +145,7 @@ class Aggregate implements FeedInterface
public function getCountTotalEntries() public function getCountTotalEntries()
{ {
if (count($this->feeds) > 0) { if (count($this->feeds) > 0) {
return count($this->em->getRepository("Entities\FeedEntry")->findByFeeds($this->feeds)); return count($this->em->getRepository('Entities\FeedEntry')->findByFeeds($this->feeds));
} }
return 0; return 0;
} }

View File

@@ -22,7 +22,7 @@ class Feed implements FeedInterface
private $public = false; private $public = false;
/** /**
* @var string * @var boolean
*/ */
private $icon_url = false; private $icon_url = false;
@@ -111,7 +111,7 @@ class Feed implements FeedInterface
/** /**
* Set icon_url * Set icon_url
* *
* @param string $iconUrl * @param boolean $iconUrl
* @return Feed * @return Feed
*/ */
public function setIconUrl($iconUrl) public function setIconUrl($iconUrl)
@@ -124,15 +124,11 @@ class Feed implements FeedInterface
/** /**
* Get icon_url * Get icon_url
* *
* @return string * @return boolean
*/ */
public function getIconUrl() public function getIconUrl()
{ {
if (!$this->icon_url) { return $this->icon_url;
return '/skins/icons/rss32.gif';
}
return '/www/custom/feed_' . $this->getId() . '.jpg';
} }
/** /**
@@ -253,7 +249,7 @@ class Feed implements FeedInterface
public function getOwner() public function getOwner()
{ {
foreach ($this->getPublishers() as $publisher) { foreach ($this->getPublishers() as $publisher) {
if ($publisher->getOwner()) { if ($publisher->isOwner()) {
return $publisher; return $publisher;
} }
} }

View File

@@ -75,7 +75,7 @@ class FeedPublisher
* @param boolean $owner * @param boolean $owner
* @return FeedPublisher * @return FeedPublisher
*/ */
public function setOwner($owner) public function setIsOwner($owner)
{ {
$this->owner = $owner; $this->owner = $owner;
@@ -87,7 +87,7 @@ class FeedPublisher
* *
* @return boolean * @return boolean
*/ */
public function getOwner() public function isOwner()
{ {
return $this->owner; return $this->owner;
} }
@@ -115,6 +115,12 @@ class FeedPublisher
return $this->feed; return $this->feed;
} }
/**
* Get user
*
* @return \User_Adapter
*/
public function getUser(Application $app) public function getUser(Application $app)
{ {
$user = \User_Adapter::getInstance($this->getUsrId(), $app); $user = \User_Adapter::getInstance($this->getUsrId(), $app);

View File

@@ -13,7 +13,7 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
$crawler = self::$DI['client']->request('GET', '/admin/publications/list/'); $crawler = self::$DI['client']->request('GET', '/admin/publications/list/');
$pageContent = self::$DI['client']->getResponse()->getContent(); $pageContent = self::$DI['client']->getResponse()->getContent();
$this->assertTrue(self::$DI['client']->getResponse()->isOk()); $this->assertTrue(self::$DI['client']->getResponse()->isOk());
$feeds = self::$DI['app']['EM']->getRepository("Entities\Feed")->getAllForUser(self::$DI['user']); $feeds = self::$DI['app']['EM']->getRepository('Entities\Feed')->getAllForUser(self::$DI['user']);
foreach ($feeds as $feed) { foreach ($feeds as $feed) {
$this->assertRegExp('/\/admin\/publications\/feed\/' . $feed->getId() . '/', $pageContent); $this->assertRegExp('/\/admin\/publications\/feed\/' . $feed->getId() . '/', $pageContent);
@@ -26,14 +26,14 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
public function testCreate() public function testCreate()
{ {
$feeds = self::$DI['app']['EM']->getRepository("Entities\Feed")->getAllForUser(self::$DI['user']); $feeds = self::$DI['app']['EM']->getRepository('Entities\Feed')->getAllForUser(self::$DI['user']);
$count = sizeof($feeds); $count = sizeof($feeds);
$crawler = self::$DI['client']->request('POST', '/admin/publications/create/', array("title" => "hello", "subtitle" => "coucou", "base_id" => self::$DI['collection']->get_base_id())); $crawler = self::$DI['client']->request('POST', '/admin/publications/create/', array("title" => "hello", "subtitle" => "coucou", "base_id" => self::$DI['collection']->get_base_id()));
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect('/admin/publications/list/')); $this->assertTrue(self::$DI['client']->getResponse()->isRedirect('/admin/publications/list/'));
$feeds = self::$DI['app']['EM']->getRepository("Entities\Feed")->getAllForUser(self::$DI['user']); $feeds = self::$DI['app']['EM']->getRepository('Entities\Feed')->getAllForUser(self::$DI['user']);
$count_after = sizeof($feeds); $count_after = sizeof($feeds);
$this->assertGreaterThan($count, $count_after); $this->assertGreaterThan($count, $count_after);
} }
@@ -58,7 +58,7 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
, 'public' => '1' , 'public' => '1'
)); ));
$feed = self::$DI['app']['EM']->getRepository("Entities\Feed")->findOneBy(array('id' => $feed->getId())); $feed = self::$DI['app']['EM']->find('Entities\Feed', $feed->getId());
$this->assertTrue( $this->assertTrue(
strpos( strpos(
@@ -89,7 +89,7 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
, '/admin/publications/list/' , '/admin/publications/list/'
) === 0); ) === 0);
$feed = self::$DI['app']['EM']->getRepository("Entities\Feed")->findOneBy(array('id' => $feed->getId())); $feed = self::$DI['app']['EM']->find('Entities\Feed', $feed->getId());
$collection = $feed->getCollection(self::$DI['app']); $collection = $feed->getCollection(self::$DI['app']);
@@ -213,7 +213,7 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();
$this->assertTrue($response->isRedirect()); $this->assertTrue($response->isRedirect());
$feed = self::$DI['app']['EM']->getRepository("Entities\Feed")->findOneBy(array('id' => $feed->getId())); $feed = self::$DI['app']['EM']->find('Entities\Feed', $feed->getId());
$publishers = $feed->getPublishers(); $publishers = $feed->getPublishers();
$this->assertTrue($feed->isPublisher(self::$DI['user_alt1'])); $this->assertTrue($feed->isPublisher(self::$DI['user_alt1']));
@@ -230,7 +230,7 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
self::$DI['client']->request("POST", "/admin/publications/feed/" . $feed->getId() . "/addpublisher/"); self::$DI['client']->request("POST", "/admin/publications/feed/" . $feed->getId() . "/addpublisher/");
$feed = self::$DI['app']['EM']->getRepository("Entities\Feed")->findOneBy(array('id' => $feed->getId())); $feed = self::$DI['app']['EM']->find('Entities\Feed', $feed->getId());
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();
$this->assertTrue($response->isRedirect()); $this->assertTrue($response->isRedirect());
$this->assertTrue( $this->assertTrue(
@@ -251,7 +251,7 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();
$this->assertTrue($response->isRedirect()); $this->assertTrue($response->isRedirect());
$feed = self::$DI['app']['EM']->getRepository("Entities\Feed")->findOneBy(array('id' => $feed->getId())); $feed = self::$DI['app']['EM']->find('Entities\Feed', $feed->getId());
$publishers = $feed->getPublishers(); $publishers = $feed->getPublishers();
$this->assertFalse(isset($publishers[self::$DI['user_alt1']->get_id()])); $this->assertFalse(isset($publishers[self::$DI['user_alt1']->get_id()]));
@@ -271,7 +271,7 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();
$this->assertTrue($response->isRedirect()); $this->assertTrue($response->isRedirect());
$feed = self::$DI['app']['EM']->getRepository("Entities\Feed")->findOneBy(array('id' => $feed->getId())); $feed = self::$DI['app']['EM']->find('Entities\Feed', $feed->getId());
$this->assertTrue( $this->assertTrue(
strpos( strpos(
@@ -289,7 +289,7 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();
$this->assertTrue($response->isRedirect()); $this->assertTrue($response->isRedirect());
$feed = self::$DI['app']['EM']->getRepository("Entities\Feed")->findOneBy(array('id' => $feed->getId())); $feed = self::$DI['app']['EM']->find('Entities\Feed', $feed->getId());
if (null !== $feed) { if (null !== $feed) {
$this->fail("fail deleting feed"); $this->fail("fail deleting feed");
} }

View File

@@ -5,7 +5,7 @@ namespace Alchemy\Tests\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Symfony\Component\CssSelector\CssSelector; use Symfony\Component\CssSelector\CssSelector;
class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract class FeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
/** /**
* *
@@ -55,7 +55,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = self::$DI['client']->request('POST', '/prod/feeds/requestavailable/'); $crawler = self::$DI['client']->request('POST', '/prod/feeds/requestavailable/');
$this->assertTrue(self::$DI['client']->getResponse()->isOk()); $this->assertTrue(self::$DI['client']->getResponse()->isOk());
$feeds = self::$DI['app']["EM"]->getRepository("\Entities\Feed")->getAllForUser(self::$DI['user']); $feeds = self::$DI['app']['EM']->getRepository('Entities\Feed')->getAllForUser(self::$DI['user']);
foreach ($feeds as $one_feed) { foreach ($feeds as $one_feed) {
if ($one_feed->isPublisher(self::$DI['user'])) { if ($one_feed->isPublisher(self::$DI['user'])) {
$this->assertEquals(1, $crawler->filterXPath("//input[@value='" . $one_feed->getId() . "']")->count()); $this->assertEquals(1, $crawler->filterXPath("//input[@value='" . $one_feed->getId() . "']")->count());
@@ -183,17 +183,17 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue(is_string($pageContent->datas)); $this->assertTrue(is_string($pageContent->datas));
$this->assertRegExp("/entry_" . $entry->getId() . "/", $pageContent->datas); $this->assertRegExp("/entry_" . $entry->getId() . "/", $pageContent->datas);
$retrievedentry = self::$DI['app']["EM"]->getRepository("\Entities\FeedEntry")->find($entry->getId()); $retrievedentry = self::$DI['app']['EM']->getRepository('Entities\FeedEntry')->find($entry->getId());
$this->assertEquals($newfeed->getId(), $retrievedentry->getFeed()->getId()); $this->assertEquals($newfeed->getId(), $retrievedentry->getFeed()->getId());
} }
public function testEntryUpdateChangeFeedNoAccess() public function testEntryUpdateChangeFeedNoAccess()
{ {
$entry = $this->insertOneFeedEntry(self::$DI['user']); $entry = $this->insertOneFeedEntry(self::$DI['user']);
$newfeed = $this->insertOneFeed(self::$DI['user'], "test2"); $newfeed = $this->insertOneFeed(self::$DI['user_alt1'], "test2");
$newfeed->setCollection(self::$DI['collection_no_access']); $newfeed->setCollection(self::$DI['collection_no_access']);
self::$DI['app']["EM"]->persist($newfeed); self::$DI['app']['EM']->persist($newfeed);
self::$DI['app']["EM"]->flush(); self::$DI['app']['EM']->flush();
$params = array( $params = array(
"feed_id" => $newfeed->getId(), "feed_id" => $newfeed->getId(),
@@ -205,12 +205,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
); );
$crawler = self::$DI['client']->request('POST', '/prod/feeds/entry/' . $entry->getId() . '/update/', $params); $crawler = self::$DI['client']->request('POST', '/prod/feeds/entry/' . $entry->getId() . '/update/', $params);
$this->assertTrue(self::$DI['client']->getResponse()->isOk()); $this->assertEquals(403, self::$DI['client']->getResponse()->getStatusCode());
$this->assertEquals("application/json", self::$DI['client']->getResponse()->headers->get("content-type"));
$pageContent = json_decode(self::$DI['client']->getResponse()->getContent());
$this->assertTrue(is_object($pageContent));
$this->assertTrue($pageContent->error);
$this->assertTrue(is_string($pageContent->message));
} }
public function testEntryUpdateChangeFeedInvalidFeed() public function testEntryUpdateChangeFeedInvalidFeed()
@@ -227,12 +222,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
); );
$crawler = self::$DI['client']->request('POST', '/prod/feeds/entry/' . $entry->getId() . '/update/', $params); $crawler = self::$DI['client']->request('POST', '/prod/feeds/entry/' . $entry->getId() . '/update/', $params);
$this->assertTrue(self::$DI['client']->getResponse()->isOk()); $this->assertEquals(404, self::$DI['client']->getResponse()->getStatusCode());
$this->assertEquals("application/json", self::$DI['client']->getResponse()->headers->get("content-type"));
$pageContent = json_decode(self::$DI['client']->getResponse()->getContent());
$this->assertTrue(is_object($pageContent));
$this->assertTrue($pageContent->error);
$this->assertTrue(is_string($pageContent->message));
} }
public function testEntryUpdateNotFound() public function testEntryUpdateNotFound()
@@ -253,11 +243,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$pageContent = json_decode($response->getContent()); $pageContent = json_decode($response->getContent());
$this->assertTrue($response->isOk()); $this->assertEquals(404, self::$DI['client']->getResponse()->getStatusCode());
$this->assertEquals("application/json", $response->headers->get("content-type"));
$this->assertTrue(is_object($pageContent));
$this->assertTrue($pageContent->error);
$this->assertTrue(is_string($pageContent->message));
} }
public function testEntryUpdateFailed() public function testEntryUpdateFailed()
@@ -277,13 +263,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk()); $this->assertEquals(404, self::$DI['client']->getResponse()->getStatusCode());
$pageContent = json_decode($response->getContent());
$this->assertEquals("application/json", $response->headers->get("content-type"));
$this->assertTrue(is_object($pageContent));
$this->assertTrue($pageContent->error);
$this->assertTrue(is_string($pageContent->message));
} }
public function testEntryUpdateUnauthorized() public function testEntryUpdateUnauthorized()
@@ -307,13 +287,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk()); $this->assertEquals(403, self::$DI['client']->getResponse()->getStatusCode());;
$pageContent = json_decode($response->getContent());
$this->assertEquals("application/json", $response->headers->get("content-type"));
$this->assertTrue(is_object($pageContent));
$this->assertTrue($pageContent->error);
$this->assertTrue(is_string($pageContent->message));
} }
public function testDelete() public function testDelete()
@@ -332,7 +306,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue(is_string($pageContent->message)); $this->assertTrue(is_string($pageContent->message));
try { try {
self::$DI["app"]["EM"]->getRepository("\Entities\FeedEntry")->find($entry->getId()); self::$DI["app"]['EM']->getRepository('Entities\FeedEntry')->find($entry->getId());
$this->fail("Failed to delete entry"); $this->fail("Failed to delete entry");
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -348,11 +322,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$pageContent = json_decode(self::$DI['client']->getResponse()->getContent()); $pageContent = json_decode(self::$DI['client']->getResponse()->getContent());
$this->assertTrue($response->isOk()); $this->assertEquals(404, self::$DI['client']->getResponse()->getStatusCode());
$this->assertEquals("application/json", $response->headers->get("content-type"));
$this->assertTrue(is_object($pageContent));
$this->assertTrue($pageContent->error);
$this->assertTrue(is_string($pageContent->message));
} }
public function testDeleteUnauthorized() public function testDeleteUnauthorized()
@@ -368,11 +338,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$pageContent = json_decode(self::$DI['client']->getResponse()->getContent()); $pageContent = json_decode(self::$DI['client']->getResponse()->getContent());
$this->assertTrue($response->isOk()); $this->assertEquals(403, self::$DI['client']->getResponse()->getStatusCode());
$this->assertEquals("application/json", $response->headers->get("content-type"));
$this->assertTrue(is_object($pageContent));
$this->assertTrue($pageContent->error);
$this->assertTrue(is_string($pageContent->message));
} }
public function testRoot() public function testRoot()
@@ -384,7 +350,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue(self::$DI['client']->getResponse()->isOk()); $this->assertTrue(self::$DI['client']->getResponse()->isOk());
$feeds = self::$DI['app']["EM"]->getRepository("\Entities\Feed")->getAllForUser(self::$DI['user']); $feeds = self::$DI['app']['EM']->getRepository('Entities\Feed')->getAllForUser(self::$DI['user']);
foreach ($feeds as $one_feed) { foreach ($feeds as $one_feed) {
@@ -404,7 +370,7 @@ class ControllerFeedTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$feed = $this->insertOneFeed(self::$DI['user']); $feed = $this->insertOneFeed(self::$DI['user']);
$feeds = self::$DI['app']["EM"]->getRepository("\Entities\Feed")->getAllForUser(self::$DI['user']); $feeds = self::$DI['app']['EM']->getRepository('Entities\Feed')->getAllForUser(self::$DI['user']);
$crawler = self::$DI['client']->request('GET', '/prod/feeds/feed/' . $feed->getId() . "/"); $crawler = self::$DI['client']->request('GET', '/prod/feeds/feed/' . $feed->getId() . "/");
$pageContent = self::$DI['client']->getResponse()->getContent(); $pageContent = self::$DI['client']->getResponse()->getContent();

View File

@@ -175,7 +175,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->insertOneFeed(self::$DI['user'], "test1", true); $this->insertOneFeed(self::$DI['user'], "test1", true);
$this->insertOneFeed(self::$DI['user'], "test2", true); $this->insertOneFeed(self::$DI['user'], "test2", true);
$all_feeds = self::$DI['app']['EM']->getRepository("Entities\Feed")->findAllPublic(); $all_feeds = self::$DI['app']['EM']->getRepository('Entities\Feed')->findAllPublic();
foreach ($all_feeds as $feed) { foreach ($all_feeds as $feed) {
$this->assertTrue($feed->getPublic()); $this->assertTrue($feed->getPublic());
@@ -192,7 +192,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->insertOneFeed(self::$DI['user'], "test1", true); $this->insertOneFeed(self::$DI['user'], "test1", true);
$this->insertOneFeed(self::$DI['user'], "test2", true); $this->insertOneFeed(self::$DI['user'], "test2", true);
$all_feeds = self::$DI['app']['EM']->getRepository("Entities\Feed")->findAllPublic(); $all_feeds = self::$DI['app']['EM']->getRepository('Entities\Feed')->findAllPublic();
foreach ($all_feeds as $feed) { foreach ($all_feeds as $feed) {
$this->assertTrue($feed->getPublic()); $this->assertTrue($feed->getPublic());

View File

@@ -3,9 +3,9 @@
namespace Alchemy\Tests\Phrasea\Core\Provider; namespace Alchemy\Tests\Phrasea\Core\Provider;
/** /**
* @covers Alchemy\Phrasea\Core\Provider\GeonamesServiceProvider * @covers Alchemy\Phrasea\Core\Provider\FeedServiceProvider
*/ */
class GeonamesServiceProvidertest extends ServiceProviderTestCase class FeedServiceProviderTest extends ServiceProviderTestCase
{ {
public function provideServiceDescription() public function provideServiceDescription()
{ {

View File

@@ -67,10 +67,10 @@ class AggregateLinkGeneratorTest extends \PhraseanetPHPUnitAbstract
$this->assertNotEquals($tokenValue, $capture['token']); $this->assertNotEquals($tokenValue, $capture['token']);
$this->assertCount(0, self::$DI['app']['EM'] $this->assertCount(0, self::$DI['app']['EM']
->getRepository("Entities\AggregateToken") ->getRepository('Entities\AggregateToken')
->findBy(array('value' => $tokenValue))); ->findBy(array('value' => $tokenValue)));
$this->assertCount(1, self::$DI['app']['EM'] $this->assertCount(1, self::$DI['app']['EM']
->getRepository("Entities\AggregateToken") ->getRepository('Entities\AggregateToken')
->findBy(array('value' => $capture['token']))); ->findBy(array('value' => $capture['token'])));
} else { } else {
$expectedParams = array( $expectedParams = array(
@@ -85,7 +85,7 @@ class AggregateLinkGeneratorTest extends \PhraseanetPHPUnitAbstract
$this->assertEquals($expectedParams, $capture); $this->assertEquals($expectedParams, $capture);
$this->assertCount(1, self::$DI['app']['EM'] $this->assertCount(1, self::$DI['app']['EM']
->getRepository("Entities\AggregateToken") ->getRepository('Entities\AggregateToken')
->findBy(array('value' => $tokenValue))); ->findBy(array('value' => $tokenValue)));
} }
} else { } else {
@@ -96,7 +96,7 @@ class AggregateLinkGeneratorTest extends \PhraseanetPHPUnitAbstract
$this->assertEquals(12, strlen($capture['token'])); $this->assertEquals(12, strlen($capture['token']));
$this->assertCount(1, self::$DI['app']['EM'] $this->assertCount(1, self::$DI['app']['EM']
->getRepository("Entities\AggregateToken") ->getRepository('Entities\AggregateToken')
->findBy(array('value' => $capture['token']))); ->findBy(array('value' => $capture['token'])));
} }
$token = self::$DI['app']['EM'] $token = self::$DI['app']['EM']

View File

@@ -60,10 +60,10 @@ class FeedLinkGeneratorTest extends \PhraseanetPHPUnitAbstract
} }
$this->assertCount(0, self::$DI['app']['EM'] $this->assertCount(0, self::$DI['app']['EM']
->getRepository("Entities\FeedToken") ->getRepository('Entities\FeedToken')
->findBy(array('value' => $tokenValue))); ->findBy(array('value' => $tokenValue)));
$this->assertCount(1, self::$DI['app']['EM'] $this->assertCount(1, self::$DI['app']['EM']
->getRepository("Entities\FeedToken") ->getRepository('Entities\FeedToken')
->findBy(array('value' => $capture['token']))); ->findBy(array('value' => $capture['token'])));
} else { } else {
$expectedParams = array( $expectedParams = array(
@@ -79,7 +79,7 @@ class FeedLinkGeneratorTest extends \PhraseanetPHPUnitAbstract
$this->assertEquals($expectedParams, $capture); $this->assertEquals($expectedParams, $capture);
$this->assertCount(1, self::$DI['app']['EM'] $this->assertCount(1, self::$DI['app']['EM']
->getRepository("Entities\FeedToken") ->getRepository('Entities\FeedToken')
->findBy(array('value' => $tokenValue))); ->findBy(array('value' => $tokenValue)));
} }
} else { } else {
@@ -91,7 +91,7 @@ class FeedLinkGeneratorTest extends \PhraseanetPHPUnitAbstract
$this->assertEquals(12, strlen($capture['token'])); $this->assertEquals(12, strlen($capture['token']));
$this->assertCount(1, self::$DI['app']['EM'] $this->assertCount(1, self::$DI['app']['EM']
->getRepository("Entities\FeedToken") ->getRepository('Entities\FeedToken')
->findBy(array('value' => $capture['token']))); ->findBy(array('value' => $capture['token'])));
} }
$token = self::$DI['app']['EM'] $token = self::$DI['app']['EM']