Refactor Appbox

This commit is contained in:
Romain Neutron
2012-02-21 16:19:08 +01:00
parent df745a69fb
commit 7d41a36694
18 changed files with 49 additions and 48 deletions

View File

@@ -29,7 +29,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$usr_id = User_Adapter::get_usr_id_from_login('test_phpunit2');
try
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$template = User_Adapter::getInstance($usr_id, $appbox);
$template->delete();
}
@@ -40,7 +40,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
$usr_id = User_Adapter::get_usr_id_from_login('test_phpunit3');
try
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$cobaye = User_Adapter::getInstance($usr_id, $appbox);
$cobaye->delete();
}
@@ -53,7 +53,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testApply_model()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$template = User_Adapter::create($appbox, 'test_phpunit2', 'blabla2', 'test2@example.com', false);
$template->set_template(self::$user);
@@ -85,7 +85,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testRevoke_access_from_bases()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$base_ids = array();
foreach ($appbox->get_databoxes() as $databox)
@@ -110,7 +110,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testGive_access_to_base()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
@@ -126,7 +126,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testGive_access_to_sbas()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
@@ -147,7 +147,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testRevoke_unused_sbas_rights()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
$sbas_id = $databox->get_sbas_id();
@@ -172,7 +172,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testSet_quotas_on_base()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
@@ -195,7 +195,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testDuplicate_right_from_bas()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$first = true;
$base_ref = null;
@@ -238,7 +238,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testHas_right_on_base()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$rights_false = array(
'imgtools' => false
@@ -287,7 +287,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testRemaining_download()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
@@ -310,7 +310,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testRemove_remaining()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
@@ -339,7 +339,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testHas_right()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$rights = array(
@@ -363,7 +363,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testHas_right_on_sbas()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$rights_false = array(
'bas_modify_struct' => false
@@ -403,7 +403,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testGet_mask_and()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
@@ -427,7 +427,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testGet_mask_xor()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
foreach ($databox->get_collections() as $collection)
@@ -451,7 +451,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testHas_access_to_base()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$base_ids = array();
$n = 0;
foreach ($appbox->get_databoxes() as $databox)
@@ -512,7 +512,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testGet_granted_base()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$base_ids = array();
$n = 0;
foreach ($appbox->get_databoxes() as $databox)
@@ -551,7 +551,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testGet_granted_sbas()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$sbas_ids = array();
$n = 0;
foreach ($appbox->get_databoxes() as $databox)
@@ -583,7 +583,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testHas_access_to_module()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
foreach ($appbox->get_databoxes() as $databox)
{
@@ -654,7 +654,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testis_limited()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$found = false;
@@ -703,7 +703,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testget_limits()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$found = false;

View File

@@ -823,12 +823,13 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
$serviceName = $configuration->getTemplating();
$confService = $configuration->getService($serviceName);
$templateServiceBuilder = new \Alchemy\Phrasea\Core\ServiceBuilder\TemplateEngine(
$templateServiceBuilder = \Alchemy\Phrasea\Core\Service\Builder::create(
self::$core,
$serviceName
, $confService
);
$this->app['Core']["Twig"] = $templateServiceBuilder->buildService()->getService();
$this->app['Core']["Twig"] = $templateServiceBuilder->getService();
}
/**
@@ -837,7 +838,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
*/
private static function updateTablesSchema()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
if (!self::$updated)
{
@@ -889,7 +890,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
*/
private static function createSetOfUserTests()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$usr_id = User_Adapter::get_usr_id_from_login('test_phpunit');
$usr_alt1_id = User_Adapter::get_usr_id_from_login('test_phpunit_alt1');
@@ -925,7 +926,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
*/
private static function giveRightsToUser(\User_Adapter $user)
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$user->ACL()->give_access_to_sbas(array_keys($appbox->get_databoxes()));
@@ -979,7 +980,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
*/
private static function setCollection()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$coll = $collection_no_acces = null;
foreach ($appbox->get_databoxes() as $databox)

View File

@@ -27,7 +27,7 @@ abstract class PhraseanetPHPUnitAuthenticatedAbstract extends PhraseanetPHPUnitA
public function setUp()
{
parent::setUp();
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$session = $appbox->get_session();
$auth = new Session_Authentication_None(self::$user);
$session->authenticate($auth);
@@ -35,7 +35,7 @@ abstract class PhraseanetPHPUnitAuthenticatedAbstract extends PhraseanetPHPUnitA
public function tearDown()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$session = $appbox->get_session();
$session->logout();
parent::tearDown();

View File

@@ -27,7 +27,7 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$session = $appbox->get_session();
$auth = new Session_Authentication_None(self::$user);
$session->authenticate($auth);
@@ -36,7 +36,7 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
public static function tearDownAfterClass()
{
parent::tearDownAfterClass();
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$session = $appbox->get_session();
$session->logout();
}

View File

@@ -17,7 +17,7 @@ class collectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$auth = new Session_Authentication_None(self::$user);
$appbox->get_session()->authenticate($auth);
@@ -46,7 +46,7 @@ class collectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testEnable()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$base_id = self::$object->get_base_id();
$coll_id = self::$object->get_coll_id();
self::$object->disable($appbox);

View File

@@ -177,7 +177,7 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testGet_mime()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$found = $coll = false;
foreach ($appbox->get_databoxes() as $databox)
{
@@ -525,7 +525,7 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
*/
public function testGet_container_baskets()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$usr_id = $appbox->get_session()->get_usr_id();
$em = self::$core->getEntityManager();

View File

@@ -35,7 +35,7 @@ class activityTest extends PhraseanetPHPUnitAbstract
$this->dmax = $date->format("Y-m-d H:i:s");
$date->modify('-6 month');
$this->dmin = $date->format("Y-m-d H:i:s");
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databoxes = $appbox->get_databoxes();
$this->ret = array();
foreach ($databoxes as $databox)

View File

@@ -31,7 +31,7 @@ class addReportTest extends PhraseanetPHPUnitAbstract
$this->dmax = $date->format("Y-m-d H:i:s");
$date->modify('-6 month');
$this->dmin = $date->format("Y-m-d H:i:s");
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databoxes = $appbox->get_databoxes();
$this->ret = array();
foreach ($databoxes as $databox)

View File

@@ -32,7 +32,7 @@ class connexionReportTest extends PhraseanetPHPUnitAbstract
$thid->dmax = $date->format("Y-m-d H:i:s");
$date->modify('-6 month');
$this->dmin = $date->format("Y-m-d H:i:s");
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databoxes = $appbox->get_databoxes();
$this->ret = array();
foreach ($databoxes as $databox)

View File

@@ -31,7 +31,7 @@ class downloadReportTest extends PhraseanetPHPUnitAbstract
$thid->dmax = $date->format("Y-m-d H:i:s");
$date->modify('-6 month');
$this->dmin = $date->format("Y-m-d H:i:s");
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databoxes = $appbox->get_databoxes();
$this->ret = array();
foreach ($databoxes as $databox)

View File

@@ -31,7 +31,7 @@ class editTest extends PhraseanetPHPUnitAbstract
$this->dmax = $date->format("Y-m-d H:i:s");
$date->modify('-6 month');
$this->dmin = $date->format("Y-m-d H:i:s");
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databoxes = $appbox->get_databoxes();
$this->ret = array();
foreach ($databoxes as $databox)

View File

@@ -31,7 +31,7 @@ class filterTest extends PhraseanetPHPUnitAbstract
$thid->dmax = $date->format("Y-m-d H:i:s");
$date->modify('-6 month');
$this->dmin = $date->format("Y-m-d H:i:s");
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databoxes = $appbox->get_databoxes();
$this->ret = array();
foreach ($databoxes as $databox)

View File

@@ -31,7 +31,7 @@ class pushReportTest extends PhraseanetPHPUnitAbstract
$this->dmax = $date->format("Y-m-d H:i:s");
$date->modify('-6 month');
$this->dmin = $date->format("Y-m-d H:i:s");
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databoxes = $appbox->get_databoxes();
$this->ret = array();
foreach ($databoxes as $databox)

View File

@@ -31,7 +31,7 @@ class questionReportTest extends PhraseanetPHPUnitAbstract
$thid->dmax = $date->format("Y-m-d H:i:s");
$date->modify('-6 month');
$this->dmin = $date->format("Y-m-d H:i:s");
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databoxes = $appbox->get_databoxes();
$this->ret = array();
foreach ($databoxes as $databox)

View File

@@ -44,7 +44,7 @@ class reportTest extends PhraseanetPHPUnitAbstract
$thid->dmax = $date->format("Y-m-d H:i:s");
$date->modify('-6 month');
$this->dmin = $date->format("Y-m-d H:i:s");
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databoxes = $appbox->get_databoxes();
$this->ret = array();
foreach ($databoxes as $databox)

View File

@@ -34,7 +34,7 @@ class sqlFilterTest extends PhraseanetPHPUnitAbstract
$dmax = $date->format("Y-m-d H:i:s");
$date->modify('-6 month');
$dmin = $date->format("Y-m-d H:i:s");
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databoxes = $appbox->get_databoxes();
$ret = array();
foreach ($databoxes as $databox)

View File

@@ -238,7 +238,7 @@ class system_fileTest extends PhraseanetPHPUnitAbstract
public function testExtract_metadatas()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$databox = null;
foreach ($appbox->get_databoxes() as $d)
{

View File

@@ -11,7 +11,7 @@ class task_abstractTest extends PhraseanetPHPUnitAbstract
public function testCreate()
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance(\bootstrap::getCore());
$task = task_abstract::create($appbox, 'task_period_apibridge');
$task->delete();