Change read status of Basket in Repository

This commit is contained in:
Benoît Burnichon
2015-12-21 19:47:45 +01:00
parent 60247cd2ad
commit 53a5ff7f3d
3 changed files with 12 additions and 8 deletions

View File

@@ -53,7 +53,7 @@ class Basket
private $user; private $user;
/** /**
* @ORM\Column(type="boolean", options={"default" = 0}) * @ORM\Column(name="is_read", type="boolean", options={"default" = 0})
*/ */
private $isRead = false; private $isRead = false;

View File

@@ -65,7 +65,7 @@ class BasketRepository extends EntityRepository
LEFT JOIN s.participants p LEFT JOIN s.participants p
WHERE b.archived = false WHERE b.archived = false
AND ( AND (
(b.user = :usr_id_owner AND b.is_read = false) (b.user = :usr_id_owner AND b.isRead = false)
OR (b.user != :usr_id_ownertwo OR (b.user != :usr_id_ownertwo
AND p.user = :usr_id_participant AND p.user = :usr_id_participant
AND p.is_aware = false) AND p.is_aware = false)

View File

@@ -2,6 +2,7 @@
namespace Alchemy\Tests\Phrasea\Controller\Root; namespace Alchemy\Tests\Phrasea\Controller\Root;
use Alchemy\Phrasea\Model\Entities\User;
use Symfony\Component\HttpKernel\Client; use Symfony\Component\HttpKernel\Client;
/** /**
@@ -44,16 +45,19 @@ class SessionTest extends \PhraseanetAuthenticatedWebTestCase
*/ */
public function testUpdSession() public function testUpdSession()
{ {
$this->authenticate(self::$DI['app']); $this->authenticate($this->getApplication());
/** @var User $user */
$user = self::$DI['user'];
$this->XMLHTTPRequest('POST', '/session/update/', [ $this->XMLHTTPRequest('POST', '/session/update/', [
'usr' => self::$DI['user']->getId(), 'usr' => $user->getId(),
'module' => 1 'module' => 1
]); ]);
$this->assertTrue(self::$DI['client']->getResponse()->isOk()); $client = $this->getClient();
$datas = json_decode(self::$DI['client']->getResponse()->getContent()); $this->assertTrue($client->getResponse()->isOk());
$this->checkSessionReturn($datas); $data = json_decode($client->getResponse()->getContent());
$this->assertEquals('ok', $datas->status); $this->checkSessionReturn($data);
$this->assertEquals('ok', $data->status);
} }
/** /**