Files
Phraseanet/tests/Alchemy/Phrasea/Controller/Admin/SetupTest.php
Nicolas Le Goff ec8d577a41 Add missing class declaration
Fix tests

Update tests

Fix CS
2012-10-19 17:32:12 +02:00

51 lines
1.6 KiB
PHP

<?php
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
class SetupTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
/**
* @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
* @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
*/
public function testGetSlashUnauthorizedException()
{
$this->setAdmin(false);
self::$DI['client']->request('GET', '/admin/setup/');
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
}
/**
* @covers Alchemy\Phrasea\Controller\Admin\Setup::postGlobals
*/
public function testPostGlobals()
{
$registry = $this->getMockBuilder('\registry')
->disableOriginalConstructor()
->getMock();
$registry->expects($this->atLeastOnce())
->method('set')
->with(
$this->stringStartsWith('GV_'),
$this->anything(),
$this->isType('string'));
self::$DI['app']['phraseanet.registry'] = $registry;
self::$DI['client'] = new Symfony\Component\HttpKernel\Client(self::$DI['app']);
self::$DI['client']->request('POST', '/admin/setup/');
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
}
}