mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
fix testes
This commit is contained in:
@@ -58,14 +58,13 @@ class ConfigurationTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
$this->assertEquals('prod', $configuration->getEnvironnement());
|
$this->assertEquals('prod', $configuration->getEnvironnement());
|
||||||
$this->assertTrue($configuration->isInstalled());
|
$this->assertTrue($configuration->isInstalled());
|
||||||
$this->assertInstanceOf(
|
$this->assertInstanceOf(
|
||||||
'Alchemy\Phrasea\Core\Configuration\Parameter'
|
'\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag'
|
||||||
, $configuration->getConfiguration()
|
, $configuration->getConfiguration()
|
||||||
);
|
);
|
||||||
$this->assertFalse($configuration->isDebug());
|
$this->assertFalse($configuration->isDebug());
|
||||||
$this->assertFalse($configuration->displayErrors());
|
$this->assertFalse($configuration->isDisplayingErrors());
|
||||||
$this->assertFalse($configuration->isMaintained());
|
$this->assertFalse($configuration->isMaintained());
|
||||||
$this->assertTrue(is_array($configuration->getPhraseanet()->all()));
|
$this->assertTrue(is_array($configuration->getPhraseanet()->all()));
|
||||||
// $this->assertTrue(is_array($configuration->getDoctrine()->all()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInstalled()
|
public function testInstalled()
|
||||||
@@ -83,10 +82,17 @@ class ConfigurationTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
|
|
||||||
$configuration = new PhraseaCore\Configuration($handler);
|
$configuration = new PhraseaCore\Configuration($handler);
|
||||||
$configuration->setEnvironnement('prod');
|
$configuration->setEnvironnement('prod');
|
||||||
|
|
||||||
$this->assertFalse($configuration->isInstalled());
|
$this->assertFalse($configuration->isInstalled());
|
||||||
$this->assertTrue(is_array($configuration->getPhraseanet()->all()));
|
try
|
||||||
// $this->assertTrue(is_array($configuration->getDoctrine()->all()));
|
{
|
||||||
|
$configuration->getPhraseanet();
|
||||||
|
$this->fail("should raise an exception because application is not yet installed");
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAvailableLogger()
|
public function testGetAvailableLogger()
|
||||||
@@ -96,14 +102,14 @@ class ConfigurationTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
|
|
||||||
$configuration = new PhraseaCore\Configuration($handler);
|
$configuration = new PhraseaCore\Configuration($handler);
|
||||||
$configuration->setEnvironnement('prod');
|
$configuration->setEnvironnement('prod');
|
||||||
|
|
||||||
$availableLogger = $configuration->getAvailableDoctrineLogger();
|
$availableLogger = $configuration->getAvailableDoctrineLogger();
|
||||||
|
|
||||||
$this->assertTrue(is_array($availableLogger));
|
$this->assertTrue(is_array($availableLogger));
|
||||||
$this->assertContains('monolog', $availableLogger);
|
$this->assertContains('monolog', $availableLogger);
|
||||||
$this->assertContains('echo', $availableLogger);
|
$this->assertContains('echo', $availableLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetHandler()
|
public function testGetHandler()
|
||||||
{
|
{
|
||||||
$spec = $this->getMock('\Alchemy\Phrasea\Core\Configuration\Application');
|
$spec = $this->getMock('\Alchemy\Phrasea\Core\Configuration\Application');
|
||||||
@@ -111,10 +117,10 @@ class ConfigurationTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
|
|
||||||
$configuration = new PhraseaCore\Configuration($handler);
|
$configuration = new PhraseaCore\Configuration($handler);
|
||||||
$configuration->setEnvironnement('prod');
|
$configuration->setEnvironnement('prod');
|
||||||
|
|
||||||
$this->assertInstanceOf('\Alchemy\Phrasea\Core\Configuration\Handler', $configuration->getConfigurationHandler());
|
$this->assertInstanceOf('\Alchemy\Phrasea\Core\Configuration\Handler', $configuration->getConfigurationHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetHandler()
|
public function testSetHandler()
|
||||||
{
|
{
|
||||||
$spec = $this->getMock('\Alchemy\Phrasea\Core\Configuration\Application');
|
$spec = $this->getMock('\Alchemy\Phrasea\Core\Configuration\Application');
|
||||||
@@ -122,9 +128,9 @@ class ConfigurationTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
|
|
||||||
$configuration = new PhraseaCore\Configuration($handler);
|
$configuration = new PhraseaCore\Configuration($handler);
|
||||||
$configuration->setEnvironnement('prod');
|
$configuration->setEnvironnement('prod');
|
||||||
|
|
||||||
$spec2 = $this->getMock('\Alchemy\Phrasea\Core\Configuration\Application');
|
$spec2 = $this->getMock('\Alchemy\Phrasea\Core\Configuration\Application');
|
||||||
|
|
||||||
$spec2->expects($this->any())
|
$spec2->expects($this->any())
|
||||||
->method('getConfigurationFile')
|
->method('getConfigurationFile')
|
||||||
->will(
|
->will(
|
||||||
@@ -132,11 +138,11 @@ class ConfigurationTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
'test'
|
'test'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$newHandler = new Configuration\Handler($spec2, new Configuration\Parser\Yaml());
|
$newHandler = new Configuration\Handler($spec2, new Configuration\Parser\Yaml());
|
||||||
|
|
||||||
$configuration->setConfigurationHandler($newHandler);
|
$configuration->setConfigurationHandler($newHandler);
|
||||||
|
|
||||||
$this->assertEquals('test', $configuration->getConfigurationHandler()->getSpecification()->getConfigurationFile());
|
$this->assertEquals('test', $configuration->getConfigurationHandler()->getSpecification()->getConfigurationFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
require_once dirname(__FILE__) . '/../../bootstrap.php';
|
require_once dirname(__FILE__) . '/../../bootstrap.php';
|
||||||
|
|
||||||
|
$new_include_path = __DIR__ . "/../../vendor/" . PATH_SEPARATOR . get_include_path();
|
||||||
|
set_include_path($new_include_path);
|
||||||
|
|
||||||
|
require_once __DIR__ . "/../../vendor/Phlickr/Api.php";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Phraseanet
|
* This file is part of Phraseanet
|
||||||
*
|
*
|
||||||
|
@@ -11,19 +11,21 @@
|
|||||||
|
|
||||||
require_once __DIR__ . "/../../lib/classes/bootstrap.class.php";
|
require_once __DIR__ . "/../../lib/classes/bootstrap.class.php";
|
||||||
|
|
||||||
|
use Silex\WebTestCase;
|
||||||
|
use Symfony\Component\HttpKernel\Client;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Doctrine\Common\DataFixtures\Loader;
|
||||||
|
use PhraseaFixture\Basket as MyFixture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package
|
* @package
|
||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bootstrap::execute('test');
|
bootstrap::execute('test');
|
||||||
|
|
||||||
use Silex\WebTestCase;
|
|
||||||
use Symfony\Component\HttpKernel\Client;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Doctrine\Common\DataFixtures\Loader;
|
|
||||||
use PhraseaFixture\Basket as MyFixture;
|
|
||||||
|
|
||||||
abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||||
{
|
{
|
||||||
@@ -394,7 +396,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
self::$time_start = microtime(true);
|
self::$time_start = microtime(true);
|
||||||
echo "\033[1;35m\n==Start==\033[0;37m\r\n";
|
echo "\033[1;35m\n==Start==\033[0;37m\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
self::updateTablesSchema();
|
self::updateTablesSchema();
|
||||||
|
|
||||||
self::createSetOfUserTests();
|
self::createSetOfUserTests();
|
||||||
@@ -730,8 +732,22 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
*/
|
*/
|
||||||
protected function resetTwig()
|
protected function resetTwig()
|
||||||
{
|
{
|
||||||
$serviceTwig = new \Alchemy\Phrasea\Core\Service\Twig(array());
|
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||||
$this->app['Core']["Twig"] = $serviceTwig->getTwig();
|
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
||||||
|
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||||
|
);
|
||||||
|
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||||
|
|
||||||
|
$serviceName = $configuration->getTemplating();
|
||||||
|
$confService = $configuration->getService($serviceName);
|
||||||
|
|
||||||
|
$templateService = \Alchemy\Phrasea\Core\ServiceBuilder::build(
|
||||||
|
$serviceName
|
||||||
|
, \Alchemy\Phrasea\Core\ServiceBuilder::TEMPLATE_ENGINE
|
||||||
|
, $confService->get("type")
|
||||||
|
, $confService->get("options")
|
||||||
|
);
|
||||||
|
$this->app['Core']["Twig"] = $templateService->getService();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user