mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Fix controllers tests
This commit is contained in:
70
lib/Alchemy/Phrasea/Controller/AbstractDelivery.php
Normal file
70
lib/Alchemy/Phrasea/Controller/AbstractDelivery.php
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2012 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Controller;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Application;
|
||||||
|
use Silex\ControllerProviderInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
abstract class AbstractDelivery implements ControllerProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function deliverContent(Request $request, \Session_Handler $session, \record_adapter $record, $subdef, $watermark, $stamp, Application $app)
|
||||||
|
{
|
||||||
|
$file = $record->get_subdef($subdef);
|
||||||
|
|
||||||
|
$pathIn = $pathOut = $file->get_pathfile();
|
||||||
|
|
||||||
|
if ($watermark === true && $file->get_type() === \media_subdef::TYPE_IMAGE) {
|
||||||
|
$pathOut = \recordutils_image::watermark($app, $file);
|
||||||
|
} elseif ($stamp === true && $file->get_type() === \media_subdef::TYPE_IMAGE) {
|
||||||
|
$pathOut = \recordutils_image::stamp($app, $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
$log_id = null;
|
||||||
|
try {
|
||||||
|
$registry = $app['phraseanet.registry'];
|
||||||
|
$logger = $session->get_logger($record->get_databox());
|
||||||
|
$log_id = $logger->get_id();
|
||||||
|
|
||||||
|
$referrer = 'NO REFERRER';
|
||||||
|
|
||||||
|
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||||
|
$referrer = $_SERVER['HTTP_REFERER'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$record->log_view($log_id, $referrer, $registry->get('GV_sit'));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = \set_export::stream_file($app['phraseanet.registry'], $pathOut, $file->get_file(), $file->get_mime(), 'inline');
|
||||||
|
$response->setPrivate();
|
||||||
|
|
||||||
|
/* @var $response \Symfony\Component\HttpFoundation\Response */
|
||||||
|
if ($file->getEtag()) {
|
||||||
|
$response->setEtag($file->getEtag());
|
||||||
|
$response->setLastModified($file->get_modification_date());
|
||||||
|
}
|
||||||
|
|
||||||
|
$response->headers->addCacheControlDirective('must-revalidate', true);
|
||||||
|
$response->isNotModified($request);
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
98
lib/Alchemy/Phrasea/Controller/Datafiles.php
Normal file
98
lib/Alchemy/Phrasea/Controller/Datafiles.php
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2012 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Controller;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||||
|
use Silex\Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
class Datafiles extends AbstractDelivery
|
||||||
|
{
|
||||||
|
|
||||||
|
public function connect(Application $app)
|
||||||
|
{
|
||||||
|
$controllers = $app['controllers_factory'];
|
||||||
|
|
||||||
|
$that = $this;
|
||||||
|
|
||||||
|
$controllers->get('/{sbas_id}/{record_id}/{subdef}/', function($sbas_id, $record_id, $subdef, PhraseaApplication $app) use ($that) {
|
||||||
|
|
||||||
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
|
$record = new \record_adapter($app, $sbas_id, $record_id);
|
||||||
|
|
||||||
|
if (!$app['phraseanet.session']->is_authenticated()) {
|
||||||
|
throw new \Exception_Session_NotAuthenticated();
|
||||||
|
}
|
||||||
|
|
||||||
|
$all_access = false;
|
||||||
|
$subdefStruct = $databox->get_subdef_structure();
|
||||||
|
|
||||||
|
if ($subdefStruct->getSubdefGroup($record->get_type())) {
|
||||||
|
foreach ($subdefStruct->getSubdefGroup($record->get_type()) as $subdefObj) {
|
||||||
|
if ($subdefObj->get_name() == $subdef) {
|
||||||
|
if ($subdefObj->get_class() == 'thumbnail') {
|
||||||
|
$all_access = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = $app['phraseanet.user'];
|
||||||
|
|
||||||
|
if (!$user->ACL()->has_access_to_subdef($record, $subdef)) {
|
||||||
|
throw new \Exception_UnauthorizedAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
$stamp = false;
|
||||||
|
$watermark = !$user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark');
|
||||||
|
|
||||||
|
if ($watermark && !$all_access) {
|
||||||
|
$subdef_class = $databox
|
||||||
|
->get_subdef_structure()
|
||||||
|
->get_subdef($record->get_type(), $subdef)
|
||||||
|
->get_class();
|
||||||
|
|
||||||
|
if ($subdef_class == \databox_subdef::CLASS_PREVIEW && $user->ACL()->has_preview_grant($record)) {
|
||||||
|
$watermark = false;
|
||||||
|
} elseif ($subdef_class == \databox_subdef::CLASS_DOCUMENT && $user->ACL()->has_hd_grant($record)) {
|
||||||
|
$watermark = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($watermark && !$all_access) {
|
||||||
|
|
||||||
|
$repository = $app['EM']->getRepository('\Entities\BasketElement');
|
||||||
|
|
||||||
|
/* @var $repository \Repositories\BasketElementRepository */
|
||||||
|
|
||||||
|
$ValidationByRecord = $repository->findReceivedValidationElementsByRecord($record, $user);
|
||||||
|
$ReceptionByRecord = $repository->findReceivedElementsByRecord($record, $user);
|
||||||
|
|
||||||
|
if ($ValidationByRecord && count($ValidationByRecord) > 0) {
|
||||||
|
$watermark = false;
|
||||||
|
} elseif ($ReceptionByRecord && count($ReceptionByRecord) > 0) {
|
||||||
|
$watermark = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $that->deliverContent($app['request'], $app['phraseanet.session'], $record, $subdef, $watermark, $stamp, $app);
|
||||||
|
})->assert('sbas_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
|
|
||||||
|
return $controllers;
|
||||||
|
}
|
||||||
|
}
|
104
lib/Alchemy/Phrasea/Controller/Permalink.php
Normal file
104
lib/Alchemy/Phrasea/Controller/Permalink.php
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2012 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Controller;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||||
|
use Silex\Application;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
class Permalink extends AbstractDelivery
|
||||||
|
{
|
||||||
|
|
||||||
|
public function connect(Application $app)
|
||||||
|
{
|
||||||
|
$controllers = $app['controllers_factory'];
|
||||||
|
|
||||||
|
$that = $this;
|
||||||
|
|
||||||
|
$controllers->get('/v1/{label}/{sbas_id}/{record_id}/{key}/{subdef}/view/'
|
||||||
|
, function($label, $sbas_id, $record_id, $key, $subdef, PhraseaApplication $app) {
|
||||||
|
|
||||||
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
|
|
||||||
|
$record = \media_Permalink_Adapter::challenge_token($app, $databox, $key, $record_id, $subdef);
|
||||||
|
|
||||||
|
if (!$record instanceof \record_adapter) {
|
||||||
|
throw new \Exception_NotFound('bad luck');
|
||||||
|
}
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
'subdef_name' => $subdef
|
||||||
|
, 'module_name' => 'overview'
|
||||||
|
, 'module' => 'overview'
|
||||||
|
, 'view' => 'overview'
|
||||||
|
, 'record' => $record
|
||||||
|
);
|
||||||
|
|
||||||
|
return new Response($app['twig']->render('overview.html.twig', $params));
|
||||||
|
})->assert('sbas_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
|
$controllers->get('/v1/{label}/{sbas_id}/{record_id}/{key}/{subdef}/', function(Application $app, $label, $sbas_id, $record_id, $key, $subdef) use ($that) {
|
||||||
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
|
$record = \media_Permalink_Adapter::challenge_token($app, $databox, $key, $record_id, $subdef);
|
||||||
|
|
||||||
|
if (!($record instanceof \record_adapter)) {
|
||||||
|
throw new \Exception_NotFound('bad luck');
|
||||||
|
}
|
||||||
|
|
||||||
|
$watermark = $stamp = false;
|
||||||
|
|
||||||
|
if ($app['phraseanet.session']->is_authenticated()) {
|
||||||
|
$user = \User_Adapter::getInstance($app['phraseanet.session']->get_usr_id(), $app);
|
||||||
|
|
||||||
|
$watermark = !$user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark');
|
||||||
|
|
||||||
|
if ($watermark) {
|
||||||
|
|
||||||
|
$repository = $app['EM']->getRepository('\Entities\BasketElement');
|
||||||
|
|
||||||
|
if (count($repository->findReceivedValidationElementsByRecord($record, $user)) > 0) {
|
||||||
|
$watermark = false;
|
||||||
|
} elseif (count($repository->findReceivedElementsByRecord($record, $user)) > 0) {
|
||||||
|
$watermark = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $that->deliverContent($app['request'], $app['phraseanet.session'], $record, $subdef, $watermark, $stamp, $app);
|
||||||
|
} else {
|
||||||
|
$collection = \collection::get_from_base_id($app, $record->get_base_id());
|
||||||
|
switch ($collection->get_pub_wm()) {
|
||||||
|
default:
|
||||||
|
case 'none':
|
||||||
|
$watermark = false;
|
||||||
|
break;
|
||||||
|
case 'stamp':
|
||||||
|
$stamp = true;
|
||||||
|
break;
|
||||||
|
case 'wm':
|
||||||
|
$watermark = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $that->deliverContent($app['request'], $app['phraseanet.session'], $record, $subdef, $watermark, $stamp, $app);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->assert('sbas_id', '\d+')->assert('record_id', '\d+');
|
||||||
|
|
||||||
|
return $controllers;
|
||||||
|
}
|
||||||
|
}
|
@@ -197,22 +197,23 @@ class RecordsRequest extends ArrayCollection
|
|||||||
$basket = null;
|
$basket = null;
|
||||||
|
|
||||||
if ($request->get('ssel')) {
|
if ($request->get('ssel')) {
|
||||||
$repository = $app['phraseanet.core']['EM']->getRepository('\Entities\Basket');
|
$repository = $app['EM']->getRepository('\Entities\Basket');
|
||||||
|
|
||||||
$basket = $repository->findUserBasket($request->get('ssel'), $app['phraseanet.core']->getAuthenticatedUser(), false);
|
$basket = $repository->findUserBasket($app, $request->get('ssel'), $app['phraseanet.user'], false);
|
||||||
|
|
||||||
foreach ($basket->getElements() as $basket_element) {
|
foreach ($basket->getElements() as $basket_element) {
|
||||||
$received[$basket_element->getRecord()->get_serialize_key()] = $basket_element->getRecord();
|
$received[$basket_element->getRecord($app)->get_serialize_key()] = $basket_element->getRecord($app);
|
||||||
}
|
}
|
||||||
} elseif ($request->get('story')) {
|
} elseif ($request->get('story')) {
|
||||||
$repository = $app['phraseanet.core']['EM']->getRepository('\Entities\StoryWZ');
|
$repository = $app['EM']->getRepository('\Entities\StoryWZ');
|
||||||
|
|
||||||
$storyWZ = $repository->findByUserAndId(
|
$storyWZ = $repository->findByUserAndId(
|
||||||
$app['phraseanet.core']->getAuthenticatedUser()
|
$app,
|
||||||
|
$app['phraseanet.user']
|
||||||
, $request->get('story')
|
, $request->get('story')
|
||||||
);
|
);
|
||||||
|
|
||||||
$received[$storyWZ->getRecord()->get_serialize_key()] = $storyWZ->getRecord();
|
$received[$storyWZ->getRecord($app)->get_serialize_key()] = $storyWZ->getRecord($app);
|
||||||
} else {
|
} else {
|
||||||
foreach (explode(";", $request->get('lst')) as $bas_rec) {
|
foreach (explode(";", $request->get('lst')) as $bas_rec) {
|
||||||
$basrec = explode('_', $bas_rec);
|
$basrec = explode('_', $bas_rec);
|
||||||
@@ -220,7 +221,7 @@ class RecordsRequest extends ArrayCollection
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$record = new \record_adapter((int) $basrec[0], (int) $basrec[1]);
|
$record = new \record_adapter($app, (int) $basrec[0], (int) $basrec[1]);
|
||||||
$received[$record->get_serialize_key()] = $record;
|
$received[$record->get_serialize_key()] = $record;
|
||||||
unset($record);
|
unset($record);
|
||||||
} catch (\Exception_NotFound $e) {
|
} catch (\Exception_NotFound $e) {
|
||||||
@@ -233,7 +234,7 @@ class RecordsRequest extends ArrayCollection
|
|||||||
|
|
||||||
$to_remove = array();
|
$to_remove = array();
|
||||||
|
|
||||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
$user = $app['phraseanet.user'];
|
||||||
|
|
||||||
foreach ($elements as $id => $record) {
|
foreach ($elements as $id => $record) {
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
{
|
{
|
||||||
protected $client;
|
protected $client;
|
||||||
public static $createdCollections = array();
|
public static $createdCollections = array();
|
||||||
|
protected static $useExceptionHandler = true;
|
||||||
|
|
||||||
public static function tearDownAfterClass()
|
public static function tearDownAfterClass()
|
||||||
{
|
{
|
||||||
@@ -109,7 +110,6 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
|
||||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::submitSuggestedValues
|
* @covers Alchemy\Phrasea\Controller\Admin\Bas::submitSuggestedValues
|
||||||
*/
|
*/
|
||||||
public function testPostSuggestedValueUnauthorized()
|
public function testPostSuggestedValueUnauthorized()
|
||||||
@@ -117,6 +117,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->setAdmin(false);
|
$this->setAdmin(false);
|
||||||
|
|
||||||
$this->XMLHTTPRequest('POST', '/admin/collection/' . self::$collection->get_base_id() . '/suggested-values/');
|
$this->XMLHTTPRequest('POST', '/admin/collection/' . self::$collection->get_base_id() . '/suggested-values/');
|
||||||
|
$this->assertXMLHTTPBadJsonResponse($this->client->getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -289,7 +290,6 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
|
||||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::setPublicationDisplay
|
* @covers Alchemy\Phrasea\Controller\Admin\Bas::setPublicationDisplay
|
||||||
*/
|
*/
|
||||||
public function testPublicationDisplayBadRequestMissingArguments()
|
public function testPublicationDisplayBadRequestMissingArguments()
|
||||||
@@ -297,6 +297,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->setAdmin(true);
|
$this->setAdmin(true);
|
||||||
|
|
||||||
$this->XMLHTTPRequest('POST', '/admin/collection/' . self::$collection->get_base_id() . '/publication/display/');
|
$this->XMLHTTPRequest('POST', '/admin/collection/' . self::$collection->get_base_id() . '/publication/display/');
|
||||||
|
$this->assertXMLHTTPBadJsonResponse($this->client->getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -345,7 +346,6 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
|
||||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::rename
|
* @covers Alchemy\Phrasea\Controller\Admin\Bas::rename
|
||||||
*/
|
*/
|
||||||
public function testPostNameBadRequestMissingArguments()
|
public function testPostNameBadRequestMissingArguments()
|
||||||
@@ -353,6 +353,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->setAdmin(true);
|
$this->setAdmin(true);
|
||||||
|
|
||||||
$this->XMLHTTPRequest('POST', '/admin/collection/' . self::$collection->get_base_id() . '/rename/');
|
$this->XMLHTTPRequest('POST', '/admin/collection/' . self::$collection->get_base_id() . '/rename/');
|
||||||
|
$this->assertXMLHTTPBadJsonResponse($this->client->getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -390,7 +391,6 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
|
||||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::emptyCollection
|
* @covers Alchemy\Phrasea\Controller\Admin\Bas::emptyCollection
|
||||||
*/
|
*/
|
||||||
public function testPostEmptyCollectionUnauthorizedException()
|
public function testPostEmptyCollectionUnauthorizedException()
|
||||||
@@ -398,6 +398,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->setAdmin(false);
|
$this->setAdmin(false);
|
||||||
|
|
||||||
$this->XMLHTTPRequest('POST', '/admin/collection/' . self::$collection->get_base_id() . '/empty/');
|
$this->XMLHTTPRequest('POST', '/admin/collection/' . self::$collection->get_base_id() . '/empty/');
|
||||||
|
$this->assertXMLHTTPBadJsonResponse($this->client->getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -542,7 +543,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
);
|
);
|
||||||
$this->client->request('POST', '/admin/collection/' . self::$collection->get_base_id() . '/picture/mini-logo/', array(), $files);
|
$this->client->request('POST', '/admin/collection/' . self::$collection->get_base_id() . '/picture/mini-logo/', array(), $files);
|
||||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?success=1');
|
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?success=1');
|
||||||
$this->assertEquals(1, count(\collection::getLogo(self::$application, self::$collection->get_base_id())));
|
$this->assertEquals(1, count(\collection::getLogo(self::$collection->get_base_id(), self::$application)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -564,7 +565,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
*/
|
*/
|
||||||
public function testDeleteMiniLogo()
|
public function testDeleteMiniLogo()
|
||||||
{
|
{
|
||||||
if (count(\collection::getLogo(self::$application, self::$collection->get_base_id())) === 0) {
|
if (count(\collection::getLogo(self::$collection->get_base_id(), self::$application)) === 0) {
|
||||||
$this->markTestSkipped('No logo setted');
|
$this->markTestSkipped('No logo setted');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,7 +836,6 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
|
||||||
* @covers Alchemy\Phrasea\Controller\Admin\Bas::unmount
|
* @covers Alchemy\Phrasea\Controller\Admin\Bas::unmount
|
||||||
*/
|
*/
|
||||||
public function testPostUnmountCollectionUnauthorizedException()
|
public function testPostUnmountCollectionUnauthorizedException()
|
||||||
@@ -843,6 +843,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->setAdmin(false);
|
$this->setAdmin(false);
|
||||||
|
|
||||||
$this->XMLHTTPRequest('POST', '/admin/collection/' . self::$collection->get_base_id() . '/unmount/');
|
$this->XMLHTTPRequest('POST', '/admin/collection/' . self::$collection->get_base_id() . '/unmount/');
|
||||||
|
$this->assertXMLHTTPBadJsonResponse($this->client->getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -92,7 +92,7 @@ class AdminDashboardTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
|
|
||||||
$admins = array_keys(\User_Adapter::get_sys_admins(self::$application));
|
$admins = array_keys(\User_Adapter::get_sys_admins(self::$application));
|
||||||
|
|
||||||
$user = \User_Adapter::create($this->app, uniqid('unit_test_user'), uniqid('unit_test_user'), uniqid('unit_test_user') ."@email.com", false);
|
$user = \User_Adapter::create(self::$application, uniqid('unit_test_user'), uniqid('unit_test_user'), uniqid('unit_test_user') ."@email.com", false);
|
||||||
|
|
||||||
$admins[] = $user->get_id();
|
$admins[] = $user->get_id();
|
||||||
|
|
||||||
|
@@ -343,7 +343,6 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
|
||||||
* @covers \Alchemy\Phrasea\Controller\Admin\Database::getDetails
|
* @covers \Alchemy\Phrasea\Controller\Admin\Database::getDetails
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -352,6 +351,7 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->setAdmin(false);
|
$this->setAdmin(false);
|
||||||
|
|
||||||
$this->XMLHTTPRequest('GET', '/admin/databox/' . self::$collection->get_sbas_id() . '/informations/documents/');
|
$this->XMLHTTPRequest('GET', '/admin/databox/' . self::$collection->get_sbas_id() . '/informations/documents/');
|
||||||
|
$this->assertXMLHTTPBadJsonResponse($this->client->getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -487,7 +487,6 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
|
|
||||||
* @covers \Alchemy\Phrasea\Controller\Admin\Database::changeViewName
|
* @covers \Alchemy\Phrasea\Controller\Admin\Database::changeViewName
|
||||||
*/
|
*/
|
||||||
public function testPostViewNameBadRequestArguments()
|
public function testPostViewNameBadRequestArguments()
|
||||||
@@ -495,6 +494,7 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->setAdmin(true);
|
$this->setAdmin(true);
|
||||||
|
|
||||||
$this->XMLHTTPRequest('POST', '/admin/databox/' . self::$collection->get_sbas_id() . '/view-name/');
|
$this->XMLHTTPRequest('POST', '/admin/databox/' . self::$collection->get_sbas_id() . '/view-name/');
|
||||||
|
$this->assertXMLHTTPBadJsonResponse($this->client->getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -11,7 +11,7 @@ class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->databox = array_shift($this->app['phraseanet.appbox']->get_databoxes());
|
$this->databox = array_shift(self::$application['phraseanet.appbox']->get_databoxes());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSubdefName()
|
public function getSubdefName()
|
||||||
|
@@ -21,34 +21,6 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
*/
|
*/
|
||||||
class BoilerPlate extends \PhraseanetWebTestCaseAbstract
|
class BoilerPlate extends \PhraseanetWebTestCaseAbstract
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* As controllers use WebTestCase, it requires a client
|
|
||||||
*/
|
|
||||||
protected $client;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The application loader
|
|
||||||
*/
|
|
||||||
public function createApplication()
|
|
||||||
{
|
|
||||||
$app = require __DIR__ . '/../../../../Path/To/Application.php';
|
|
||||||
|
|
||||||
$app['debug'] = true;
|
|
||||||
unset($app['exception_handler']);
|
|
||||||
|
|
||||||
return $app;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
$this->client = $this->createClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default route test
|
* Default route test
|
||||||
|
@@ -5,37 +5,32 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
|
|||||||
class MustacheLoaderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
class MustacheLoaderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||||
{
|
{
|
||||||
protected $client;
|
protected $client;
|
||||||
|
protected static $useExceptionHandler = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException \Exception_BadRequest
|
|
||||||
*/
|
|
||||||
public function testRouteSlash()
|
public function testRouteSlash()
|
||||||
{
|
{
|
||||||
$this->client->request('GET', '/prod/MustacheLoader/');
|
$this->client->request('GET', '/prod/MustacheLoader/');
|
||||||
|
|
||||||
$response = $this->client->getResponse();
|
$response = $this->client->getResponse();
|
||||||
/* @var $response \Symfony\Component\HttpFoundation\Response */
|
/* @var $response \Symfony\Component\HttpFoundation\Response */
|
||||||
|
$this->assertEquals(400, $response->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException \Exception_BadRequest
|
|
||||||
*/
|
|
||||||
public function testRouteSlashWrongUrl()
|
public function testRouteSlashWrongUrl()
|
||||||
{
|
{
|
||||||
$this->client->request('GET', '/prod/MustacheLoader/', array('template' => '/../../../../config/config.yml'));
|
$this->client->request('GET', '/prod/MustacheLoader/', array('template' => '/../../../../config/config.yml'));
|
||||||
|
|
||||||
$response = $this->client->getResponse();
|
$response = $this->client->getResponse();
|
||||||
|
$this->assertEquals(400, $response->getStatusCode());
|
||||||
/* @var $response \Symfony\Component\HttpFoundation\Response */
|
/* @var $response \Symfony\Component\HttpFoundation\Response */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException \Exception_NotFound
|
|
||||||
*/
|
|
||||||
public function testRouteSlashWrongFile()
|
public function testRouteSlashWrongFile()
|
||||||
{
|
{
|
||||||
$this->client->request('GET', '/prod/MustacheLoader/', array('template' => 'patator_lala'));
|
$this->client->request('GET', '/prod/MustacheLoader/', array('template' => 'patator_lala'));
|
||||||
|
|
||||||
$response = $this->client->getResponse();
|
$response = $this->client->getResponse();
|
||||||
|
$this->assertEquals(404, $response->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRouteGood()
|
public function testRouteGood()
|
||||||
|
@@ -81,7 +81,7 @@ class OrderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||||
$url = parse_url($this->client->getResponse()->headers->get('location'));
|
$url = parse_url($this->client->getResponse()->headers->get('location'));
|
||||||
parse_str($url['query']);
|
parse_str($url['query']);
|
||||||
$this->assertTrue( ! ! $success);
|
$this->assertTrue( strpos($url['query'], 'success=1') === 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -10,14 +10,6 @@ require_once __DIR__ . '/../../../PhraseanetPHPUnitAuthenticatedAbstract.class.i
|
|||||||
class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
||||||
{
|
{
|
||||||
|
|
||||||
public function getApplication()
|
|
||||||
{
|
|
||||||
$application = new Application();
|
|
||||||
$application['phraseanet.core'] = self::$core;
|
|
||||||
|
|
||||||
return $application;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSimple()
|
public function testSimple()
|
||||||
{
|
{
|
||||||
$request = new Request(array(
|
$request = new Request(array(
|
||||||
@@ -36,7 +28,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
))
|
))
|
||||||
));
|
));
|
||||||
|
|
||||||
$records = RecordsRequest::fromRequest($this->getApplication(), $request);
|
$records = RecordsRequest::fromRequest(self::$application, $request);
|
||||||
|
|
||||||
$this->assertEquals(3, count($records));
|
$this->assertEquals(3, count($records));
|
||||||
$this->assertEquals(5, count($records->received()));
|
$this->assertEquals(5, count($records->received()));
|
||||||
@@ -65,7 +57,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
))
|
))
|
||||||
));
|
));
|
||||||
|
|
||||||
$records = RecordsRequest::fromRequest($this->getApplication(), $request);
|
$records = RecordsRequest::fromRequest(self::$application, $request);
|
||||||
|
|
||||||
$this->assertEquals(1, count($records));
|
$this->assertEquals(1, count($records));
|
||||||
$this->assertEquals(1, count($records->received()));
|
$this->assertEquals(1, count($records->received()));
|
||||||
@@ -84,7 +76,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
|
|
||||||
public function testSimpleWithoutSbasRights()
|
public function testSimpleWithoutSbasRights()
|
||||||
{
|
{
|
||||||
self::$core->getAuthenticatedUser()->ACL()
|
self::$application['phraseanet.user']->ACL()
|
||||||
->update_rights_to_sbas(self::$records['record_2']->get_sbas_id(), array('bas_chupub' => 0));
|
->update_rights_to_sbas(self::$records['record_2']->get_sbas_id(), array('bas_chupub' => 0));
|
||||||
|
|
||||||
$request = new Request(array(
|
$request = new Request(array(
|
||||||
@@ -93,7 +85,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
))
|
))
|
||||||
));
|
));
|
||||||
|
|
||||||
$records = RecordsRequest::fromRequest($this->getApplication(), $request, false, array(), array('bas_chupub'));
|
$records = RecordsRequest::fromRequest(self::$application, $request, false, array(), array('bas_chupub'));
|
||||||
|
|
||||||
$this->assertEquals(0, count($records));
|
$this->assertEquals(0, count($records));
|
||||||
$this->assertEquals(1, count($records->received()));
|
$this->assertEquals(1, count($records->received()));
|
||||||
@@ -110,7 +102,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
|
|
||||||
public function testSimpleWithoutBasRights()
|
public function testSimpleWithoutBasRights()
|
||||||
{
|
{
|
||||||
self::$core->getAuthenticatedUser()->ACL()
|
self::$application['phraseanet.user']->ACL()
|
||||||
->update_rights_to_base(self::$records['record_2']->get_base_id(), array('chgstatus' => 0));
|
->update_rights_to_base(self::$records['record_2']->get_base_id(), array('chgstatus' => 0));
|
||||||
|
|
||||||
$request = new Request(array(
|
$request = new Request(array(
|
||||||
@@ -119,7 +111,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
))
|
))
|
||||||
));
|
));
|
||||||
|
|
||||||
$records = RecordsRequest::fromRequest($this->getApplication(), $request, false, array('chgstatus'));
|
$records = RecordsRequest::fromRequest(self::$application, $request, false, array('chgstatus'));
|
||||||
|
|
||||||
$this->assertEquals(0, count($records));
|
$this->assertEquals(0, count($records));
|
||||||
$this->assertEquals(1, count($records->received()));
|
$this->assertEquals(1, count($records->received()));
|
||||||
@@ -147,7 +139,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
))
|
))
|
||||||
));
|
));
|
||||||
|
|
||||||
$records = RecordsRequest::fromRequest($this->getApplication(), $request, true);
|
$records = RecordsRequest::fromRequest(self::$application, $request, true);
|
||||||
|
|
||||||
$this->assertEquals(2, count($records));
|
$this->assertEquals(2, count($records));
|
||||||
$this->assertEquals(5, count($records->received()));
|
$this->assertEquals(5, count($records->received()));
|
||||||
@@ -172,7 +164,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
$basketElement = $this->insertOneBasketElement();
|
$basketElement = $this->insertOneBasketElement();
|
||||||
$request = new Request(array('ssel' => $basketElement->getBasket()->getId()));
|
$request = new Request(array('ssel' => $basketElement->getBasket()->getId()));
|
||||||
|
|
||||||
$records = RecordsRequest::fromRequest($this->getApplication(), $request);
|
$records = RecordsRequest::fromRequest(self::$application, $request);
|
||||||
|
|
||||||
$this->assertEquals(1, count($records));
|
$this->assertEquals(1, count($records));
|
||||||
$this->assertEquals(1, count($records->received()));
|
$this->assertEquals(1, count($records->received()));
|
||||||
@@ -185,7 +177,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
$exploded = explode(';', $serialized);
|
$exploded = explode(';', $serialized);
|
||||||
|
|
||||||
$this->assertEquals(1, count($exploded));
|
$this->assertEquals(1, count($exploded));
|
||||||
$this->assertContains($basketElement->getRecord()->get_serialize_key(), $exploded);
|
$this->assertContains($basketElement->getRecord(self::$application)->get_serialize_key(), $exploded);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBasket()
|
public function getBasket()
|
||||||
@@ -199,18 +191,18 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
|
|
||||||
$basket = new \Entities\Basket();
|
$basket = new \Entities\Basket();
|
||||||
$basket->setName('test');
|
$basket->setName('test');
|
||||||
$basket->setOwner(self::$core->getAuthenticatedUser());
|
$basket->setOwner(self::$application['phraseanet.user']);
|
||||||
|
|
||||||
self::$core['EM']->persist($basket);
|
self::$application['EM']->persist($basket);
|
||||||
self::$core['EM']->flush();
|
self::$application['EM']->flush();
|
||||||
|
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$basket_element = new \Entities\BasketElement();
|
$basket_element = new \Entities\BasketElement();
|
||||||
$basket_element->setRecord($element);
|
$basket_element->setRecord($element);
|
||||||
$basket_element->setBasket($basket);
|
$basket_element->setBasket($basket);
|
||||||
$basket->addBasketElement($basket_element);
|
$basket->addBasketElement($basket_element);
|
||||||
self::$core['EM']->persist($basket_element);
|
self::$application['EM']->persist($basket_element);
|
||||||
self::$core['EM']->flush();
|
self::$application['EM']->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $basket;
|
return $basket;
|
||||||
@@ -221,20 +213,20 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
$story = $this->getStoryWZ();
|
$story = $this->getStoryWZ();
|
||||||
$request = new Request(array('story' => $story->getId()));
|
$request = new Request(array('story' => $story->getId()));
|
||||||
|
|
||||||
$records = RecordsRequest::fromRequest($this->getApplication(), $request);
|
$records = RecordsRequest::fromRequest(self::$application, $request);
|
||||||
|
|
||||||
$this->assertEquals(1, count($records));
|
$this->assertEquals(1, count($records));
|
||||||
$this->assertEquals(1, count($records->received()));
|
$this->assertEquals(1, count($records->received()));
|
||||||
$this->assertEquals(1, count($records->stories()));
|
$this->assertEquals(1, count($records->stories()));
|
||||||
$this->assertInstanceOf('record_adapter', $records->singleStory());
|
$this->assertInstanceOf('record_adapter', $records->singleStory());
|
||||||
$this->assertTrue($records->isSingleStory());
|
$this->assertTrue($records->isSingleStory());
|
||||||
$this->assertEquals(array($story->getRecord()->get_databox()), $records->databoxes());
|
$this->assertEquals(array($story->getRecord(self::$application)->get_databox()), $records->databoxes());
|
||||||
|
|
||||||
$serialized = $records->serializedList();
|
$serialized = $records->serializedList();
|
||||||
$exploded = explode(';', $serialized);
|
$exploded = explode(';', $serialized);
|
||||||
|
|
||||||
$this->assertEquals(1, count($exploded));
|
$this->assertEquals(1, count($exploded));
|
||||||
$this->assertContains($story->getRecord()->get_serialize_key(), $exploded);
|
$this->assertContains($story->getRecord(self::$application)->get_serialize_key(), $exploded);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSimpleStoryFlatten()
|
public function testSimpleStoryFlatten()
|
||||||
@@ -242,7 +234,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
$story = $this->getStoryWZ();
|
$story = $this->getStoryWZ();
|
||||||
$request = new Request(array('story' => $story->getId()));
|
$request = new Request(array('story' => $story->getId()));
|
||||||
|
|
||||||
$records = RecordsRequest::fromRequest($this->getApplication(), $request, true);
|
$records = RecordsRequest::fromRequest(self::$application, $request, true);
|
||||||
|
|
||||||
$this->assertEquals(0, count($records));
|
$this->assertEquals(0, count($records));
|
||||||
$this->assertEquals(1, count($records->received()));
|
$this->assertEquals(1, count($records->received()));
|
||||||
@@ -255,17 +247,17 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
$exploded = explode(';', $serialized);
|
$exploded = explode(';', $serialized);
|
||||||
|
|
||||||
$this->assertEquals('', $serialized);
|
$this->assertEquals('', $serialized);
|
||||||
$this->assertNotContains($story->getRecord()->get_serialize_key(), $exploded);
|
$this->assertNotContains($story->getRecord(self::$application)->get_serialize_key(), $exploded);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getStoryWZ()
|
protected function getStoryWZ()
|
||||||
{
|
{
|
||||||
$story = new \Entities\StoryWZ();
|
$story = new \Entities\StoryWZ();
|
||||||
$story->setRecord(self::$records['record_story_2']);
|
$story->setRecord(self::$records['record_story_2']);
|
||||||
$story->setUser(self::$core->getAuthenticatedUser());
|
$story->setUser(self::$application['phraseanet.user']);
|
||||||
|
|
||||||
self::$core['EM']->persist($story);
|
self::$application['EM']->persist($story);
|
||||||
self::$core['EM']->flush();
|
self::$application['EM']->flush();
|
||||||
|
|
||||||
return $story;
|
return $story;
|
||||||
}
|
}
|
||||||
|
@@ -149,7 +149,7 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
public function testPostResetMailBadEmail()
|
public function testPostResetMailBadEmail()
|
||||||
{
|
{
|
||||||
$password = \random::generatePassword();
|
$password = \random::generatePassword();
|
||||||
self::$user->set_password($password);
|
self::$application['phraseanet.user']->set_password($password);
|
||||||
$this->client->request('POST', '/account/reset-email/', array(
|
$this->client->request('POST', '/account/reset-email/', array(
|
||||||
'form_password' => $password,
|
'form_password' => $password,
|
||||||
'form_email' => "invalid#!&&@@email.x",
|
'form_email' => "invalid#!&&@@email.x",
|
||||||
@@ -167,7 +167,7 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
public function testPostResetMailEmailNotIdentical()
|
public function testPostResetMailEmailNotIdentical()
|
||||||
{
|
{
|
||||||
$password = \random::generatePassword();
|
$password = \random::generatePassword();
|
||||||
self::$user->set_password($password);
|
self::$application['phraseanet.user']->set_password($password);
|
||||||
$this->client->request('POST', '/account/reset-email/', array(
|
$this->client->request('POST', '/account/reset-email/', array(
|
||||||
'form_password' => $password,
|
'form_password' => $password,
|
||||||
'form_email' => 'email1@email.com',
|
'form_email' => 'email1@email.com',
|
||||||
@@ -185,7 +185,7 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
public function testPostResetMailEmail()
|
public function testPostResetMailEmail()
|
||||||
{
|
{
|
||||||
$password = \random::generatePassword();
|
$password = \random::generatePassword();
|
||||||
self::$user->set_password($password);
|
self::$application['phraseanet.user']->set_password($password);
|
||||||
$this->client->request('POST', '/account/reset-email/', array(
|
$this->client->request('POST', '/account/reset-email/', array(
|
||||||
'form_password' => $password,
|
'form_password' => $password,
|
||||||
'form_email' => 'email1@email.com',
|
'form_email' => 'email1@email.com',
|
||||||
@@ -432,7 +432,7 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
*/
|
*/
|
||||||
public function testPostRenewPasswordBadArguments($oldPassword, $password, $passwordConfirm, $redirect)
|
public function testPostRenewPasswordBadArguments($oldPassword, $password, $passwordConfirm, $redirect)
|
||||||
{
|
{
|
||||||
self::$user->set_password($oldPassword);
|
self::$application['phraseanet.user']->set_password($oldPassword);
|
||||||
|
|
||||||
$this->client->request('POST', '/account/reset-password/', array(
|
$this->client->request('POST', '/account/reset-password/', array(
|
||||||
'form_password' => $password,
|
'form_password' => $password,
|
||||||
@@ -464,7 +464,7 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
{
|
{
|
||||||
$password = \random::generatePassword();
|
$password = \random::generatePassword();
|
||||||
|
|
||||||
self::$user->set_password($password);
|
self::$application['phraseanet.user']->set_password($password);
|
||||||
|
|
||||||
$this->client->request('POST', '/account/reset-password/', array(
|
$this->client->request('POST', '/account/reset-password/', array(
|
||||||
'form_password' => 'password',
|
'form_password' => 'password',
|
||||||
|
@@ -634,7 +634,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
{
|
{
|
||||||
self::$application['phraseanet.appbox']->get_session()->logout();
|
self::$application['phraseanet.appbox']->get_session()->logout();
|
||||||
$password = \random::generatePassword();
|
$password = \random::generatePassword();
|
||||||
self::$user->set_password($password);
|
self::$application['phraseanet.user']->set_password($password);
|
||||||
$this->client->request('POST', '/login/authenticate/', array(
|
$this->client->request('POST', '/login/authenticate/', array(
|
||||||
'login' => self::$user->get_login(),
|
'login' => self::$user->get_login(),
|
||||||
'pwd' => $password
|
'pwd' => $password
|
||||||
|
Reference in New Issue
Block a user