mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 23:43:12 +00:00

* PHRAS-1718 Add google recaptcha lib - Dont merge some quick fixes remaining * PHRAS-1718 Add error on registration form if captcha is not filled * Update dependencies * PHRAS-1718 Add trials-before-display var on admin setup form. Add integer constraint on this field * fix * test * test * fix * test * test * fix * test * fix * test * add captcha on forgotten password * fix * add patch * add locale on captcha * bump version Co-authored-by: Xavier Rousset <xrousset78800@gmail.com>
69 lines
1.9 KiB
PHP
69 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace Alchemy\Tests\Phrasea\Controller\Admin;
|
|
|
|
use Alchemy\Phrasea\Core\Configuration\RegistryManipulator;
|
|
use Symfony\Component\HttpKernel\Client;
|
|
|
|
/**
|
|
* @group functional
|
|
* @group legacy
|
|
* @group authenticated
|
|
* @group web
|
|
*/
|
|
class SetupTest extends \PhraseanetAuthenticatedWebTestCase
|
|
{
|
|
|
|
/**
|
|
* @covers Alchemy\Phrasea\Controller\Admin\Setup::getGlobals
|
|
*/
|
|
public function testGetSlash()
|
|
{
|
|
self::$DI['client']->request('GET', '/admin/setup/');
|
|
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
|
|
}
|
|
|
|
/**
|
|
* @covers Alchemy\Phrasea\Controller\Admin\Setup::getGlobals
|
|
*/
|
|
public function testGetSlashUnauthorizedException()
|
|
{
|
|
$this->setAdmin(false);
|
|
|
|
self::$DI['client']->request('GET', '/admin/setup/');
|
|
|
|
$this->assertForbiddenResponse(self::$DI['client']->getResponse());
|
|
}
|
|
|
|
/**
|
|
* @covers Alchemy\Phrasea\Controller\Admin\Setup::postGlobals
|
|
*/
|
|
public function testPostGlobals()
|
|
{
|
|
$database = self::$DI['app']['conf']->get(['main', 'database']);
|
|
$registry = $this->getMockBuilder('Alchemy\Phrasea\Core\Configuration\PropertyAccess')
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
|
|
$registry->expects($this->any())
|
|
->method('get')
|
|
->will($this->returnCallback(function ($prop, $default = null) use ($database) {
|
|
if ($prop === ['main', 'database']) {
|
|
return $database;
|
|
}
|
|
return $default;
|
|
}));
|
|
|
|
// $registry->expects($this->once())
|
|
// ->method('set')
|
|
// ->with('registry',$this->isType('array'));
|
|
|
|
self::$DI['app']['conf'] = $registry;
|
|
/** @var Client $client */
|
|
$client = self::$DI['client'];
|
|
$client->request('POST', '/admin/setup/', ['_token' => 'token']);
|
|
|
|
$this->assertTrue($client->getResponse()->isSuccessful());
|
|
}
|
|
}
|