mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
Cleanup $registry use
This commit is contained in:
@@ -8,7 +8,6 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
{
|
{
|
||||||
function testDatafilesRouteAuthenticated()
|
function testDatafilesRouteAuthenticated()
|
||||||
{
|
{
|
||||||
$registry = self::$DI['app']['phraseanet.registry'];
|
|
||||||
$crawler = self::$DI['client']->request('GET', '/datafiles/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/preview/');
|
$crawler = self::$DI['client']->request('GET', '/datafiles/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/preview/');
|
||||||
$response = self::$DI['client']->getResponse();
|
$response = self::$DI['client']->getResponse();
|
||||||
|
|
||||||
|
@@ -45,10 +45,8 @@ class ApplicationSetupTest extends PhraseanetWebTestCaseAbstract
|
|||||||
'GV_pdftotext',
|
'GV_pdftotext',
|
||||||
);
|
);
|
||||||
|
|
||||||
$registry = self::$DI['app']['phraseanet.registry'];
|
|
||||||
|
|
||||||
foreach ($params as $param) {
|
foreach ($params as $param) {
|
||||||
$this->registry[$param] = $registry->get($param);
|
$this->registry[$param] = self::$DI['app']['phraseanet.registry']->get($param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,10 +55,8 @@ class ApplicationSetupTest extends PhraseanetWebTestCaseAbstract
|
|||||||
$this->temporaryReInstall();
|
$this->temporaryReInstall();
|
||||||
self::$DI['app']['phraseanet.appbox']->set_connection($this->connection);
|
self::$DI['app']['phraseanet.appbox']->set_connection($this->connection);
|
||||||
|
|
||||||
$registry = self::$DI['app']['phraseanet.registry'];
|
|
||||||
|
|
||||||
foreach ($this->registry as $param => $value) {
|
foreach ($this->registry as $param => $value) {
|
||||||
$registry->set($param, $value, \registry::TYPE_STRING);
|
self::$DI['app']['phraseanet.registry']->set($param, $value, \registry::TYPE_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
|
@@ -25,8 +25,6 @@ class OrmBuilderTest extends PhraseanetPHPUnitAbstract
|
|||||||
|
|
||||||
public function testCreate()
|
public function testCreate()
|
||||||
{
|
{
|
||||||
$registry = $this->getMock("\RegistryInterface");
|
|
||||||
|
|
||||||
$configuration = new ParameterBag(
|
$configuration = new ParameterBag(
|
||||||
array("type" => "Orm\\Doctrine", "options" => array(
|
array("type" => "Orm\\Doctrine", "options" => array(
|
||||||
"debug" => false
|
"debug" => false
|
||||||
|
@@ -206,33 +206,30 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
public function testGet_homepage_link()
|
public function testGet_homepage_link()
|
||||||
{
|
{
|
||||||
self::$object->set_public(false);
|
self::$object->set_public(false);
|
||||||
$registry = self::$DI['app']['phraseanet.registry'];
|
$link = self::$object->get_homepage_link(self::$DI['app']['phraseanet.registry'], Feed_Adapter::FORMAT_ATOM);
|
||||||
$link = self::$object->get_homepage_link($registry, Feed_Adapter::FORMAT_ATOM);
|
|
||||||
$this->assertNull($link);
|
$this->assertNull($link);
|
||||||
|
|
||||||
self::$object->set_public(true);
|
self::$object->set_public(true);
|
||||||
$link = self::$object->get_homepage_link($registry, Feed_Adapter::FORMAT_ATOM);
|
$link = self::$object->get_homepage_link(self::$DI['app']['phraseanet.registry'], Feed_Adapter::FORMAT_ATOM);
|
||||||
$this->assertInstanceOf('Feed_Link', $link);
|
$this->assertInstanceOf('Feed_Link', $link);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGet_user_link()
|
public function testGet_user_link()
|
||||||
{
|
{
|
||||||
$registry = self::$DI['app']['phraseanet.registry'];
|
$link = self::$object->get_user_link(self::$DI['app']['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_ATOM);
|
||||||
|
|
||||||
$link = self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM);
|
|
||||||
$supposed = '/feeds\/userfeed\/([a-zA-Z0-9]{12})\/' . self::$object->get_id() . '\/atom\//';
|
$supposed = '/feeds\/userfeed\/([a-zA-Z0-9]{12})\/' . self::$object->get_id() . '\/atom\//';
|
||||||
|
|
||||||
$atom = $link->get_href();
|
$atom = $link->get_href();
|
||||||
|
|
||||||
$this->assertRegExp($supposed, str_replace($registry->get('GV_ServerName'), '', $atom));
|
$this->assertRegExp($supposed, str_replace(self::$DI['app']['phraseanet.registry']->get('GV_ServerName'), '', $atom));
|
||||||
$this->assertEquals($atom, self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href());
|
$this->assertEquals($atom, self::$object->get_user_link(self::$DI['app']['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href());
|
||||||
$this->assertEquals($atom, self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href());
|
$this->assertEquals($atom, self::$object->get_user_link(self::$DI['app']['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href());
|
||||||
|
|
||||||
$this->assertNotEquals($atom, self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM, null, true)->get_href());
|
$this->assertNotEquals($atom, self::$object->get_user_link(self::$DI['app']['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_ATOM, null, true)->get_href());
|
||||||
|
|
||||||
$link = self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_RSS);
|
$link = self::$object->get_user_link(self::$DI['app']['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_RSS);
|
||||||
$supposed = '/feeds\/userfeed\/([a-zA-Z0-9]{12})\/' . self::$object->get_id() . '\/rss\//';
|
$supposed = '/feeds\/userfeed\/([a-zA-Z0-9]{12})\/' . self::$object->get_id() . '\/rss\//';
|
||||||
$this->assertRegExp($supposed, str_replace($registry->get('GV_ServerName'), '', $link->get_href()));
|
$this->assertRegExp($supposed, str_replace(self::$DI['app']['phraseanet.registry']->get('GV_ServerName'), '', $link->get_href()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGet_title()
|
public function testGet_title()
|
||||||
|
@@ -56,30 +56,27 @@ class Feed_AggregateTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
|||||||
|
|
||||||
public function testGet_homepage_link()
|
public function testGet_homepage_link()
|
||||||
{
|
{
|
||||||
$registry = self::$DI['app']['phraseanet.registry'];
|
$link = self::$object->get_homepage_link(self::$DI['app']['phraseanet.registry'], Feed_Adapter::FORMAT_ATOM);
|
||||||
$link = self::$object->get_homepage_link($registry, Feed_Adapter::FORMAT_ATOM);
|
|
||||||
$this->assertInstanceOf('Feed_Link', $link);
|
$this->assertInstanceOf('Feed_Link', $link);
|
||||||
$this->assertEquals($registry->get('GV_ServerName') . 'feeds/aggregated/atom/', $link->get_href());
|
$this->assertEquals(self::$DI['app']['phraseanet.registry']->get('GV_ServerName') . 'feeds/aggregated/atom/', $link->get_href());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGet_user_link()
|
public function testGet_user_link()
|
||||||
{
|
{
|
||||||
$registry = self::$DI['app']['phraseanet.registry'];
|
$link = self::$object->get_user_link(self::$DI['app']['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_ATOM);
|
||||||
|
|
||||||
$link = self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM);
|
|
||||||
$supposed = '/feeds\/userfeed\/aggregated\/([a-zA-Z0-9]{12})\/atom\//';
|
$supposed = '/feeds\/userfeed\/aggregated\/([a-zA-Z0-9]{12})\/atom\//';
|
||||||
|
|
||||||
$atom = $link->get_href();
|
$atom = $link->get_href();
|
||||||
|
|
||||||
$this->assertRegExp($supposed, str_replace($registry->get('GV_ServerName'), '', $atom));
|
$this->assertRegExp($supposed, str_replace(self::$DI['app']['phraseanet.registry']->get('GV_ServerName'), '', $atom));
|
||||||
$this->assertEquals($atom, self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href());
|
$this->assertEquals($atom, self::$object->get_user_link(self::$DI['app']['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href());
|
||||||
$this->assertEquals($atom, self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href());
|
$this->assertEquals($atom, self::$object->get_user_link(self::$DI['app']['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href());
|
||||||
|
|
||||||
$this->assertNotEquals($atom, self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM, null, true)->get_href());
|
$this->assertNotEquals($atom, self::$object->get_user_link(self::$DI['app']['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_ATOM, null, true)->get_href());
|
||||||
|
|
||||||
$link = self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_RSS);
|
$link = self::$object->get_user_link(self::$DI['app']['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_RSS);
|
||||||
$supposed = '/feeds\/userfeed\/aggregated\/([a-zA-Z0-9]{12})\/rss\//';
|
$supposed = '/feeds\/userfeed\/aggregated\/([a-zA-Z0-9]{12})\/rss\//';
|
||||||
$this->assertRegExp($supposed, str_replace($registry->get('GV_ServerName'), '', $link->get_href()));
|
$this->assertRegExp($supposed, str_replace(self::$DI['app']['phraseanet.registry']->get('GV_ServerName'), '', $link->get_href()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGet_created_on()
|
public function testGet_created_on()
|
||||||
|
@@ -92,8 +92,6 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
|
|||||||
|
|
||||||
public function createDatabox()
|
public function createDatabox()
|
||||||
{
|
{
|
||||||
$registry = self::$DI['app']['phraseanet.registry'];
|
|
||||||
|
|
||||||
$this->createDatabase();
|
$this->createDatabase();
|
||||||
|
|
||||||
$configuration = self::$DI['app']['phraseanet.configuration'];
|
$configuration = self::$DI['app']['phraseanet.configuration'];
|
||||||
@@ -102,14 +100,14 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
|
|||||||
$connexion = $configuration->getConnexion($choosenConnexion);
|
$connexion = $configuration->getConnexion($choosenConnexion);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$conn = new \connection_pdo('databox_creation', $connexion->get('host'), $connexion->get('port'), $connexion->get('user'), $connexion->get('password'), 'unit_test_db', array(), $registry);
|
$conn = new \connection_pdo('databox_creation', $connexion->get('host'), $connexion->get('port'), $connexion->get('user'), $connexion->get('password'), 'unit_test_db', array(), self::$DI['app']['phraseanet.registry']);
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
|
|
||||||
$this->markTestSkipped('Could not reach DB');
|
$this->markTestSkipped('Could not reach DB');
|
||||||
}
|
}
|
||||||
|
|
||||||
$databox = \databox::create(
|
$databox = \databox::create(
|
||||||
self::$DI['app'], $conn, new \SplFileInfo($registry->get('GV_RootPath') . 'lib/conf.d/data_templates/fr-simple.xml'), $registry
|
self::$DI['app'], $conn, new \SplFileInfo(self::$DI['app']['phraseanet.registry']->get('GV_RootPath') . 'lib/conf.d/data_templates/fr-simple.xml'), self::$DI['app']['phraseanet.registry']
|
||||||
);
|
);
|
||||||
|
|
||||||
self::$createdDataboxes[] = $databox;
|
self::$createdDataboxes[] = $databox;
|
||||||
|
@@ -38,14 +38,12 @@ class Session_LoggerTest extends PhraseanetPHPUnitAbstract
|
|||||||
$log_id = $this->object->get_id();
|
$log_id = $this->object->get_id();
|
||||||
$this->assertTrue(is_int($log_id));
|
$this->assertTrue(is_int($log_id));
|
||||||
|
|
||||||
$registry = self::$DI['app']['phraseanet.registry'];
|
|
||||||
|
|
||||||
$sql = 'SELECT id FROM log
|
$sql = 'SELECT id FROM log
|
||||||
WHERE sit_session = :ses_id AND usrid = :usr_id AND site = :site';
|
WHERE sit_session = :ses_id AND usrid = :usr_id AND site = :site';
|
||||||
$params = array(
|
$params = array(
|
||||||
':ses_id' => self::$DI['app']['session']->get('phrasea_session_id')
|
':ses_id' => self::$DI['app']['session']->get('phrasea_session_id')
|
||||||
, ':usr_id' => self::$DI['app']['phraseanet.user']->get_id()
|
, ':usr_id' => self::$DI['app']['phraseanet.user']->get_id()
|
||||||
, ':site' => $registry->get('GV_sit')
|
, ':site' => self::$DI['app']['phraseanet.registry']->get('GV_sit')
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt = $this->databox->get_connection()->prepare($sql);
|
$stmt = $this->databox->get_connection()->prepare($sql);
|
||||||
@@ -64,7 +62,7 @@ class Session_LoggerTest extends PhraseanetPHPUnitAbstract
|
|||||||
$params = array(
|
$params = array(
|
||||||
':ses_id' => $ses_id
|
':ses_id' => $ses_id
|
||||||
, ':usr_id' => $usr_id
|
, ':usr_id' => $usr_id
|
||||||
, ':site' => $registry->get('GV_sit')
|
, ':site' => self::$DI['app']['phraseanet.registry']->get('GV_sit')
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt = $this->databox->get_connection()->prepare($sql);
|
$stmt = $this->databox->get_connection()->prepare($sql);
|
||||||
|
@@ -43,11 +43,10 @@ class media_Permalink_AdapterTest extends PhraseanetPHPUnitAbstract
|
|||||||
|
|
||||||
public function testGet_url()
|
public function testGet_url()
|
||||||
{
|
{
|
||||||
$registry = self::$DI['app']['phraseanet.registry'];
|
$url = self::$DI['app']['phraseanet.registry']->get('GV_ServerName') . 'permalink/v1/' . static::$object->get_label() . '/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/' .
|
||||||
$url = $registry->get('GV_ServerName') . 'permalink/v1/' . static::$object->get_label() . '/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/' .
|
|
||||||
static::$object->get_token() . '/document/';
|
static::$object->get_token() . '/document/';
|
||||||
|
|
||||||
$this->assertEquals($url, static::$object->get_url($registry));
|
$this->assertEquals($url, static::$object->get_url(self::$DI['app']['phraseanet.registry']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user