Fix unit tests

This commit is contained in:
Nicolas Le Goff
2013-12-24 15:25:00 +01:00
parent 1ac7a536f9
commit c10c78f740
56 changed files with 167 additions and 241 deletions

View File

@@ -28,14 +28,14 @@ class StoryWZRepository extends EntityRepository
public function findByUser(Application $app, User $user, $sort)
{
$dql = 'SELECT s FROM Alchemy\Phrasea\Model\Entities\StoryWZ s WHERE s.user = :usr_id ';
$dql = 'SELECT s FROM Alchemy\Phrasea\Model\Entities\StoryWZ s WHERE s.user = :user ';
if ($sort == 'date') {
$dql .= ' ORDER BY s.created DESC';
}
$query = $this->_em->createQuery($dql);
$query->setParameters(['usr_id' => $user->getId()]);
$query->setParameters(['user' => $user]);
$stories = $query->getResult();
@@ -96,13 +96,11 @@ class StoryWZRepository extends EntityRepository
public function findUserStory(Application $app, User $user, \record_adapter $Story)
{
$story = $this->findOneBy(
[
'user' => $user->getId(),
'sbas_id' => $Story->get_sbas_id(),
'record_id' => $Story->get_record_id(),
]
);
$story = $this->findOneBy([
'user' => $user->getId(),
'sbas_id' => $Story->get_sbas_id(),
'record_id' => $Story->get_record_id(),
]);
if ($story) {
try {
@@ -119,7 +117,8 @@ class StoryWZRepository extends EntityRepository
public function findByRecord(Application $app, \record_adapter $Story)
{
$dql = 'SELECT s FROM Phraseanet:StoryWZ s WHERE s.sbas_id = :sbas_id
$dql = 'SELECT s FROM Alchemy\Phrasea\Model\Entities\StoryWZ s
WHERE s.sbas_id = :sbas_id
AND s.record_id = :record_id';
$query = $this->_em->createQuery($dql);
@@ -148,9 +147,7 @@ class StoryWZRepository extends EntityRepository
$dql = 'SELECT s FROM Phraseanet:StoryWZ s WHERE s.sbas_id = :sbas_id';
$query = $this->_em->createQuery($dql);
$query->setParameters([
'sbas_id' => $databox->get_sbas_id(),
]);
$query->setParameters(['sbas_id' => $databox->get_sbas_id(),]);
$stories = $query->getResult();