mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Lazy load users
This commit is contained in:
@@ -14,7 +14,7 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
self::$object = self::$user->ACL();
|
||||
self::$object = self::$DI['user']->ACL();
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
@@ -43,24 +43,24 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testHasAccesToRecord()
|
||||
{
|
||||
$this->assertTrue(self::$object->has_status_access_to_record(self::$records['record_1']));
|
||||
$this->assertTrue(self::$object->has_status_access_to_record(self::$DI['record_1']));
|
||||
}
|
||||
|
||||
public function testHasAccesToRecordFailsOnBase()
|
||||
{
|
||||
$this->assertFalse(self::$object->has_status_access_to_record(self::$records['record_no_access']));
|
||||
$this->assertFalse(self::$object->has_status_access_to_record(self::$DI['record_no_access']));
|
||||
}
|
||||
|
||||
public function testHasAccesToRecordFailsOnStatus()
|
||||
{
|
||||
$this->assertFalse(self::$object->has_status_access_to_record(self::$records['record_no_access_by_status']));
|
||||
$this->assertFalse(self::$object->has_status_access_to_record(self::$DI['record_no_access_by_status']));
|
||||
}
|
||||
|
||||
public function testApply_model()
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$template = User_Adapter::create(self::$application, 'test_phpunit2', 'blabla2', 'test2@example.com', false);
|
||||
$template->set_template(self::$user);
|
||||
$template->set_template(self::$DI['user']);
|
||||
|
||||
$base_ids = array();
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
@@ -92,17 +92,17 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
self::$user->ACL()->revoke_access_from_bases(array($base_id));
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_base($base_id));
|
||||
self::$user->ACL()->give_access_to_base(array($base_id));
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_base($base_id));
|
||||
self::$DI['user']->ACL()->revoke_access_from_bases(array($base_id));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_base($base_id));
|
||||
self::$DI['user']->ACL()->give_access_to_base(array($base_id));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_base($base_id));
|
||||
$base_ids[] = $base_id;
|
||||
}
|
||||
}
|
||||
self::$user->ACL()->revoke_access_from_bases($base_ids);
|
||||
self::$DI['user']->ACL()->revoke_access_from_bases($base_ids);
|
||||
|
||||
foreach ($base_ids as $base_id) {
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_base($base_id));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_base($base_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,9 +113,9 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_base($base_id));
|
||||
self::$user->ACL()->give_access_to_base(array($base_id));
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_base($base_id));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_base($base_id));
|
||||
self::$DI['user']->ACL()->give_access_to_base(array($base_id));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_base($base_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,11 +131,11 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$base_ids[] = $collection->get_base_id();
|
||||
}
|
||||
|
||||
self::$user->ACL()->revoke_access_from_bases($base_ids);
|
||||
self::$user->ACL()->revoke_unused_sbas_rights();
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_sbas($sbas_id));
|
||||
self::$user->ACL()->give_access_to_sbas(array($sbas_id));
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_sbas($sbas_id));
|
||||
self::$DI['user']->ACL()->revoke_access_from_bases($base_ids);
|
||||
self::$DI['user']->ACL()->revoke_unused_sbas_rights();
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_sbas($sbas_id));
|
||||
self::$DI['user']->ACL()->give_access_to_sbas(array($sbas_id));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_sbas($sbas_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,11 +149,11 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$base_ids[] = $collection->get_base_id();
|
||||
}
|
||||
|
||||
self::$user->ACL()->revoke_access_from_bases($base_ids);
|
||||
self::$user->ACL()->give_access_to_sbas(array($sbas_id));
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_sbas($sbas_id));
|
||||
self::$user->ACL()->revoke_unused_sbas_rights();
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_sbas($sbas_id));
|
||||
self::$DI['user']->ACL()->revoke_access_from_bases($base_ids);
|
||||
self::$DI['user']->ACL()->give_access_to_sbas(array($sbas_id));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_sbas($sbas_id));
|
||||
self::$DI['user']->ACL()->revoke_unused_sbas_rights();
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_sbas($sbas_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,13 +170,13 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$base_id = $collection->get_base_id();
|
||||
$droits = 50;
|
||||
$restes = 40;
|
||||
self::$user->ACL()->give_access_to_base(array($base_id));
|
||||
self::$DI['user']->ACL()->give_access_to_base(array($base_id));
|
||||
|
||||
self::$user->ACL()->set_quotas_on_base($base_id, $droits, $restes);
|
||||
$this->assertTrue(self::$user->ACL()->is_restricted_download($base_id));
|
||||
self::$DI['user']->ACL()->set_quotas_on_base($base_id, $droits, $restes);
|
||||
$this->assertTrue(self::$DI['user']->ACL()->is_restricted_download($base_id));
|
||||
|
||||
self::$user->ACL()->remove_quotas_on_base($base_id);
|
||||
$this->assertFalse(self::$user->ACL()->is_restricted_download($base_id));
|
||||
self::$DI['user']->ACL()->remove_quotas_on_base($base_id);
|
||||
$this->assertFalse(self::$DI['user']->ACL()->is_restricted_download($base_id));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -194,19 +194,19 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
|
||||
self::$user->ACL()->give_access_to_base(array($base_id));
|
||||
self::$DI['user']->ACL()->give_access_to_base(array($base_id));
|
||||
|
||||
if ($first) {
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('imgtools' => true, 'chgstatus' => true, 'canaddrecord' => true, 'canputinalbum' => true));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('imgtools' => true, 'chgstatus' => true, 'canaddrecord' => true, 'canputinalbum' => true));
|
||||
$base_ref = $base_id;
|
||||
} else {
|
||||
self::$user->ACL()->duplicate_right_from_bas($base_ref, $base_id);
|
||||
self::$DI['user']->ACL()->duplicate_right_from_bas($base_ref, $base_id);
|
||||
}
|
||||
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_base($base_id, 'imgtools'));
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_base($base_id, 'chgstatus'));
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_base($base_id, 'canaddrecord'));
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_base($base_id, 'canputinalbum'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_base($base_id, 'imgtools'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_base($base_id, 'chgstatus'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_base($base_id, 'canaddrecord'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_base($base_id, 'canputinalbum'));
|
||||
|
||||
$first = false;
|
||||
}
|
||||
@@ -242,22 +242,22 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
self::$user->ACL()->give_access_to_base(array($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, $rights_false);
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_base($base_id, 'imgtools'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_base($base_id, 'chgstatus'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_base($base_id, 'canaddrecord'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_base($base_id, 'canputinalbum'));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, $rights_true);
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_base($base_id, 'imgtools'));
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_base($base_id, 'chgstatus'));
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_base($base_id, 'canaddrecord'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_base($base_id, 'canputinalbum'));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, $rights_false);
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_base($base_id, 'imgtools'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_base($base_id, 'chgstatus'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_base($base_id, 'canaddrecord'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_base($base_id, 'canputinalbum'));
|
||||
self::$DI['user']->ACL()->give_access_to_base(array($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, $rights_false);
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_base($base_id, 'imgtools'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_base($base_id, 'chgstatus'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_base($base_id, 'canaddrecord'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_base($base_id, 'canputinalbum'));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, $rights_true);
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_base($base_id, 'imgtools'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_base($base_id, 'chgstatus'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_base($base_id, 'canaddrecord'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_base($base_id, 'canputinalbum'));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, $rights_false);
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_base($base_id, 'imgtools'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_base($base_id, 'chgstatus'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_base($base_id, 'canaddrecord'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_base($base_id, 'canputinalbum'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,13 +276,13 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$base_id = $collection->get_base_id();
|
||||
$droits = 50;
|
||||
$restes = 40;
|
||||
self::$user->ACL()->give_access_to_base(array($base_id));
|
||||
self::$DI['user']->ACL()->give_access_to_base(array($base_id));
|
||||
|
||||
self::$user->ACL()->set_quotas_on_base($base_id, $droits, $restes);
|
||||
$this->assertEquals(40, self::$user->ACL()->remaining_download($base_id));
|
||||
self::$DI['user']->ACL()->set_quotas_on_base($base_id, $droits, $restes);
|
||||
$this->assertEquals(40, self::$DI['user']->ACL()->remaining_download($base_id));
|
||||
|
||||
self::$user->ACL()->remove_quotas_on_base($base_id);
|
||||
$this->assertFalse(self::$user->ACL()->is_restricted_download($base_id));
|
||||
self::$DI['user']->ACL()->remove_quotas_on_base($base_id);
|
||||
$this->assertFalse(self::$DI['user']->ACL()->is_restricted_download($base_id));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -297,19 +297,19 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$base_id = $collection->get_base_id();
|
||||
$droits = 50;
|
||||
$restes = 40;
|
||||
self::$user->ACL()->give_access_to_base(array($base_id));
|
||||
self::$DI['user']->ACL()->give_access_to_base(array($base_id));
|
||||
|
||||
self::$user->ACL()->set_quotas_on_base($base_id, $droits, $restes);
|
||||
$this->assertEquals(40, self::$user->ACL()->remaining_download($base_id));
|
||||
self::$user->ACL()->remove_remaining($base_id, 1);
|
||||
$this->assertEquals(39, self::$user->ACL()->remaining_download($base_id));
|
||||
self::$user->ACL()->remove_remaining($base_id, 10);
|
||||
$this->assertEquals(29, self::$user->ACL()->remaining_download($base_id));
|
||||
self::$user->ACL()->remove_remaining($base_id, 100);
|
||||
$this->assertEquals(0, self::$user->ACL()->remaining_download($base_id));
|
||||
self::$DI['user']->ACL()->set_quotas_on_base($base_id, $droits, $restes);
|
||||
$this->assertEquals(40, self::$DI['user']->ACL()->remaining_download($base_id));
|
||||
self::$DI['user']->ACL()->remove_remaining($base_id, 1);
|
||||
$this->assertEquals(39, self::$DI['user']->ACL()->remaining_download($base_id));
|
||||
self::$DI['user']->ACL()->remove_remaining($base_id, 10);
|
||||
$this->assertEquals(29, self::$DI['user']->ACL()->remaining_download($base_id));
|
||||
self::$DI['user']->ACL()->remove_remaining($base_id, 100);
|
||||
$this->assertEquals(0, self::$DI['user']->ACL()->remaining_download($base_id));
|
||||
|
||||
self::$user->ACL()->remove_quotas_on_base($base_id);
|
||||
$this->assertFalse(self::$user->ACL()->is_restricted_download($base_id));
|
||||
self::$DI['user']->ACL()->remove_quotas_on_base($base_id);
|
||||
$this->assertFalse(self::$DI['user']->ACL()->is_restricted_download($base_id));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -326,17 +326,17 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
);
|
||||
|
||||
|
||||
$this->assertFalse(self::$user->ACL()->has_right('bas_modify_struct'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right('bas_modif_th'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right('bas_modify_struct'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right('bas_modif_th'));
|
||||
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
self::$user->ACL()->give_access_to_sbas(array($databox->get_sbas_id()));
|
||||
self::$user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights);
|
||||
self::$DI['user']->ACL()->give_access_to_sbas(array($databox->get_sbas_id()));
|
||||
self::$DI['user']->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights);
|
||||
break;
|
||||
}
|
||||
|
||||
$this->assertTrue(self::$user->ACL()->has_right('bas_modify_struct'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right('bas_modif_th'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right('bas_modify_struct'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right('bas_modif_th'));
|
||||
}
|
||||
|
||||
public function testHas_right_on_sbas()
|
||||
@@ -359,22 +359,22 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
self::$user->ACL()->give_access_to_sbas(array($databox->get_sbas_id()));
|
||||
self::$user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights_false);
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modify_struct'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_manage'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_chupub'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modif_th'));
|
||||
self::$user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights_true);
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modify_struct'));
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_manage'));
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_chupub'));
|
||||
$this->assertTrue(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modif_th'));
|
||||
self::$user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights_false);
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modify_struct'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_manage'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_chupub'));
|
||||
$this->assertFalse(self::$user->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modif_th'));
|
||||
self::$DI['user']->ACL()->give_access_to_sbas(array($databox->get_sbas_id()));
|
||||
self::$DI['user']->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights_false);
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modify_struct'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_manage'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_chupub'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modif_th'));
|
||||
self::$DI['user']->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights_true);
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modify_struct'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_manage'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_chupub'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modif_th'));
|
||||
self::$DI['user']->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights_false);
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modify_struct'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_manage'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_chupub'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right_on_sbas($databox->get_sbas_id(), 'bas_modif_th'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,15 +385,15 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
|
||||
self::$user->ACL()->give_access_to_base(array($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('actif' => false));
|
||||
$this->assertFalse(self::$user->ACL()->get_mask_and($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('mask_and' => 42));
|
||||
$this->assertEquals('42', self::$user->ACL()->get_mask_and($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('mask_and' => 1));
|
||||
$this->assertEquals('1', self::$user->ACL()->get_mask_and($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('mask_and' => 0));
|
||||
$this->assertEquals('0', self::$user->ACL()->get_mask_and($base_id));
|
||||
self::$DI['user']->ACL()->give_access_to_base(array($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('actif' => false));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->get_mask_and($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('mask_and' => 42));
|
||||
$this->assertEquals('42', self::$DI['user']->ACL()->get_mask_and($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('mask_and' => 1));
|
||||
$this->assertEquals('1', self::$DI['user']->ACL()->get_mask_and($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('mask_and' => 0));
|
||||
$this->assertEquals('0', self::$DI['user']->ACL()->get_mask_and($base_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,16 +405,16 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
|
||||
self::$user->ACL()->give_access_to_base(array($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('actif' => false));
|
||||
$this->assertFalse(self::$user->ACL()->get_mask_xor($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('actif' => true));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('mask_xor' => 42));
|
||||
$this->assertEquals('42', self::$user->ACL()->get_mask_xor($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('mask_xor' => 1));
|
||||
$this->assertEquals('1', self::$user->ACL()->get_mask_xor($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('mask_xor' => 0));
|
||||
$this->assertEquals('0', self::$user->ACL()->get_mask_xor($base_id));
|
||||
self::$DI['user']->ACL()->give_access_to_base(array($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('actif' => false));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->get_mask_xor($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('actif' => true));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('mask_xor' => 42));
|
||||
$this->assertEquals('42', self::$DI['user']->ACL()->get_mask_xor($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('mask_xor' => 1));
|
||||
$this->assertEquals('1', self::$DI['user']->ACL()->get_mask_xor($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('mask_xor' => 0));
|
||||
$this->assertEquals('0', self::$DI['user']->ACL()->get_mask_xor($base_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -429,14 +429,14 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$base_ids[] = $collection->get_base_id();
|
||||
$n ++;
|
||||
}
|
||||
self::$user->ACL()->give_access_to_sbas(array($databox->get_sbas_id()));
|
||||
self::$DI['user']->ACL()->give_access_to_sbas(array($databox->get_sbas_id()));
|
||||
}
|
||||
|
||||
if ($n === 0)
|
||||
$this->fail('Not enough collection to test');
|
||||
|
||||
self::$user->ACL()->give_access_to_base($base_ids);
|
||||
$bases = array_keys(self::$user->ACL()->get_granted_base());
|
||||
self::$DI['user']->ACL()->give_access_to_base($base_ids);
|
||||
$bases = array_keys(self::$DI['user']->ACL()->get_granted_base());
|
||||
|
||||
$this->assertEquals(count($base_ids), count($bases));
|
||||
|
||||
@@ -449,28 +449,28 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$this->assertEquals(1, $row['actif']);
|
||||
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_base($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('actif' => false));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_base($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('actif' => false));
|
||||
|
||||
$stmt->execute(array(':usr_id' => self::$application['phraseanet.user']->get_id(), ':base_id' => $base_id));
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$this->assertEquals(0, $row['actif']);
|
||||
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_base($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('actif' => true));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_base($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('actif' => true));
|
||||
|
||||
$stmt->execute(array(':usr_id' => self::$application['phraseanet.user']->get_id(), ':base_id' => $base_id));
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$this->assertEquals(1, $row['actif']);
|
||||
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_base($base_id));
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('actif' => false));
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_base($base_id));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_base($base_id));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('actif' => false));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_base($base_id));
|
||||
}
|
||||
self::$user->ACL()->give_access_to_base($base_ids);
|
||||
self::$DI['user']->ACL()->give_access_to_base($base_ids);
|
||||
|
||||
foreach ($bases as $base_id) {
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_base($base_id));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_base($base_id));
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
@@ -491,8 +491,8 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
if ($n === 0)
|
||||
$this->fail('Not enough collection to test');
|
||||
|
||||
self::$user->ACL()->give_access_to_base($base_ids);
|
||||
$bases = array_keys(self::$user->ACL()->get_granted_base());
|
||||
self::$DI['user']->ACL()->give_access_to_base($base_ids);
|
||||
$bases = array_keys(self::$DI['user']->ACL()->get_granted_base());
|
||||
|
||||
$this->assertEquals(count($bases), count($base_ids));
|
||||
$this->assertEquals($n, count($base_ids));
|
||||
@@ -518,9 +518,9 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$sbas_ids[] = $databox->get_sbas_id();
|
||||
$n ++;
|
||||
}
|
||||
self::$user->ACL()->give_access_to_sbas($sbas_ids);
|
||||
self::$DI['user']->ACL()->give_access_to_sbas($sbas_ids);
|
||||
|
||||
$sbas = self::$user->ACL()->get_granted_sbas();
|
||||
$sbas = self::$DI['user']->ACL()->get_granted_sbas();
|
||||
|
||||
$this->assertEquals(count($sbas), count($sbas_ids));
|
||||
$this->assertEquals($n, count($sbas_ids));
|
||||
@@ -546,41 +546,41 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$base_id = $collection->get_base_id();
|
||||
$base_ids[] = $base_id;
|
||||
}
|
||||
self::$user->ACL()->revoke_access_from_bases($base_ids);
|
||||
self::$user->ACL()->revoke_unused_sbas_rights();
|
||||
self::$DI['user']->ACL()->revoke_access_from_bases($base_ids);
|
||||
self::$DI['user']->ACL()->revoke_unused_sbas_rights();
|
||||
}
|
||||
|
||||
if (self::$user->ACL()->is_admin())
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_module('admin'));
|
||||
if (self::$DI['user']->ACL()->is_admin())
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_module('admin'));
|
||||
else
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_module('admin'));
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_module('thesaurus'));
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_module('upload'));
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_module('report'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_module('admin'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_module('thesaurus'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_module('upload'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_module('report'));
|
||||
|
||||
$found = false;
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
$base_ids[] = $base_id;
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('canreport' => true));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('canreport' => true));
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
if ($found)
|
||||
break;
|
||||
}
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_module('report'));
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_module('thesaurus'));
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_module('upload'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_module('report'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_module('thesaurus'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_module('upload'));
|
||||
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
self::$user->ACL()->update_rights_to_sbas($databox->get_sbas_id(), array('bas_modif_th' => true));
|
||||
self::$DI['user']->ACL()->update_rights_to_sbas($databox->get_sbas_id(), array('bas_modif_th' => true));
|
||||
$found = true;
|
||||
}
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_module('report'));
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_module('thesaurus'));
|
||||
$this->assertFalse(self::$user->ACL()->has_access_to_module('upload'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_module('report'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_module('thesaurus'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_module('upload'));
|
||||
|
||||
|
||||
$found = false;
|
||||
@@ -588,16 +588,16 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
$base_ids[] = $base_id;
|
||||
self::$user->ACL()->update_rights_to_base($base_id, array('canaddrecord' => true));
|
||||
self::$DI['user']->ACL()->update_rights_to_base($base_id, array('canaddrecord' => true));
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
if ($found)
|
||||
break;
|
||||
}
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_module('report'));
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_module('thesaurus'));
|
||||
$this->assertTrue(self::$user->ACL()->has_access_to_module('upload'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_module('report'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_module('thesaurus'));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_module('upload'));
|
||||
}
|
||||
|
||||
public function testis_limited()
|
||||
@@ -610,34 +610,34 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
|
||||
if ( ! self::$user->ACL()->has_access_to_base($base_id))
|
||||
if ( ! self::$DI['user']->ACL()->has_access_to_base($base_id))
|
||||
continue;
|
||||
|
||||
$this->assertFalse(self::$user->ACL()->is_limited($base_id));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->is_limited($base_id));
|
||||
|
||||
self::$user->ACL()->set_limits($base_id, true, new DateTime('-1 day'), new DateTime('+1 day'));
|
||||
self::$DI['user']->ACL()->set_limits($base_id, true, new DateTime('-1 day'), new DateTime('+1 day'));
|
||||
|
||||
$this->assertFalse(self::$user->ACL()->is_limited($base_id));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->is_limited($base_id));
|
||||
|
||||
self::$user->ACL()->set_limits($base_id, false, new DateTime('-1 day'), new DateTime('+1 day'));
|
||||
self::$DI['user']->ACL()->set_limits($base_id, false, new DateTime('-1 day'), new DateTime('+1 day'));
|
||||
|
||||
$this->assertFalse(self::$user->ACL()->is_limited($base_id));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->is_limited($base_id));
|
||||
|
||||
self::$user->ACL()->set_limits($base_id, true, new DateTime('+1 day'), new DateTime('+2 day'));
|
||||
self::$DI['user']->ACL()->set_limits($base_id, true, new DateTime('+1 day'), new DateTime('+2 day'));
|
||||
|
||||
$this->assertTrue(self::$user->ACL()->is_limited($base_id));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->is_limited($base_id));
|
||||
|
||||
self::$user->ACL()->set_limits($base_id, true, new DateTime('-2 day'), new DateTime('-1 day'));
|
||||
self::$DI['user']->ACL()->set_limits($base_id, true, new DateTime('-2 day'), new DateTime('-1 day'));
|
||||
|
||||
$this->assertTrue(self::$user->ACL()->is_limited($base_id));
|
||||
$this->assertTrue(self::$DI['user']->ACL()->is_limited($base_id));
|
||||
|
||||
self::$user->ACL()->set_limits($base_id, true, new DateTime('-2 day'), new DateTime('+2 day'));
|
||||
self::$DI['user']->ACL()->set_limits($base_id, true, new DateTime('-2 day'), new DateTime('+2 day'));
|
||||
|
||||
$this->assertFalse(self::$user->ACL()->is_limited($base_id));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->is_limited($base_id));
|
||||
|
||||
self::$user->ACL()->set_limits($base_id, false, new DateTime('-2 day'), new DateTime('+2 day'));
|
||||
self::$DI['user']->ACL()->set_limits($base_id, false, new DateTime('-2 day'), new DateTime('+2 day'));
|
||||
|
||||
$this->assertFalse(self::$user->ACL()->is_limited($base_id));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->is_limited($base_id));
|
||||
|
||||
$found = true;
|
||||
}
|
||||
@@ -657,16 +657,16 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
|
||||
if ( ! self::$user->ACL()->has_access_to_base($base_id))
|
||||
if ( ! self::$DI['user']->ACL()->has_access_to_base($base_id))
|
||||
continue;
|
||||
|
||||
$minusone = new DateTime('-1 day');
|
||||
|
||||
$plusone = new DateTime('+1 day');
|
||||
|
||||
self::$user->ACL()->set_limits($base_id, true, $minusone, $plusone);
|
||||
self::$DI['user']->ACL()->set_limits($base_id, true, $minusone, $plusone);
|
||||
|
||||
$limits = self::$user->ACL()->get_limits($base_id);
|
||||
$limits = self::$DI['user']->ACL()->get_limits($base_id);
|
||||
|
||||
$this->assertEquals($limits['dmin'], $minusone);
|
||||
|
||||
@@ -676,17 +676,17 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
$plustwo = new DateTime('-2 day');
|
||||
|
||||
self::$user->ACL()->set_limits($base_id, true, $minustwo, $plustwo);
|
||||
self::$DI['user']->ACL()->set_limits($base_id, true, $minustwo, $plustwo);
|
||||
|
||||
$limits = self::$user->ACL()->get_limits($base_id);
|
||||
$limits = self::$DI['user']->ACL()->get_limits($base_id);
|
||||
|
||||
$this->assertEquals($limits['dmin'], $minustwo);
|
||||
|
||||
$this->assertEquals($limits['dmax'], $plustwo);
|
||||
|
||||
self::$user->ACL()->set_limits($base_id, false);
|
||||
self::$DI['user']->ACL()->set_limits($base_id, false);
|
||||
|
||||
$this->assertNull(self::$user->ACL()->get_limits($base_id));
|
||||
$this->assertNull(self::$DI['user']->ACL()->get_limits($base_id));
|
||||
|
||||
$found = true;
|
||||
}
|
||||
|
@@ -71,14 +71,14 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
self::$oauthApplication = \API_OAuth2_Application::create(self::$application, self::$user_notAdmin, 'test API v1');
|
||||
self::$account = \API_OAuth2_Account::load_with_user(self::$application, self::$oauthApplication, self::$user_notAdmin);
|
||||
self::$oauthApplication = \API_OAuth2_Application::create(self::$application, self::$DI['user_notAdmin'], 'test API v1');
|
||||
self::$account = \API_OAuth2_Account::load_with_user(self::$application, self::$oauthApplication, self::$DI['user_notAdmin']);
|
||||
self::$token = self::$account->get_token()->get_value();
|
||||
|
||||
self::$adminToken = null;
|
||||
|
||||
self::$adminApplication = \API_OAuth2_Application::create(self::$application, self::$user, 'test2 API v1');
|
||||
self::$adminAccount = \API_OAuth2_Account::load_with_user(self::$application, self::$adminApplication, self::$user);
|
||||
self::$adminApplication = \API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test2 API v1');
|
||||
self::$adminAccount = \API_OAuth2_Account::load_with_user(self::$application, self::$adminApplication, self::$DI['user']);
|
||||
self::$adminToken = self::$adminAccount->get_token()->get_value();
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
|
||||
$nativeApp = \API_OAuth2_Application::load_from_client_id(self::$application, \API_OAuth2_Application_Navigator::CLIENT_ID);
|
||||
|
||||
$account = \API_OAuth2_Account::create(self::$application, self::$user, $nativeApp);
|
||||
$account = \API_OAuth2_Account::create(self::$application, self::$DI['user'], $nativeApp);
|
||||
$token = $account->get_token()->get_value();
|
||||
$this->setToken($token);
|
||||
$this->client->request('GET', '/databoxes/list/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
|
||||
@@ -515,7 +515,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
$this->setToken(self::$token);
|
||||
|
||||
$route = '/records/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/';
|
||||
$route = '/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/';
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
$this->client->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
|
||||
$content = $this->unserialize($this->client->getResponse()->getContent());
|
||||
@@ -787,9 +787,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
$this->setToken(self::$token);
|
||||
|
||||
$this->injectMetadatas(static::$records['record_1']);
|
||||
$this->injectMetadatas(self::$DI['record_1']);
|
||||
|
||||
$route = '/records/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/caption/';
|
||||
$route = '/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/caption/';
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
|
||||
$this->client->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
|
||||
@@ -816,7 +816,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
$this->setToken(self::$token);
|
||||
|
||||
$route = '/records/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/metadatas/';
|
||||
$route = '/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/metadatas/';
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
|
||||
$this->client->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
|
||||
@@ -842,7 +842,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
$this->setToken(self::$token);
|
||||
|
||||
$route = '/records/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/status/';
|
||||
$route = '/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/status/';
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
|
||||
$this->client->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
|
||||
@@ -851,7 +851,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
$this->evaluateResponse200($this->client->getResponse());
|
||||
$this->evaluateMeta200($content);
|
||||
|
||||
$this->evaluateRecordsStatusResponse(static::$records['record_1'], $content);
|
||||
$this->evaluateRecordsStatusResponse(self::$DI['record_1'], $content);
|
||||
|
||||
$route = '/records/24892534/51654651553/status/';
|
||||
$this->evaluateNotFoundRoute($route, array('GET'));
|
||||
@@ -870,9 +870,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
$this->setToken(self::$token);
|
||||
|
||||
$keys = array_keys(static::$records['record_1']->get_subdefs());
|
||||
$keys = array_keys(self::$DI['record_1']->get_subdefs());
|
||||
|
||||
$route = '/records/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/embed/';
|
||||
$route = '/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/embed/';
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
|
||||
$this->client->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
|
||||
@@ -884,7 +884,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
$this->assertArrayHasKey('embed', $content['response']);
|
||||
|
||||
foreach ($content['response']['embed'] as $embed) {
|
||||
$this->checkEmbed($embed, static::$records['record_1']);
|
||||
$this->checkEmbed($embed, self::$DI['record_1']);
|
||||
}
|
||||
$route = '/records/24892534/51654651553/embed/';
|
||||
$this->evaluateNotFoundRoute($route, array('GET'));
|
||||
@@ -901,7 +901,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
$this->setToken(self::$token);
|
||||
|
||||
$route = '/records/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/embed/';
|
||||
$route = '/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/embed/';
|
||||
|
||||
$this->client->request('GET', $route, $this->getParameters(array('mimes' => array('image/jpg', 'image/jpeg'))), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
|
||||
$content = $this->unserialize($this->client->getResponse()->getContent());
|
||||
@@ -909,7 +909,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
$this->assertArrayHasKey('embed', $content['response']);
|
||||
|
||||
foreach ($content['response']['embed'] as $embed) {
|
||||
$this->checkEmbed($embed, static::$records['record_1']);
|
||||
$this->checkEmbed($embed, self::$DI['record_1']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -920,7 +920,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
$this->setToken(self::$token);
|
||||
|
||||
$route = '/records/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/embed/';
|
||||
$route = '/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/embed/';
|
||||
|
||||
$this->client->request('GET', $route, $this->getParameters(array('devices' => array('nodevice'))), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
|
||||
$content = $this->unserialize($this->client->getResponse()->getContent());
|
||||
@@ -935,7 +935,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
$this->setToken(self::$token);
|
||||
|
||||
$route = '/records/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/related/';
|
||||
$route = '/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/related/';
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
|
||||
$this->client->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
|
||||
@@ -1028,10 +1028,10 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
$this->setToken(self::$token);
|
||||
|
||||
$route = '/records/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/setstatus/';
|
||||
$route = '/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/setstatus/';
|
||||
|
||||
$record_status = strrev(static::$records['record_1']->get_status());
|
||||
$status_bits = static::$records['record_1']->get_databox()->get_statusbits();
|
||||
$record_status = strrev(self::$DI['record_1']->get_status());
|
||||
$status_bits = self::$DI['record_1']->get_databox()->get_statusbits();
|
||||
|
||||
$tochange = array();
|
||||
foreach ($status_bits as $n => $datas) {
|
||||
@@ -1046,7 +1046,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
/**
|
||||
* Get fresh record_1
|
||||
*/
|
||||
$testRecord = new \record_adapter(self::$application, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$testRecord = new \record_adapter(self::$application, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
|
||||
$this->evaluateResponse200($this->client->getResponse());
|
||||
$this->evaluateMeta200($content);
|
||||
@@ -1493,7 +1493,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
$title = 'Yellow title';
|
||||
$subtitle = 'Trololololo !';
|
||||
|
||||
$created_feed = \Feed_Adapter::create(self::$application, self::$user, $title, $subtitle);
|
||||
$created_feed = \Feed_Adapter::create(self::$application, self::$DI['user'], $title, $subtitle);
|
||||
|
||||
$this->setToken(self::$token);
|
||||
$route = '/feeds/list/';
|
||||
@@ -1545,11 +1545,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
$author = "W. Shakespeare";
|
||||
$author_email = "gontran.bonheur@gmail.com";
|
||||
|
||||
$created_feed = \Feed_Adapter::create(self::$application, self::$user, $title, $subtitle);
|
||||
$publisher = \Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $created_feed, self::$user);
|
||||
$created_feed = \Feed_Adapter::create(self::$application, self::$DI['user'], $title, $subtitle);
|
||||
$publisher = \Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $created_feed, self::$DI['user']);
|
||||
|
||||
$created_entry = \Feed_Entry_Adapter::create(self::$application, $created_feed, $publisher, $entry_title, $entry_subtitle, $author, $author_email);
|
||||
$created_item = \Feed_Entry_Item::create($appbox, $created_entry, static::$records['record_1']);
|
||||
$created_item = \Feed_Entry_Item::create($appbox, $created_entry, self::$DI['record_1']);
|
||||
|
||||
|
||||
$this->setToken(self::$token);
|
||||
@@ -1605,11 +1605,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
$author = "W. Shakespeare";
|
||||
$author_email = "gontran.bonheur@gmail.com";
|
||||
|
||||
$created_feed = \Feed_Adapter::create(self::$application, self::$user, $title, $subtitle);
|
||||
$publisher = \Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $created_feed, self::$user);
|
||||
$created_feed = \Feed_Adapter::create(self::$application, self::$DI['user'], $title, $subtitle);
|
||||
$publisher = \Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $created_feed, self::$DI['user']);
|
||||
|
||||
$created_entry = \Feed_Entry_Adapter::create(self::$application, $created_feed, $publisher, $entry_title, $entry_subtitle, $author, $author_email);
|
||||
$created_item = \Feed_Entry_Item::create($appbox, $created_entry, static::$records['record_1']);
|
||||
$created_item = \Feed_Entry_Item::create($appbox, $created_entry, self::$DI['record_1']);
|
||||
|
||||
$this->setToken(self::$token);
|
||||
$route = '/feeds/entry/' . $created_entry->get_id() . '/';
|
||||
@@ -1645,11 +1645,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
$author = "W. Shakespeare";
|
||||
$author_email = "gontran.bonheur@gmail.com";
|
||||
|
||||
$created_feed = \Feed_Adapter::create(self::$application, self::$user, $title, $subtitle);
|
||||
$publisher = \Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $created_feed, self::$user);
|
||||
$created_feed = \Feed_Adapter::create(self::$application, self::$DI['user'], $title, $subtitle);
|
||||
$publisher = \Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $created_feed, self::$DI['user']);
|
||||
|
||||
$created_entry = \Feed_Entry_Adapter::create(self::$application, $created_feed, $publisher, $entry_title, $entry_subtitle, $author, $author_email);
|
||||
$created_item = \Feed_Entry_Item::create($appbox, $created_entry, static::$records['record_1']);
|
||||
$created_item = \Feed_Entry_Item::create($appbox, $created_entry, self::$DI['record_1']);
|
||||
|
||||
$created_feed->set_collection(self::$collection_no_access);
|
||||
|
||||
@@ -1683,11 +1683,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
$author = "W. Shakespeare";
|
||||
$author_email = "gontran.bonheur@gmail.com";
|
||||
|
||||
$created_feed = \Feed_Adapter::create(self::$application, self::$user, $title, $subtitle);
|
||||
$publisher = \Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $created_feed, self::$user);
|
||||
$created_feed = \Feed_Adapter::create(self::$application, self::$DI['user'], $title, $subtitle);
|
||||
$publisher = \Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $created_feed, self::$DI['user']);
|
||||
|
||||
$created_entry = \Feed_Entry_Adapter::create(self::$application, $created_feed, $publisher, $entry_title, $entry_subtitle, $author, $author_email);
|
||||
$created_item = \Feed_Entry_Item::create($appbox, $created_entry, static::$records['record_1']);
|
||||
$created_item = \Feed_Entry_Item::create($appbox, $created_entry, self::$DI['record_1']);
|
||||
|
||||
$this->setToken(self::$token);
|
||||
$route = '/feeds/' . $created_feed->get_id() . '/content/';
|
||||
|
@@ -18,10 +18,10 @@ class ApplicationLightboxTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
parent::setUp();
|
||||
$this->client = $this->createClient();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$this->feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$this->feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
$publisher = array_shift($this->feed->get_publishers());
|
||||
$this->entry = Feed_Entry_Adapter::create(self::$application, $this->feed, $publisher, 'title', "sub Titkle", " jean pierre", "jp@test.com");
|
||||
$this->item = Feed_Entry_Item::create($appbox, $this->entry, static::$records['record_1']);
|
||||
$this->item = Feed_Entry_Item::create($appbox, $this->entry, self::$DI['record_1']);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
|
@@ -27,7 +27,7 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
|
||||
|
||||
self::loadApplication();
|
||||
|
||||
self::$appli = API_OAuth2_Application::create(self::$application, self::$user, 'test');
|
||||
self::$appli = API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test');
|
||||
self::$appli->set_description('une description')
|
||||
->set_redirect_uri('http://callback.com/callback/')
|
||||
->set_website('http://website.com/')
|
||||
@@ -100,7 +100,7 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
|
||||
public static function getAccount()
|
||||
{
|
||||
$sql = "SELECT api_account_id FROM api_accounts WHERE application_id = :app_id AND usr_id = :usr_id";
|
||||
$t = array(":app_id" => self::$appli->get_id(), ":usr_id" => self::$user->get_id());
|
||||
$t = array(":app_id" => self::$appli->get_id(), ":usr_id" => self::$DI['user']->get_id());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$conn = $appbox->get_connection();
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -124,7 +124,7 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
|
||||
public function testAuthorizeRedirect()
|
||||
{
|
||||
//session off
|
||||
$apps = API_OAuth2_Application::load_authorized_app_by_user(self::$application, self::$user);
|
||||
$apps = API_OAuth2_Application::load_authorized_app_by_user(self::$application, self::$DI['user']);
|
||||
foreach ($apps as $app) {
|
||||
if ($app->get_client_id() == self::$appli->get_client_id()) {
|
||||
$authorize = true;
|
||||
|
@@ -9,14 +9,14 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
function testDatafilesRouteAuthenticated()
|
||||
{
|
||||
$registry = self::$application['phraseanet.registry'];
|
||||
$crawler = $this->client->request('GET', '/datafiles/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/preview/');
|
||||
$crawler = $this->client->request('GET', '/datafiles/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/preview/');
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$content_disposition = explode(';', $response->headers->get('content-disposition'));
|
||||
$this->assertEquals('inline', $content_disposition[0]);
|
||||
$this->assertEquals(static::$records['record_1']->get_preview()->get_mime(), $response->headers->get('content-type'));
|
||||
$this->assertEquals(static::$records['record_1']->get_preview()->get_size(), $response->headers->get('content-length'));
|
||||
$this->assertEquals(self::$DI['record_1']->get_preview()->get_mime(), $response->headers->get('content-type'));
|
||||
$this->assertEquals(self::$DI['record_1']->get_preview()->get_size(), $response->headers->get('content-length'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
function testDatafilesNonExistentSubdef()
|
||||
{
|
||||
$crawler = $this->client->request('GET', '/datafiles/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/asubdefthatdoesnotexists/');
|
||||
$crawler = $this->client->request('GET', '/datafiles/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/asubdefthatdoesnotexists/');
|
||||
}
|
||||
|
||||
function testEtag()
|
||||
@@ -58,11 +58,11 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
self::$application->closeAccount();
|
||||
$crawler = $this->client->request('GET', '/datafiles/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/preview/');
|
||||
$crawler = $this->client->request('GET', '/datafiles/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/preview/');
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertEquals(403, $response->getStatusCode());
|
||||
|
||||
$crawler = $this->client->request('GET', '/datafiles/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/notfoundreview/');
|
||||
$crawler = $this->client->request('GET', '/datafiles/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/notfoundreview/');
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertEquals(403, $response->getStatusCode());
|
||||
}
|
||||
@@ -84,8 +84,8 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
protected function get_a_permalink()
|
||||
{
|
||||
$token = static::$records['record_1']->get_preview()->get_permalink()->get_token();
|
||||
$url = '/permalink/v1/whateverIwannt/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['record_1']->get_record_id() . '/' . $token . '/preview/';
|
||||
$token = self::$DI['record_1']->get_preview()->get_permalink()->get_token();
|
||||
$url = '/permalink/v1/whateverIwannt/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/' . $token . '/preview/';
|
||||
|
||||
$crawler = $this->client->request('GET', $url);
|
||||
$response = $this->client->getResponse();
|
||||
|
@@ -41,7 +41,7 @@ class FactoryTest extends \PhraseanetPHPUnitAbstract
|
||||
*/
|
||||
public function testGetFileAttributeStory()
|
||||
{
|
||||
$attribute = Factory::getFileAttribute(self::$application, AttributeInterface::NAME_STORY, static::$records['record_story_1']->get_serialize_key());
|
||||
$attribute = Factory::getFileAttribute(self::$application, AttributeInterface::NAME_STORY, self::$DI['record_story_1']->get_serialize_key());
|
||||
|
||||
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Attribute\\Story', $attribute);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ class FactoryTest extends \PhraseanetPHPUnitAbstract
|
||||
*/
|
||||
public function testGetFileAttributeStoryFailsRecord()
|
||||
{
|
||||
Factory::getFileAttribute(self::$application, AttributeInterface::NAME_STORY, static::$records['record_1']->get_serialize_key());
|
||||
Factory::getFileAttribute(self::$application, AttributeInterface::NAME_STORY, self::$DI['record_1']->get_serialize_key());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -74,7 +74,7 @@ class StoryTest extends \PhraseanetPHPUnitAbstract
|
||||
*/
|
||||
public function testConstructWrongElement()
|
||||
{
|
||||
new Story(static::$records['record_1']);
|
||||
new Story(self::$DI['record_1']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +83,7 @@ class StoryTest extends \PhraseanetPHPUnitAbstract
|
||||
*/
|
||||
public function testLoadFromStringWrongElement()
|
||||
{
|
||||
Story::loadFromString(self::$application, static::$records['record_1']->get_serialize_key());
|
||||
Story::loadFromString(self::$application, self::$DI['record_1']->get_serialize_key());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -284,7 +284,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$odd = !$odd;
|
||||
}
|
||||
|
||||
$file->addAttribute(new Attribute\Story(self::$records['record_story_1']));
|
||||
$file->addAttribute(new Attribute\Story(self::$DI['record_story_1']));
|
||||
|
||||
$status = '1';
|
||||
foreach (range(1, 63) as $i) {
|
||||
@@ -304,7 +304,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$attribute = Attribute\Factory::getFileAttribute(self::$application, $attr->getName(), $attr->getValue());
|
||||
|
||||
if ($attribute->getName() == AttributeInterface::NAME_STORY) {
|
||||
if ($attribute->getValue()->get_serialize_key() == self::$records['record_story_1']->get_serialize_key()) {
|
||||
if ($attribute->getValue()->get_serialize_key() == self::$DI['record_story_1']->get_serialize_key()) {
|
||||
$story_found = true;
|
||||
}
|
||||
} elseif ($attribute->getName() == AttributeInterface::NAME_METADATA) {
|
||||
|
@@ -10,7 +10,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
self::$application['phraseanet.user'] = self::$user;
|
||||
self::$application['phraseanet.user'] = self::$DI['user'];
|
||||
foreach (self::$createdCollections as $collection) {
|
||||
try {
|
||||
$collection->unmount_collection(self::$application);
|
||||
@@ -256,12 +256,12 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/admin/collection/' . self::$collection->get_base_id() . '/order/admins/', array(
|
||||
'admins' => array(self::$user_alt1->get_id())
|
||||
'admins' => array(self::$DI['user_alt1']->get_id())
|
||||
));
|
||||
|
||||
$this->checkRedirection($this->client->getResponse(), '/admin/collection/' . self::$collection->get_base_id() . '/?success=1');
|
||||
|
||||
$this->assertTrue(self::$user_alt1->ACL()->has_right_on_base(self::$collection->get_base_id(), 'order_master'));
|
||||
$this->assertTrue(self::$DI['user_alt1']->ACL()->has_right_on_base(self::$collection->get_base_id(), 'order_master'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -54,7 +54,7 @@ class AdminDashboardTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->setAdmin(true);
|
||||
|
||||
$this->client->request('POST', '/admin/dashboard/send-mail-test/', array(
|
||||
'email' => self::$user->get_email()
|
||||
'email' => self::$DI['user']->get_email()
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
|
@@ -16,13 +16,13 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
$crawler = $this->client->request('GET', '/admin/publications/list/');
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$user);
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$DI['user']);
|
||||
|
||||
foreach ($feeds->get_feeds() as $feed) {
|
||||
$this->assertRegExp('/\/admin\/publications\/feed\/' . $feed->get_id() . '/', $pageContent);
|
||||
if ($feed->get_collection() != null)
|
||||
$this->assertRegExp('/' . $feed->get_collection()->get_name() . '/', $pageContent);
|
||||
if ($feed->is_owner(self::$user))
|
||||
if ($feed->is_owner(self::$DI['user']))
|
||||
$this->assertEquals(1, $crawler->filterXPath("//form[@action='/admin/publications/feed/" . $feed->get_id() . "/delete/']")->count());
|
||||
}
|
||||
}
|
||||
@@ -37,14 +37,14 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$user);
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$DI['user']);
|
||||
$count = sizeof($feeds->get_feeds());
|
||||
|
||||
$crawler = $this->client->request('POST', '/admin/publications/create/', array("title" => "hello", "subtitle" => "coucou", "base_id" => self::$collection->get_base_id()));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect('/admin/publications/list/'));
|
||||
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$user);
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$DI['user']);
|
||||
$count_after = sizeof($feeds->get_feeds());
|
||||
$this->assertGreaterThan($count, $count_after);
|
||||
|
||||
@@ -56,7 +56,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
public function testGetFeed()
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
$crawler = $this->client->request('GET', '/admin/publications/feed/' . $feed->get_id() . '/');
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$this->assertEquals(1, $crawler->filterXPath("//form[@action='/admin/publications/feed/" . $feed->get_id() . "/update/']")->count());
|
||||
@@ -68,7 +68,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
|
||||
public function testUpdateFeedNotOwner()
|
||||
{
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user_alt1, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user_alt1'], "salut", 'coucou');
|
||||
$this->client->request("POST", "/admin/publications/feed/" . $feed->get_id() . "/update/");
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect(), 'update fails, i\'m redirected');
|
||||
$this->assertTrue(
|
||||
@@ -83,7 +83,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
|
||||
$this->client->request("POST", "/admin/publications/feed/" . $feed->get_id() . "/update/", array(
|
||||
'title' => 'test'
|
||||
@@ -111,7 +111,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
|
||||
$this->client->request("POST", "/admin/publications/feed/" . $feed->get_id() . "/update/", array(
|
||||
'title' => 'test'
|
||||
@@ -147,7 +147,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
|
||||
public function testIconUploadErrorOwner()
|
||||
{
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user_alt1, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user_alt1'], "salut", 'coucou');
|
||||
|
||||
$this->client->request("POST", "/admin/publications/feed/" . $feed->get_id() . "/iconupload/", array(), array(), array('HTTP_ACCEPT' => 'application/json'));
|
||||
|
||||
@@ -166,7 +166,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
|
||||
$this->client->request(
|
||||
"POST"
|
||||
@@ -188,7 +188,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
|
||||
$this->client->request(
|
||||
"POST"
|
||||
@@ -210,7 +210,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
|
||||
$files = array(
|
||||
'files' => array(
|
||||
@@ -244,10 +244,10 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
|
||||
$this->client->request("POST", "/admin/publications/feed/" . $feed->get_id() . "/addpublisher/", array(
|
||||
'usr_id' => self::$user_alt1->get_id()
|
||||
'usr_id' => self::$DI['user_alt1']->get_id()
|
||||
));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
@@ -256,7 +256,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
$feed = new Feed_Adapter(self::$application, $feed->get_id());
|
||||
$publishers = $feed->get_publishers();
|
||||
|
||||
$this->assertTrue(isset($publishers[self::$user_alt1->get_id()]));
|
||||
$this->assertTrue(isset($publishers[self::$DI['user_alt1']->get_id()]));
|
||||
$this->assertTrue(
|
||||
strpos(
|
||||
$this->client->getResponse()->headers->get('Location')
|
||||
@@ -270,7 +270,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
|
||||
$this->client->request("POST", "/admin/publications/feed/" . $feed->get_id() . "/addpublisher/");
|
||||
|
||||
@@ -290,10 +290,10 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
|
||||
$this->client->request("POST", "/admin/publications/feed/" . $feed->get_id() . "/removepublisher/", array(
|
||||
'usr_id' => self::$user_alt1->get_id()
|
||||
'usr_id' => self::$DI['user_alt1']->get_id()
|
||||
));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
@@ -302,7 +302,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
$feed = new Feed_Adapter(self::$application, $feed->get_id());
|
||||
$publishers = $feed->get_publishers();
|
||||
|
||||
$this->assertFalse(isset($publishers[self::$user_alt1->get_id()]));
|
||||
$this->assertFalse(isset($publishers[self::$DI['user_alt1']->get_id()]));
|
||||
$this->assertTrue(
|
||||
strpos(
|
||||
$this->client->getResponse()->headers->get('Location')
|
||||
@@ -316,7 +316,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
|
||||
$this->client->request("POST", "/admin/publications/feed/" . $feed->get_id() . "/removepublisher/");
|
||||
|
||||
@@ -338,7 +338,7 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "salut", 'coucou');
|
||||
|
||||
$this->client->request("POST", "/admin/publications/feed/" . $feed->get_id() . "/delete/");
|
||||
|
||||
|
@@ -12,7 +12,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->usersParameters = array("users" => implode(';', array(self::$user->get_id(), self::$user_alt1->get_id())));
|
||||
$this->usersParameters = array("users" => implode(';', array(self::$DI['user']->get_id(), self::$DI['user_alt1']->get_id())));
|
||||
}
|
||||
|
||||
public function testRouteRightsPost()
|
||||
@@ -96,8 +96,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteQuota()
|
||||
{
|
||||
$base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base()));
|
||||
$params = array('base_id' => $base_id, 'users' => self::$user->get_id());
|
||||
$base_id = array_pop(array_keys(self::$DI['user']->ACL()->get_granted_base()));
|
||||
$params = array('base_id' => $base_id, 'users' => self::$DI['user']->get_id());
|
||||
|
||||
$this->client->request('POST', '/admin/users/rights/quotas/', $params);
|
||||
$response = $this->client->getResponse();
|
||||
@@ -116,8 +116,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteQuotaRemove()
|
||||
{
|
||||
$base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base()));
|
||||
$params = array('base_id' => $base_id, 'users' => self::$user->get_id());
|
||||
$base_id = array_pop(array_keys(self::$DI['user']->ACL()->get_granted_base()));
|
||||
$params = array('base_id' => $base_id, 'users' => self::$DI['user']->get_id());
|
||||
|
||||
$this->client->request('POST', '/admin/users/rights/quotas/apply/', $params);
|
||||
$response = $this->client->getResponse();
|
||||
@@ -126,8 +126,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteRightTime()
|
||||
{
|
||||
$base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base()));
|
||||
$params = array('base_id' => $base_id, 'users' => self::$user->get_id());
|
||||
$base_id = array_pop(array_keys(self::$DI['user']->ACL()->get_granted_base()));
|
||||
$params = array('base_id' => $base_id, 'users' => self::$DI['user']->get_id());
|
||||
|
||||
$this->client->request('POST', '/admin/users/rights/time/', $params);
|
||||
$response = $this->client->getResponse();
|
||||
@@ -154,8 +154,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteRightMask()
|
||||
{
|
||||
$base_id = array_pop(array_keys(self::$user->ACL()->get_granted_base()));
|
||||
$params = array('base_id' => $base_id, 'users' => self::$user->get_id());
|
||||
$base_id = array_pop(array_keys(self::$DI['user']->ACL()->get_granted_base()));
|
||||
$params = array('base_id' => $base_id, 'users' => self::$DI['user']->get_id());
|
||||
|
||||
$this->client->request('POST', '/admin/users/rights/masks/', $params);
|
||||
$response = $this->client->getResponse();
|
||||
@@ -206,7 +206,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$templateName = uniqid('template_');
|
||||
$template = User_Adapter::create(self::$application, $templateName, "test", $templateName . "@email.com", false);
|
||||
$template->set_template(self::$user);
|
||||
$template->set_template(self::$DI['user']);
|
||||
|
||||
$username = uniqid('user_');
|
||||
$user = User_Adapter::create(self::$application, $username, "test", $username . "@email.com", false);
|
||||
|
@@ -8,16 +8,16 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRootPost()
|
||||
{
|
||||
static::$records['record_1'];
|
||||
static::$records['record_2'];
|
||||
self::$DI['record_1'];
|
||||
self::$DI['record_2'];
|
||||
$route = '/prod/baskets/';
|
||||
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key(),
|
||||
static::$records['record_2']->get_serialize_key(),
|
||||
self::$DI['record_1']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
' ',
|
||||
'42',
|
||||
static::$records['record_no_access']->get_serialize_key()
|
||||
self::$DI['record_no_access']->get_serialize_key()
|
||||
);
|
||||
|
||||
$lst = implode(';', $records);
|
||||
@@ -112,7 +112,7 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
$basket = $this->insertOneBasket();
|
||||
|
||||
$record = static::$records['record_1'];
|
||||
$record = self::$DI['record_1'];
|
||||
|
||||
$basket_element = new \Entities\BasketElement();
|
||||
$basket_element->setBasket($basket);
|
||||
@@ -143,7 +143,7 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
$basket = $this->insertOneBasket();
|
||||
|
||||
$record = static::$records['record_1'];
|
||||
$record = self::$DI['record_1'];
|
||||
|
||||
$basket_element = new \Entities\BasketElement();
|
||||
$basket_element->setBasket($basket);
|
||||
@@ -379,12 +379,12 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$route = sprintf('/prod/baskets/%s/addElements/', $basket->getId());
|
||||
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key(),
|
||||
static::$records['record_2']->get_serialize_key(),
|
||||
self::$DI['record_1']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
' ',
|
||||
'42',
|
||||
'abhak',
|
||||
static::$records['record_no_access']->get_serialize_key(),
|
||||
self::$DI['record_no_access']->get_serialize_key(),
|
||||
);
|
||||
|
||||
$lst = implode(';', $records);
|
||||
@@ -416,7 +416,7 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$expires->modify('+1 week');
|
||||
|
||||
$validationSession->setExpires($expires);
|
||||
$validationSession->setInitiator(self::$user);
|
||||
$validationSession->setInitiator(self::$DI['user']);
|
||||
|
||||
self::$application['EM']->persist($validationSession);
|
||||
|
||||
@@ -426,7 +426,7 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$validationParticipant = new \Entities\ValidationParticipant();
|
||||
$validationParticipant->setSession($validationSession);
|
||||
$validationParticipant->setUser(self::$user_alt1);
|
||||
$validationParticipant->setUser(self::$DI['user_alt1']);
|
||||
|
||||
self::$application['EM']->persist($validationParticipant);
|
||||
|
||||
@@ -437,12 +437,12 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$route = sprintf('/prod/baskets/%s/addElements/', $basket->getId());
|
||||
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key(),
|
||||
static::$records['record_2']->get_serialize_key(),
|
||||
self::$DI['record_1']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
' ',
|
||||
'42',
|
||||
'abhak',
|
||||
static::$records['record_no_access']->get_serialize_key(),
|
||||
self::$DI['record_no_access']->get_serialize_key(),
|
||||
);
|
||||
|
||||
$lst = implode(';', $records);
|
||||
@@ -469,8 +469,8 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$route = sprintf('/prod/baskets/%s/addElements/', $basket->getId());
|
||||
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key(),
|
||||
static::$records['record_2']->get_serialize_key()
|
||||
self::$DI['record_1']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key()
|
||||
);
|
||||
|
||||
$lst = implode(';', $records);
|
||||
|
@@ -21,9 +21,9 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
try {
|
||||
self::$account = Bridge_Account::load_account_from_distant_id(self::$application, self::$api, self::$user, 'kirikoo');
|
||||
self::$account = Bridge_Account::load_account_from_distant_id(self::$application, self::$api, self::$DI['user'], 'kirikoo');
|
||||
} catch (Bridge_Exception_AccountNotFound $e) {
|
||||
self::$account = Bridge_Account::create(self::$application, self::$api, self::$user, 'kirikoo', 'coucou');
|
||||
self::$account = Bridge_Account::create(self::$application, self::$api, self::$DI['user'], 'kirikoo', 'coucou');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testManager()
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$accounts = Bridge_Account::get_accounts_by_user(self::$application, self::$user);
|
||||
$usr_id = self::$user->get_id();
|
||||
$accounts = Bridge_Account::get_accounts_by_user(self::$application, self::$DI['user']);
|
||||
$usr_id = self::$DI['user']->get_id();
|
||||
|
||||
$basket = $this->insertOneBasket();
|
||||
|
||||
@@ -111,7 +111,7 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
});
|
||||
try {
|
||||
self::$account = Bridge_Account::load_account_from_distant_id(self::$application, self::$api, self::$user, 'kirikoo');
|
||||
self::$account = Bridge_Account::load_account_from_distant_id(self::$application, self::$api, self::$DI['user'], 'kirikoo');
|
||||
$settings = self::$account->get_settings();
|
||||
$this->assertEquals("kikoo", $settings->get("auth_token"));
|
||||
$this->assertEquals("kooki", $settings->get("refresh_token"));
|
||||
@@ -124,7 +124,7 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
|
||||
if ( ! self::$account instanceof Bridge_Account)
|
||||
self::$account = Bridge_Account::create(self::$application, self::$api, self::$user, 'kirikoo', 'coucou');
|
||||
self::$account = Bridge_Account::create(self::$application, self::$api, self::$DI['user'], 'kirikoo', 'coucou');
|
||||
}
|
||||
|
||||
public function testLogout()
|
||||
@@ -379,7 +379,7 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertTrue($response->isOk());
|
||||
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key()
|
||||
self::$DI['record_1']->get_serialize_key()
|
||||
);
|
||||
|
||||
Bridge_Api_Apitest::$hasError = true;
|
||||
|
@@ -11,7 +11,7 @@ class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testRouteSlash()
|
||||
{
|
||||
$this->client->request('POST', '/prod/records/edit/', array('lst' => static::$records['record_1']->get_serialize_key()));
|
||||
$this->client->request('POST', '/prod/records/edit/', array('lst' => self::$DI['record_1']->get_serialize_key()));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
@@ -20,7 +20,7 @@ class ControllerEditTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testApply()
|
||||
{
|
||||
$this->client->request('POST', '/prod/records/edit/apply/', array('lst' => static::$records['record_1']->get_serialize_key()));
|
||||
$this->client->request('POST', '/prod/records/edit/apply/', array('lst' => self::$DI['record_1']->get_serialize_key()));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
|
@@ -55,11 +55,11 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$this->feed = Feed_Adapter::create(
|
||||
self::$application, self::$user, $this->feed_title, $this->feed_subtitle
|
||||
self::$application, self::$DI['user'], $this->feed_title, $this->feed_subtitle
|
||||
);
|
||||
|
||||
$this->publisher = Feed_Publisher_Adapter::getPublisher(
|
||||
self::$application['phraseanet.appbox'], $this->feed, self::$user
|
||||
self::$application['phraseanet.appbox'], $this->feed, self::$DI['user']
|
||||
);
|
||||
|
||||
$this->entry = Feed_Entry_Adapter::create(
|
||||
@@ -72,7 +72,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, $this->entry_authormail
|
||||
);
|
||||
|
||||
$this->item = Feed_Entry_Item::create($appbox, $this->entry, static::$records['record_1']);
|
||||
$this->item = Feed_Entry_Item::create($appbox, $this->entry, self::$DI['record_1']);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
@@ -94,9 +94,9 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/requestavailable/');
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$user);
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$DI['user']);
|
||||
foreach ($feeds->get_feeds() as $one_feed) {
|
||||
if ($one_feed->is_publisher(self::$user)) {
|
||||
if ($one_feed->is_publisher(self::$DI['user'])) {
|
||||
$this->assertEquals(1, $crawler->filterXPath("//input[@value='" . $one_feed->get_id() . "']")->count());
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, "subtitle" => "coucou"
|
||||
, "author_name" => "robert"
|
||||
, "author_email" => "robert@kikoo.mail"
|
||||
, 'lst' => static::$records['record_1']->get_serialize_key()
|
||||
, 'lst' => self::$DI['record_1']->get_serialize_key()
|
||||
);
|
||||
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/entry/create/', $params);
|
||||
@@ -130,7 +130,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, "subtitle" => "coucou"
|
||||
, "author_name" => "robert"
|
||||
, "author_email" => "robert@kikoo.mail"
|
||||
, 'lst' => static::$records['record_1']->get_serialize_key()
|
||||
, 'lst' => self::$DI['record_1']->get_serialize_key()
|
||||
);
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/entry/create/', $params);
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
@@ -164,11 +164,11 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feed = Feed_Adapter::create(
|
||||
self::$application, self::$user_alt1, $this->feed_title, $this->feed_subtitle
|
||||
self::$application, self::$DI['user_alt1'], $this->feed_title, $this->feed_subtitle
|
||||
);
|
||||
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(
|
||||
self::$application['phraseanet.appbox'], $feed, self::$user_alt1
|
||||
self::$application['phraseanet.appbox'], $feed, self::$DI['user_alt1']
|
||||
);
|
||||
|
||||
$entry = Feed_Entry_Adapter::create(
|
||||
@@ -201,7 +201,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
"subtitle" => "cat",
|
||||
"author_name" => "bird",
|
||||
"author_email" => "mouse",
|
||||
'lst' => static::$records['record_1']->get_serialize_key(),
|
||||
'lst' => self::$DI['record_1']->get_serialize_key(),
|
||||
);
|
||||
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/entry/' . $this->entry->get_id() . '/update/', $params);
|
||||
@@ -219,7 +219,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$newfeed = Feed_Adapter::create(
|
||||
self::$application, self::$user, $this->feed_title, $this->feed_subtitle
|
||||
self::$application, self::$DI['user'], $this->feed_title, $this->feed_subtitle
|
||||
);
|
||||
|
||||
$params = array(
|
||||
@@ -228,7 +228,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
"subtitle" => "cat",
|
||||
"author_name" => "bird",
|
||||
"author_email" => "mouse",
|
||||
'lst' => static::$records['record_1']->get_serialize_key(),
|
||||
'lst' => self::$DI['record_1']->get_serialize_key(),
|
||||
);
|
||||
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/entry/' . $this->entry->get_id() . '/update/', $params);
|
||||
@@ -251,7 +251,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$newfeed = Feed_Adapter::create(
|
||||
self::$application, self::$user, $this->feed_title, $this->feed_subtitle
|
||||
self::$application, self::$DI['user'], $this->feed_title, $this->feed_subtitle
|
||||
);
|
||||
$newfeed->set_collection(self::$collection_no_access);
|
||||
|
||||
@@ -263,7 +263,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
"subtitle" => "cat",
|
||||
"author_name" => "bird",
|
||||
"author_email" => "mouse",
|
||||
'lst' => static::$records['record_1']->get_serialize_key(),
|
||||
'lst' => self::$DI['record_1']->get_serialize_key(),
|
||||
);
|
||||
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/entry/' . $this->entry->get_id() . '/update/', $params);
|
||||
@@ -285,7 +285,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
"subtitle" => "cat",
|
||||
"author_name" => "bird",
|
||||
"author_email" => "mouse",
|
||||
'lst' => static::$records['record_1']->get_serialize_key(),
|
||||
'lst' => self::$DI['record_1']->get_serialize_key(),
|
||||
);
|
||||
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/entry/' . $this->entry->get_id() . '/update/', $params);
|
||||
@@ -307,7 +307,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, "subtitle" => "cat"
|
||||
, "author_name" => "bird"
|
||||
, "author_email" => "mouse"
|
||||
, 'lst' => static::$records['record_1']->get_serialize_key()
|
||||
, 'lst' => self::$DI['record_1']->get_serialize_key()
|
||||
);
|
||||
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/entry/99999999/update/', $params);
|
||||
@@ -333,7 +333,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, "subtitle" => "cat"
|
||||
, "author_name" => "bird"
|
||||
, "author_email" => "mouse"
|
||||
, 'sorted_lst' => static::$records['record_1']->get_serialize_key() . ";" . static::$records['record_2']->get_serialize_key() . ";12345;" . "unknow_unknow"
|
||||
, 'sorted_lst' => self::$DI['record_1']->get_serialize_key() . ";" . self::$DI['record_2']->get_serialize_key() . ";12345;" . "unknow_unknow"
|
||||
);
|
||||
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/entry/' . $this->entry->get_id() . '/update/', $params);
|
||||
@@ -355,10 +355,10 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
/**
|
||||
* I CREATE A FEED THAT IS NOT MINE
|
||||
* */
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user_alt1, "salut", 'coucou');
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $feed, self::$user_alt1);
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user_alt1'], "salut", 'coucou');
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $feed, self::$DI['user_alt1']);
|
||||
$entry = Feed_Entry_Adapter::create(self::$application, $feed, $publisher, "hello", "coucou", "salut", "bonjour@phraseanet.com");
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_1']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_1']);
|
||||
|
||||
$params = array(
|
||||
"feed_id" => $feed->get_id()
|
||||
@@ -366,7 +366,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, "subtitle" => "cat"
|
||||
, "author_name" => "bird"
|
||||
, "author_email" => "mouse"
|
||||
, 'lst' => static::$records['record_1']->get_serialize_key()
|
||||
, 'lst' => self::$DI['record_1']->get_serialize_key()
|
||||
);
|
||||
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/entry/' . $entry->get_id() . '/update/', $params);
|
||||
@@ -430,11 +430,11 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
/**
|
||||
* I CREATE A FEED
|
||||
* */
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user_alt1, "salut", 'coucou');
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user_alt1'], "salut", 'coucou');
|
||||
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $feed, self::$user_alt1);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $feed, self::$DI['user_alt1']);
|
||||
$entry = Feed_Entry_Adapter::create(self::$application, $feed, $publisher, "hello", "coucou", "salut", "bonjour@phraseanet.com");
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_1']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_1']);
|
||||
|
||||
$crawler = $this->client->request('POST', '/prod/feeds/entry/' . $entry->get_id() . '/delete/');
|
||||
|
||||
@@ -461,14 +461,14 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$user);
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$DI['user']);
|
||||
|
||||
foreach ($feeds->get_feeds() as $one_feed) {
|
||||
|
||||
$path = CssSelector::toXPath("ul.submenu a[href='/prod/feeds/feed/" . $one_feed->get_id() . "/']");
|
||||
$msg = sprintf("user %s has access to feed %s", self::$user->get_id(), $one_feed->get_id());
|
||||
$msg = sprintf("user %s has access to feed %s", self::$DI['user']->get_id(), $one_feed->get_id());
|
||||
|
||||
if ($one_feed->has_access(self::$user)) {
|
||||
if ($one_feed->has_access(self::$DI['user'])) {
|
||||
$this->assertEquals(1, $crawler->filterXPath($path)->count(), $msg);
|
||||
} else {
|
||||
$this->fail('Feed_collection::load_all should return feed where I got access');
|
||||
@@ -480,16 +480,16 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$user);
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$DI['user']);
|
||||
|
||||
$crawler = $this->client->request('GET', '/prod/feeds/feed/' . $this->feed->get_id() . "/");
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
|
||||
foreach ($feeds->get_feeds() as $one_feed) {
|
||||
$path = CssSelector::toXPath("ul.submenu a[href='/prod/feeds/feed/" . $one_feed->get_id() . "/']");
|
||||
$msg = sprintf("user %s has access to feed %s", self::$user->get_id(), $one_feed->get_id());
|
||||
$msg = sprintf("user %s has access to feed %s", self::$DI['user']->get_id(), $one_feed->get_id());
|
||||
|
||||
if ($one_feed->has_access(self::$user)) {
|
||||
if ($one_feed->has_access(self::$DI['user'])) {
|
||||
$this->assertEquals(1, $crawler->filterXPath($path)->count(), $msg);
|
||||
} else {
|
||||
$this->fail('Feed_collection::load_all should return feed where I got access');
|
||||
@@ -500,14 +500,14 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testSuscribeAggregate()
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$user);
|
||||
$feeds = Feed_Collection::load_all(self::$application, self::$DI['user']);
|
||||
$crawler = $this->client->request('GET', '/prod/feeds/subscribe/aggregated/');
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$this->assertEquals("application/json", $this->client->getResponse()->headers->get("content-type"));
|
||||
$pageContent = json_decode($this->client->getResponse()->getContent());
|
||||
$this->assertTrue(is_object($pageContent));
|
||||
$this->assertTrue(is_string($pageContent->texte));
|
||||
$suscribe_link = $feeds->get_aggregate()->get_user_link(self::$application['phraseanet.registry'], self::$user, Feed_Adapter::FORMAT_RSS, null, false)->get_href();
|
||||
$suscribe_link = $feeds->get_aggregate()->get_user_link(self::$application['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_RSS, null, false)->get_href();
|
||||
$this->assertContains($suscribe_link, $pageContent->texte);
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$pageContent = json_decode($this->client->getResponse()->getContent());
|
||||
$this->assertTrue(is_object($pageContent));
|
||||
$this->assertTrue(is_string($pageContent->texte));
|
||||
$suscribe_link = $this->feed->get_user_link(self::$application['phraseanet.registry'], self::$user, Feed_Adapter::FORMAT_RSS, null, false)->get_href();
|
||||
$suscribe_link = $this->feed->get_user_link(self::$application['phraseanet.registry'], self::$DI['user'], Feed_Adapter::FORMAT_RSS, null, false)->get_href();
|
||||
$this->assertContains($suscribe_link, $pageContent->texte);
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$fileLazaret
|
||||
->expects($this->any())
|
||||
->method('getRecordsToSubstitute')
|
||||
->will($this->returnValue(array(static::$records['record_1'])));
|
||||
->will($this->returnValue(array(self::$DI['record_1'])));
|
||||
|
||||
$fileLazaret
|
||||
->expects($this->any())
|
||||
@@ -396,7 +396,7 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
//expect to fetch record
|
||||
$databox->expects($this->once())
|
||||
->method('get_record')
|
||||
->with($this->equalTo(self::$records['record_1']->get_record_id()))
|
||||
->with($this->equalTo(self::$DI['record_1']->get_record_id()))
|
||||
->will($this->returnValue($record));
|
||||
|
||||
$collection = $this->getMock('collection', array(), array(), '', false);
|
||||
@@ -411,7 +411,7 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
//expect to fetch possible records to subtitute
|
||||
$lazaretFile->expects($this->once())
|
||||
->method('getRecordsToSubstitute')
|
||||
->will($this->returnValue(array(self::$records['record_2'], self::$records['record_1'])));
|
||||
->will($this->returnValue(array(self::$DI['record_2'], self::$DI['record_1'])));
|
||||
|
||||
copy(__DIR__ . '/../../../../testfiles/cestlafete.jpg', __DIR__ . '/../../../../../tmp/lazaret/cestlafete.jpg');
|
||||
|
||||
@@ -448,7 +448,7 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->client = new Client(self::$application, array());
|
||||
|
||||
$this->client->request('POST', '/prod/lazaret/' . $id . '/accept/', array(
|
||||
'record_id' => self::$records['record_1']->get_record_id()
|
||||
'record_id' => self::$DI['record_1']->get_record_id()
|
||||
));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
@@ -497,7 +497,7 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->client = new Client(self::$application, array());
|
||||
|
||||
$this->client->request('POST', '/prod/lazaret/' . $id . '/accept/', array(
|
||||
'record_id' => self::$records['record_1']->get_record_id()
|
||||
'record_id' => self::$DI['record_1']->get_record_id()
|
||||
));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
@@ -627,7 +627,7 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
//The lazaret session
|
||||
$lazaretSession = new \Entities\LazaretSession();
|
||||
$lazaretSession->setUsrId(self::$user->get_id());
|
||||
$lazaretSession->setUsrId(self::$DI['user']->get_id());
|
||||
$lazaretSession->setUpdated(new \DateTime('now'));
|
||||
$lazaretSession->setCreated(new \DateTime('-1 day'));
|
||||
|
||||
|
@@ -11,7 +11,7 @@ class ControllerMoveCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAb
|
||||
*/
|
||||
public function testRouteSlash()
|
||||
{
|
||||
$this->client->request('POST', '/prod/records/movecollection/', array('lst' => static::$records['record_1']->get_serialize_key()));
|
||||
$this->client->request('POST', '/prod/records/movecollection/', array('lst' => self::$DI['record_1']->get_serialize_key()));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
@@ -21,7 +21,7 @@ class ControllerMoveCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAb
|
||||
public function testApply()
|
||||
{
|
||||
|
||||
$this->client->request('POST', '/prod/records/movecollection/apply/', array('lst' => static::$records['record_1']->get_serialize_key(), 'base_id' => self::$collection->get_base_id()));
|
||||
$this->client->request('POST', '/prod/records/movecollection/apply/', array('lst' => self::$DI['record_1']->get_serialize_key(), 'base_id' => self::$collection->get_base_id()));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
|
@@ -22,7 +22,7 @@ class OrderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testCreateOrder()
|
||||
{
|
||||
$this->client->request('POST', '/prod/order/', array(
|
||||
'lst' => static::$records['record_1']->get_serialize_key(),
|
||||
'lst' => self::$DI['record_1']->get_serialize_key(),
|
||||
'deadline' => '+10 minutes'
|
||||
));
|
||||
|
||||
@@ -35,7 +35,7 @@ class OrderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testCreateOrderJson()
|
||||
{
|
||||
$this->XMLHTTPRequest('POST', '/prod/order/', array(
|
||||
'lst' => static::$records['record_1']->get_serialize_key(),
|
||||
'lst' => self::$DI['record_1']->get_serialize_key(),
|
||||
'deadline' => '+10 minutes'
|
||||
));
|
||||
|
||||
@@ -148,10 +148,10 @@ class OrderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
private function createOneOrder($usage)
|
||||
{
|
||||
$receveid = array(static::$records['record_1']->get_serialize_key() => static::$records['record_1']);
|
||||
$receveid = array(self::$DI['record_1']->get_serialize_key() => self::$DI['record_1']);
|
||||
|
||||
return \set_order::create(
|
||||
self::$application, new RecordsRequest($receveid, new ArrayCollection($receveid)), self::$user_alt2 ,$usage, new \DateTime('+10 minutes')
|
||||
self::$application, new RecordsRequest($receveid, new ArrayCollection($receveid)), self::$DI['user_alt2'] ,$usage, new \DateTime('+10 minutes')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -12,8 +12,8 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testRouteSlash()
|
||||
{
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key(),
|
||||
static::$records['record_2']->get_serialize_key()
|
||||
self::$DI['record_1']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key()
|
||||
);
|
||||
|
||||
$lst = implode(';', $records);
|
||||
@@ -28,10 +28,10 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testRoutePrintPdf()
|
||||
{
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key(),
|
||||
static::$records['record_2']->get_serialize_key(),
|
||||
static::$records['record_3']->get_serialize_key(),
|
||||
static::$records['record_4']->get_serialize_key(),
|
||||
self::$DI['record_1']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
self::$DI['record_3']->get_serialize_key(),
|
||||
self::$DI['record_4']->get_serialize_key(),
|
||||
);
|
||||
|
||||
$lst = implode(';', $records);
|
||||
|
@@ -38,13 +38,13 @@ class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$route = '/prod/push/send/';
|
||||
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key(),
|
||||
static::$records['record_2']->get_serialize_key(),
|
||||
self::$DI['record_1']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
);
|
||||
|
||||
$receivers = array(
|
||||
array('usr_id' => self::$user_alt1->get_id(), 'HD' => 1)
|
||||
, array('usr_id' => self::$user_alt2->get_id(), 'HD' => 0)
|
||||
array('usr_id' => self::$DI['user_alt1']->get_id(), 'HD' => 1)
|
||||
, array('usr_id' => self::$DI['user_alt2']->get_id(), 'HD' => 0)
|
||||
);
|
||||
|
||||
$params = array(
|
||||
@@ -72,19 +72,19 @@ class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$route = '/prod/push/validate/';
|
||||
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key(),
|
||||
static::$records['record_2']->get_serialize_key(),
|
||||
self::$DI['record_1']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
);
|
||||
|
||||
$participants = array(
|
||||
array(
|
||||
'usr_id' => self::$user_alt1->get_id(),
|
||||
'usr_id' => self::$DI['user_alt1']->get_id(),
|
||||
'agree' => 0,
|
||||
'see_others' => 1,
|
||||
'HD' => 0,
|
||||
)
|
||||
, array(
|
||||
'usr_id' => self::$user_alt2->get_id(),
|
||||
'usr_id' => self::$DI['user_alt2']->get_id(),
|
||||
'agree' => 1,
|
||||
'see_others' => 0,
|
||||
'HD' => 1,
|
||||
|
@@ -81,7 +81,7 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testByIds()
|
||||
{
|
||||
$story = static::$records['record_story_1'];
|
||||
$story = self::$DI['record_story_1'];
|
||||
|
||||
$route = sprintf("/prod/story/%d/%d/", $story->get_sbas_id(), $story->get_record_id());
|
||||
|
||||
@@ -99,8 +99,8 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$route = sprintf("/prod/story/%s/%s/addElements/", $story->get_sbas_id(), $story->get_record_id());
|
||||
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key(),
|
||||
static::$records['record_2']->get_serialize_key()
|
||||
self::$DI['record_1']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key()
|
||||
);
|
||||
|
||||
$lst = implode(';', $records);
|
||||
@@ -122,8 +122,8 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$route = sprintf("/prod/story/%s/%s/addElements/", $story->get_sbas_id(), $story->get_record_id());
|
||||
|
||||
$records = array(
|
||||
static::$records['record_1']->get_serialize_key(),
|
||||
static::$records['record_2']->get_serialize_key()
|
||||
self::$DI['record_1']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key()
|
||||
);
|
||||
|
||||
$lst = implode(';', $records);
|
||||
@@ -145,8 +145,8 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$story = \record_adapter::createStory(self::$application, self::$collection);
|
||||
|
||||
$records = array(
|
||||
static::$records['record_1'],
|
||||
static::$records['record_2']
|
||||
self::$DI['record_1'],
|
||||
self::$DI['record_2']
|
||||
);
|
||||
|
||||
foreach($records as $record) {
|
||||
|
@@ -44,8 +44,8 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRoutePreview()
|
||||
{
|
||||
$route = '/prod/tooltip/preview/' . static::$records['record_1']->get_sbas_id()
|
||||
. '/' . static::$records['record_1']->get_record_id() . '/';
|
||||
$route = '/prod/tooltip/preview/' . self::$DI['record_1']->get_sbas_id()
|
||||
. '/' . self::$DI['record_1']->get_record_id() . '/';
|
||||
|
||||
$crawler = $this->client->request('POST', $route);
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
@@ -55,8 +55,8 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testRouteCaption()
|
||||
{
|
||||
|
||||
$route_base = '/prod/tooltip/caption/' . static::$records['record_1']->get_sbas_id()
|
||||
. '/' . static::$records['record_1']->get_record_id() . '/%s/';
|
||||
$route_base = '/prod/tooltip/caption/' . self::$DI['record_1']->get_sbas_id()
|
||||
. '/' . self::$DI['record_1']->get_record_id() . '/%s/';
|
||||
|
||||
$routes = array(
|
||||
sprintf($route_base, 'answer')
|
||||
@@ -75,8 +75,8 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteCaptionSearchEngine()
|
||||
{
|
||||
$route_base = '/prod/tooltip/caption/' . static::$records['record_1']->get_sbas_id()
|
||||
. '/' . static::$records['record_1']->get_record_id() . '/%s/';
|
||||
$route_base = '/prod/tooltip/caption/' . self::$DI['record_1']->get_sbas_id()
|
||||
. '/' . self::$DI['record_1']->get_record_id() . '/%s/';
|
||||
|
||||
$routes = array(
|
||||
sprintf($route_base, 'answer')
|
||||
@@ -96,8 +96,8 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteTCDatas()
|
||||
{
|
||||
$route = '/prod/tooltip/tc_datas/' . static::$records['record_1']->get_sbas_id()
|
||||
. '/' . static::$records['record_1']->get_record_id() . '/';
|
||||
$route = '/prod/tooltip/tc_datas/' . self::$DI['record_1']->get_sbas_id()
|
||||
. '/' . self::$DI['record_1']->get_record_id() . '/';
|
||||
|
||||
$crawler = $this->client->request('POST', $route);
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
@@ -106,7 +106,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteMetasFieldInfos()
|
||||
{
|
||||
$databox = static::$records['record_1']->get_databox();
|
||||
$databox = self::$DI['record_1']->get_databox();
|
||||
|
||||
foreach ($databox->get_meta_structure() as $field) {
|
||||
$route = '/prod/tooltip/metas/FieldInfos/' . $databox->get_sbas_id()
|
||||
@@ -120,7 +120,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteMetasDCESInfos()
|
||||
{
|
||||
$databox = static::$records['record_1']->get_databox();
|
||||
$databox = self::$DI['record_1']->get_databox();
|
||||
$dces = array(
|
||||
databox_field::DCES_CONTRIBUTOR => new databox_Field_DCES_Contributor()
|
||||
, databox_field::DCES_COVERAGE => new databox_Field_DCES_Coverage()
|
||||
@@ -155,7 +155,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteMetaRestrictions()
|
||||
{
|
||||
$databox = static::$records['record_1']->get_databox();
|
||||
$databox = self::$DI['record_1']->get_databox();
|
||||
|
||||
foreach ($databox->get_meta_structure() as $field) {
|
||||
|
||||
@@ -170,11 +170,11 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteStory()
|
||||
{
|
||||
$databox = static::$records['record_story_1']->get_databox();
|
||||
$databox = self::$DI['record_story_1']->get_databox();
|
||||
|
||||
|
||||
$route = '/prod/tooltip/Story/' . $databox->get_sbas_id()
|
||||
. '/' . static::$records['record_story_1']->get_record_id() . '/';
|
||||
. '/' . self::$DI['record_story_1']->get_record_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route);
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
@@ -183,7 +183,7 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testUser()
|
||||
{
|
||||
|
||||
$route = '/prod/tooltip/user/' . self::$user->get_id() . '/';
|
||||
$route = '/prod/tooltip/user/' . self::$DI['user']->get_id() . '/';
|
||||
$this->client->request('POST', $route);
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
}
|
||||
|
@@ -11,12 +11,12 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testRouteSlash()
|
||||
{
|
||||
$entry1 = $this->insertOneUsrListEntry(self::$user, self::$user);
|
||||
$entry2 = $this->insertOneUsrListEntry(self::$user, self::$user_alt1);
|
||||
$entry3 = $this->insertOneUsrListEntry(self::$user, self::$user);
|
||||
$entry4 = $this->insertOneUsrListEntry(self::$user, self::$user_alt1);
|
||||
$entry5 = $this->insertOneUsrListEntry(self::$user_alt1, self::$user_alt1);
|
||||
$entry6 = $this->insertOneUsrListEntry(self::$user_alt1, self::$user_alt2);
|
||||
$entry1 = $this->insertOneUsrListEntry(self::$DI['user'], self::$DI['user']);
|
||||
$entry2 = $this->insertOneUsrListEntry(self::$DI['user'], self::$DI['user_alt1']);
|
||||
$entry3 = $this->insertOneUsrListEntry(self::$DI['user'], self::$DI['user']);
|
||||
$entry4 = $this->insertOneUsrListEntry(self::$DI['user'], self::$DI['user_alt1']);
|
||||
$entry5 = $this->insertOneUsrListEntry(self::$DI['user_alt1'], self::$DI['user_alt1']);
|
||||
$entry6 = $this->insertOneUsrListEntry(self::$DI['user_alt1'], self::$DI['user_alt2']);
|
||||
|
||||
$route = '/prod/lists/all/';
|
||||
|
||||
@@ -91,7 +91,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testGetList()
|
||||
{
|
||||
$entry = $this->insertOneUsrListEntry(self::$user, self::$user_alt1);
|
||||
$entry = $this->insertOneUsrListEntry(self::$DI['user'], self::$DI['user_alt1']);
|
||||
$list_id = $entry->getList()->getId();
|
||||
|
||||
$route = '/prod/lists/list/' . $list_id . '/';
|
||||
@@ -111,7 +111,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testPostUpdate()
|
||||
{
|
||||
$entry = $this->insertOneUsrListEntry(self::$user, self::$user_alt1);
|
||||
$entry = $this->insertOneUsrListEntry(self::$DI['user'], self::$DI['user_alt1']);
|
||||
$list_id = $entry->getList()->getId();
|
||||
|
||||
$route = '/prod/lists/list/' . $list_id . '/update/';
|
||||
@@ -148,7 +148,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testPostDelete()
|
||||
{
|
||||
$entry = $this->insertOneUsrListEntry(self::$user, self::$user_alt1);
|
||||
$entry = $this->insertOneUsrListEntry(self::$DI['user'], self::$DI['user_alt1']);
|
||||
$list_id = $entry->getList()->getId();
|
||||
|
||||
$route = '/prod/lists/list/' . $list_id . '/delete/';
|
||||
@@ -174,7 +174,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testPostRemoveEntry()
|
||||
{
|
||||
$entry = $this->insertOneUsrListEntry(self::$user, self::$user_alt1);
|
||||
$entry = $this->insertOneUsrListEntry(self::$DI['user'], self::$DI['user_alt1']);
|
||||
$list_id = $entry->getList()->getId();
|
||||
$usr_id = $entry->getUser(self::$application)->get_id();
|
||||
$entry_id = $entry->getId();
|
||||
@@ -202,13 +202,13 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testPostAddEntry()
|
||||
{
|
||||
$list = $this->insertOneUsrList(self::$user);
|
||||
$list = $this->insertOneUsrList(self::$DI['user']);
|
||||
|
||||
$this->assertEquals(0, $list->getEntries()->count());
|
||||
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/add/';
|
||||
|
||||
$this->client->request('POST', $route, array('usr_ids' => array(self::$user->get_id())), array(), array("HTTP_CONTENT_TYPE" => "application/json", "HTTP_ACCEPT" => "application/json"));
|
||||
$this->client->request('POST', $route, array('usr_ids' => array(self::$DI['user']->get_id())), array(), array("HTTP_CONTENT_TYPE" => "application/json", "HTTP_ACCEPT" => "application/json"));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
@@ -231,11 +231,11 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testPostShareList()
|
||||
{
|
||||
$list = $this->insertOneUsrList(self::$user);
|
||||
$list = $this->insertOneUsrList(self::$DI['user']);
|
||||
|
||||
$this->assertEquals(1, $list->getOwners()->count());
|
||||
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$user_alt1->get_id() . '/';
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route);
|
||||
|
||||
@@ -245,7 +245,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertEquals('UTF-8', $response->getCharset());
|
||||
|
||||
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$user_alt1->get_id() . '/';
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route, array('role' => 'general'));
|
||||
|
||||
@@ -256,7 +256,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
|
||||
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$user_alt1->get_id() . '/';
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route, array('role' => \Entities\UsrListOwner::ROLE_ADMIN));
|
||||
|
||||
@@ -283,11 +283,11 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testPostUnShareList()
|
||||
{
|
||||
|
||||
$list = $this->insertOneUsrList(self::$user);
|
||||
$list = $this->insertOneUsrList(self::$DI['user']);
|
||||
|
||||
$this->assertEquals(1, $list->getOwners()->count());
|
||||
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$user_alt1->get_id() . '/';
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route, array('role' => \Entities\UsrListOwner::ROLE_ADMIN));
|
||||
|
||||
@@ -312,7 +312,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
|
||||
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/unshare/' . self::$user_alt1->get_id() . '/';
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/unshare/' . self::$DI['user_alt1']->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route);
|
||||
|
||||
@@ -337,11 +337,11 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testPostUnShareFail()
|
||||
{
|
||||
|
||||
$list = $this->insertOneUsrList(self::$user);
|
||||
$list = $this->insertOneUsrList(self::$DI['user']);
|
||||
|
||||
$this->assertEquals(1, $list->getOwners()->count());
|
||||
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$user_alt1->get_id() . '/';
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route, array('role' => \Entities\UsrListOwner::ROLE_ADMIN));
|
||||
|
||||
@@ -360,7 +360,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
|
||||
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$user->get_id() . '/';
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user']->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route, array('role' => \Entities\UsrListOwner::ROLE_USER));
|
||||
|
||||
@@ -379,7 +379,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
|
||||
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$user_alt1->get_id() . '/';
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route, array('role' => \Entities\UsrListOwner::ROLE_USER));
|
||||
|
||||
@@ -406,7 +406,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
|
||||
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/unshare/' . self::$user_alt1->get_id() . '/';
|
||||
$route = '/prod/lists/list/' . $list->getId() . '/unshare/' . self::$DI['user_alt1']->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route);
|
||||
|
||||
|
@@ -21,7 +21,7 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testAttachStoryToWZ()
|
||||
{
|
||||
$story = static::$records['record_story_1'];
|
||||
$story = self::$DI['record_story_1'];
|
||||
/* @var $story \Record_Adapter */
|
||||
$route = sprintf("/prod/WorkZone/attachStories/");
|
||||
|
||||
@@ -46,7 +46,7 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$this->assertEquals(1, $count);
|
||||
|
||||
$story2 = static::$records['record_story_2'];
|
||||
$story2 = self::$DI['record_story_2'];
|
||||
|
||||
$stories = array($story->get_serialize_key(), $story2->get_serialize_key());
|
||||
|
||||
@@ -98,7 +98,7 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testDetachStoryFromWZ()
|
||||
{
|
||||
$story = static::$records['record_story_1'];
|
||||
$story = self::$DI['record_story_1'];
|
||||
|
||||
$route = sprintf("/prod/WorkZone/detachStory/%s/%s/", $story->get_sbas_id(), $story->get_record_id());
|
||||
//story not yet Attched
|
||||
@@ -170,7 +170,7 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testDetachStoryFromWZNotFound()
|
||||
{
|
||||
$story = static::$records['record_story_1'];
|
||||
$story = self::$DI['record_story_1'];
|
||||
|
||||
$route = sprintf("/prod/WorkZone/detachStory/%s/%s/", $story->get_sbas_id(), 'unknow');
|
||||
//story not yet Attched
|
||||
|
@@ -14,12 +14,12 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
$request = new Request(array(
|
||||
'lst' => implode(';', array(
|
||||
self::$records['record_24']->get_serialize_key(),
|
||||
self::$records['record_24']->get_serialize_key(),
|
||||
self::$records['record_2']->get_serialize_key(),
|
||||
self::$records['record_story_2']->get_serialize_key(),
|
||||
self::$records['record_no_access']->get_serialize_key(),
|
||||
self::$records['record_no_access_by_status']->get_serialize_key(),
|
||||
self::$DI['record_24']->get_serialize_key(),
|
||||
self::$DI['record_24']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
self::$DI['record_story_2']->get_serialize_key(),
|
||||
self::$DI['record_no_access']->get_serialize_key(),
|
||||
self::$DI['record_no_access_by_status']->get_serialize_key(),
|
||||
'',
|
||||
'0_490',
|
||||
'0_',
|
||||
@@ -42,18 +42,18 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$exploded = explode(';', $serialized);
|
||||
|
||||
$this->assertEquals(3, count($exploded));
|
||||
$this->assertContains(self::$records['record_24']->get_serialize_key(), $exploded);
|
||||
$this->assertContains(self::$records['record_2']->get_serialize_key(), $exploded);
|
||||
$this->assertContains(self::$records['record_story_2']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$records['record_no_access']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$records['record_no_access_by_status']->get_serialize_key(), $exploded);
|
||||
$this->assertContains(self::$DI['record_24']->get_serialize_key(), $exploded);
|
||||
$this->assertContains(self::$DI['record_2']->get_serialize_key(), $exploded);
|
||||
$this->assertContains(self::$DI['record_story_2']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$DI['record_no_access']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$DI['record_no_access_by_status']->get_serialize_key(), $exploded);
|
||||
}
|
||||
|
||||
public function testSimpleSimple()
|
||||
{
|
||||
$request = new Request(array(
|
||||
'lst' => implode(';', array(
|
||||
self::$records['record_2']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
))
|
||||
));
|
||||
|
||||
@@ -71,17 +71,17 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$exploded = explode(';', $serialized);
|
||||
|
||||
$this->assertEquals(1, count($exploded));
|
||||
$this->assertContains(self::$records['record_2']->get_serialize_key(), $exploded);
|
||||
$this->assertContains(self::$DI['record_2']->get_serialize_key(), $exploded);
|
||||
}
|
||||
|
||||
public function testSimpleWithoutSbasRights()
|
||||
{
|
||||
self::$application['phraseanet.user']->ACL()
|
||||
->update_rights_to_sbas(self::$records['record_2']->get_sbas_id(), array('bas_chupub' => 0));
|
||||
->update_rights_to_sbas(self::$DI['record_2']->get_sbas_id(), array('bas_chupub' => 0));
|
||||
|
||||
$request = new Request(array(
|
||||
'lst' => implode(';', array(
|
||||
self::$records['record_2']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
))
|
||||
));
|
||||
|
||||
@@ -97,17 +97,17 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$exploded = explode(';', $serialized);
|
||||
|
||||
$this->assertEquals('', $serialized);
|
||||
$this->assertNotContains(self::$records['record_2']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$DI['record_2']->get_serialize_key(), $exploded);
|
||||
}
|
||||
|
||||
public function testSimpleWithoutBasRights()
|
||||
{
|
||||
self::$application['phraseanet.user']->ACL()
|
||||
->update_rights_to_base(self::$records['record_2']->get_base_id(), array('chgstatus' => 0));
|
||||
->update_rights_to_base(self::$DI['record_2']->get_base_id(), array('chgstatus' => 0));
|
||||
|
||||
$request = new Request(array(
|
||||
'lst' => implode(';', array(
|
||||
self::$records['record_2']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
))
|
||||
));
|
||||
|
||||
@@ -123,19 +123,19 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$exploded = explode(';', $serialized);
|
||||
|
||||
$this->assertEquals('', $serialized);
|
||||
$this->assertNotContains(self::$records['record_2']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$DI['record_2']->get_serialize_key(), $exploded);
|
||||
}
|
||||
|
||||
public function testSimpleFlatten()
|
||||
{
|
||||
$request = new Request(array(
|
||||
'lst' => implode(';', array(
|
||||
self::$records['record_24']->get_serialize_key(),
|
||||
self::$records['record_24']->get_serialize_key(),
|
||||
self::$records['record_2']->get_serialize_key(),
|
||||
self::$records['record_story_2']->get_serialize_key(),
|
||||
self::$records['record_no_access']->get_serialize_key(),
|
||||
self::$records['record_no_access_by_status']->get_serialize_key(),
|
||||
self::$DI['record_24']->get_serialize_key(),
|
||||
self::$DI['record_24']->get_serialize_key(),
|
||||
self::$DI['record_2']->get_serialize_key(),
|
||||
self::$DI['record_story_2']->get_serialize_key(),
|
||||
self::$DI['record_no_access']->get_serialize_key(),
|
||||
self::$DI['record_no_access_by_status']->get_serialize_key(),
|
||||
))
|
||||
));
|
||||
|
||||
@@ -152,11 +152,11 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$exploded = explode(';', $serialized);
|
||||
|
||||
$this->assertEquals(2, count($exploded));
|
||||
$this->assertContains(self::$records['record_2']->get_serialize_key(), $exploded);
|
||||
$this->assertContains(self::$records['record_24']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$records['record_story_2']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$records['record_no_access']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$records['record_no_access_by_status']->get_serialize_key(), $exploded);
|
||||
$this->assertContains(self::$DI['record_2']->get_serialize_key(), $exploded);
|
||||
$this->assertContains(self::$DI['record_24']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$DI['record_story_2']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$DI['record_no_access']->get_serialize_key(), $exploded);
|
||||
$this->assertNotContains(self::$DI['record_no_access_by_status']->get_serialize_key(), $exploded);
|
||||
}
|
||||
|
||||
public function testSimpleBasket()
|
||||
@@ -183,10 +183,10 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function getBasket()
|
||||
{
|
||||
$elements = array(
|
||||
self::$records['record_24'],
|
||||
self::$records['record_2'],
|
||||
self::$records['record_no_access'],
|
||||
self::$records['record_no_access_by_status'],
|
||||
self::$DI['record_24'],
|
||||
self::$DI['record_2'],
|
||||
self::$DI['record_no_access'],
|
||||
self::$DI['record_no_access_by_status'],
|
||||
);
|
||||
|
||||
$basket = new \Entities\Basket();
|
||||
@@ -253,7 +253,7 @@ class RecordsRequestTest extends \PhraseanetPHPUnitAuthenticatedAbstract
|
||||
protected function getStoryWZ()
|
||||
{
|
||||
$story = new \Entities\StoryWZ();
|
||||
$story->setRecord(self::$records['record_story_2']);
|
||||
$story->setRecord(self::$DI['record_story_2']);
|
||||
$story->setUser(self::$application['phraseanet.user']);
|
||||
|
||||
self::$application['EM']->persist($story);
|
||||
|
@@ -13,7 +13,7 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
try {
|
||||
self::$authorizedApp = \API_OAuth2_Application::create(self::$application, self::$user, 'test API v1');
|
||||
self::$authorizedApp = \API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test API v1');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
@@ -91,14 +91,14 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testPostResetMailWithToken()
|
||||
{
|
||||
$token = \random::getUrlToken(self::$application, \random::TYPE_EMAIL, self::$user->get_id(), null, 'new_email@email.com');
|
||||
$token = \random::getUrlToken(self::$application, \random::TYPE_EMAIL, self::$DI['user']->get_id(), null, 'new_email@email.com');
|
||||
$this->client->request('POST', '/account/reset-email/', array('token' => $token));
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertTrue($response->isRedirect());
|
||||
$this->assertEquals('/account/reset-email/?update=ok', $response->headers->get('location'));
|
||||
|
||||
$this->assertEquals('new_email@email.com', self::$user->get_email());
|
||||
self::$user->set_email('noone@example.com');
|
||||
$this->assertEquals('new_email@email.com', self::$DI['user']->get_email());
|
||||
self::$DI['user']->set_email('noone@example.com');
|
||||
try {
|
||||
\random::helloToken(self::$application, $token);
|
||||
$this->fail('TOken has not been removed');
|
||||
@@ -359,7 +359,7 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertTrue($response->isRedirect());
|
||||
$this->assertEquals('minet', self::$application['phraseanet.user']->get_lastname());
|
||||
|
||||
$ret = $register->get_collection_awaiting_for_user(self::$application, self::$user);
|
||||
$ret = $register->get_collection_awaiting_for_user(self::$application, self::$DI['user']);
|
||||
|
||||
$this->assertEquals(count($ret), count($bases));
|
||||
}
|
||||
@@ -411,7 +411,7 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$account = \API_OAuth2_Account::load_with_user(
|
||||
self::$application
|
||||
, self::$authorizedApp
|
||||
, self::$user
|
||||
, self::$DI['user']
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $account->is_revoked());
|
||||
|
@@ -55,7 +55,7 @@ class DevelopersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testPostNewApp()
|
||||
{
|
||||
$apps = API_OAuth2_Application::load_dev_app_by_user(self::$application, self::$user);
|
||||
$apps = API_OAuth2_Application::load_dev_app_by_user(self::$application, self::$DI['user']);
|
||||
$nbApp = count($apps);
|
||||
|
||||
$this->client->request('POST', '/developers/application/', array(
|
||||
@@ -68,7 +68,7 @@ class DevelopersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
'scheme-callback' => 'http://'
|
||||
));
|
||||
|
||||
$apps = API_OAuth2_Application::load_dev_app_by_user(self::$application, self::$user);
|
||||
$apps = API_OAuth2_Application::load_dev_app_by_user(self::$application, self::$DI['user']);
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
$this->assertGreaterThan($nbApp, count($apps));
|
||||
@@ -88,7 +88,7 @@ class DevelopersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testGetApp()
|
||||
{
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
$this->client->request('GET', '/developers/application/' . $oauthApp->get_id() . '/');
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$oauthApp->delete();
|
||||
@@ -120,7 +120,7 @@ class DevelopersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testDeleteApp()
|
||||
{
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
|
||||
$this->XMLHTTPRequest('DELETE', '/developers/application/' . $oauthApp->get_id() . '/');
|
||||
|
||||
@@ -162,7 +162,7 @@ class DevelopersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testRenewAppCallbackError2()
|
||||
{
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
|
||||
$this->XMLHTTPRequest('POST', '/developers/application/'.$oauthApp->get_id().'/callback/');
|
||||
|
||||
@@ -176,7 +176,7 @@ class DevelopersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testRenewAppCallback()
|
||||
{
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
|
||||
$this->XMLHTTPRequest('POST', '/developers/application/' . $oauthApp->get_id() . '/callback/', array(
|
||||
'callback' => 'my.callback.com'
|
||||
@@ -218,7 +218,7 @@ class DevelopersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testRenewAccessToken()
|
||||
{
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
|
||||
$this->XMLHTTPRequest('POST', '/developers/application/' . $oauthApp->get_id() . '/access_token/');
|
||||
|
||||
@@ -256,7 +256,7 @@ class DevelopersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testAuthorizeGrantpasswordToken()
|
||||
{
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$oauthApp = \API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
|
||||
$this->XMLHTTPRequest('POST', '/developers/application/' . $oauthApp->get_id() . '/authorize_grant_password/', array(
|
||||
'grant' => '1'
|
||||
|
@@ -106,9 +106,9 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testRegisterConfirmMailUnlocked()
|
||||
{
|
||||
$email = $this->generateEmail();
|
||||
$token = \random::getUrlToken(self::$application, \random::TYPE_EMAIL, self::$user->get_id(), null, $email);
|
||||
$token = \random::getUrlToken(self::$application, \random::TYPE_EMAIL, self::$DI['user']->get_id(), null, $email);
|
||||
|
||||
self::$user->set_mail_locked(false);
|
||||
self::$DI['user']->set_mail_locked(false);
|
||||
|
||||
$this->client->request('GET', '/login/register-confirm/', array('code' => $token));
|
||||
$response = $this->client->getResponse();
|
||||
@@ -124,17 +124,17 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
$email = $this->generateEmail();
|
||||
$appboxRegister = new \appbox_register(self::$application['phraseanet.appbox']);
|
||||
$token = \random::getUrlToken(self::$application, \random::TYPE_EMAIL, self::$user->get_id(), null, $email);
|
||||
$token = \random::getUrlToken(self::$application, \random::TYPE_EMAIL, self::$DI['user']->get_id(), null, $email);
|
||||
|
||||
self::$user->set_mail_locked(true);
|
||||
self::$DI['user']->set_mail_locked(true);
|
||||
$this->deleteRequest();
|
||||
$appboxRegister->add_request(self::$user, self::$collection);
|
||||
$appboxRegister->add_request(self::$DI['user'], self::$collection);
|
||||
$this->client->request('GET', '/login/register-confirm/', array('code' => $token));
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
$this->assertTrue($response->isRedirect());
|
||||
$this->assertEquals('/login/?redirect=prod¬ice=confirm-ok-wait', $response->headers->get('location'));
|
||||
$this->assertFalse(self::$user->get_mail_locked());
|
||||
$this->assertFalse(self::$DI['user']->get_mail_locked());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,9 +143,9 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testRegisterConfirmMailNoCollAwait()
|
||||
{
|
||||
$email = $this->generateEmail();
|
||||
$token = \random::getUrlToken(self::$application, \random::TYPE_EMAIL, self::$user->get_id(), null, $email);
|
||||
$token = \random::getUrlToken(self::$application, \random::TYPE_EMAIL, self::$DI['user']->get_id(), null, $email);
|
||||
|
||||
self::$user->set_mail_locked(true);
|
||||
self::$DI['user']->set_mail_locked(true);
|
||||
|
||||
$this->deleteRequest();
|
||||
|
||||
@@ -186,7 +186,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testRenewPasswordMail()
|
||||
{
|
||||
$this->client->request('POST', '/login/forgot-password/', array('mail' => self::$user->get_email()));
|
||||
$this->client->request('POST', '/login/forgot-password/', array('mail' => self::$DI['user']->get_email()));
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
$this->assertTrue($response->isRedirect());
|
||||
@@ -231,7 +231,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testRenewPassword()
|
||||
{
|
||||
$token = \random::getUrlToken(self::$application, \random::TYPE_PASSWORD, self::$user->get_id());
|
||||
$token = \random::getUrlToken(self::$application, \random::TYPE_PASSWORD, self::$DI['user']->get_id());
|
||||
|
||||
$this->client->request('POST', '/login/forgot-password/', array(
|
||||
'token' => $token,
|
||||
@@ -608,7 +608,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
*/
|
||||
public function testSendConfirmMail()
|
||||
{
|
||||
$this->client->request('GET', '/login/send-mail-confirm/', array('usr_id' => self::$user->get_id()));
|
||||
$this->client->request('GET', '/login/send-mail-confirm/', array('usr_id' => self::$DI['user']->get_id()));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertTrue($response->isRedirect());
|
||||
@@ -654,7 +654,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
self::$application->closeAccount();
|
||||
$this->client->request('POST', '/login/authenticate/', array(
|
||||
'login' => self::$user->get_login(),
|
||||
'login' => self::$DI['user']->get_login(),
|
||||
'pwd' => 'test'
|
||||
));
|
||||
|
||||
@@ -670,16 +670,16 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
self::$application->closeAccount();
|
||||
$password = \random::generatePassword();
|
||||
self::$user->set_mail_locked(true);
|
||||
self::$DI['user']->set_mail_locked(true);
|
||||
$this->client->request('POST', '/login/authenticate/', array(
|
||||
'login' => self::$user->get_login(),
|
||||
'login' => self::$DI['user']->get_login(),
|
||||
'pwd' => $password
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
$this->assertRegexp('/error=mail-not-confirmed/', $this->client->getResponse()->headers->get('location'));
|
||||
$this->assertFalse(self::$application->isAuthenticated());
|
||||
self::$user->set_mail_locked(false);
|
||||
self::$DI['user']->set_mail_locked(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -694,7 +694,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->client = new Client(self::$application, array());
|
||||
|
||||
$this->client->request('POST', '/login/authenticate/', array(
|
||||
'login' => self::$user->get_login(),
|
||||
'login' => self::$DI['user']->get_login(),
|
||||
'pwd' => $password
|
||||
));
|
||||
self::$application['phraseanet.registry']->set('GV_maintenance', false, \registry::TYPE_BOOLEAN);
|
||||
@@ -712,7 +712,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
$sql = "DELETE FROM demand WHERE usr_id = :usr_id";
|
||||
$stmt = self::$application['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => self::$user->get_id()));
|
||||
$stmt->execute(array(':usr_id' => self::$DI['user']->get_id()));
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
|
||||
|
@@ -77,11 +77,11 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$user, 'title', 'subtitle');
|
||||
self::$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], self::$feed, self::$user);
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$DI['user'], 'title', 'subtitle');
|
||||
self::$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], self::$feed, self::$DI['user']);
|
||||
self::$entry = Feed_Entry_Adapter::create(self::$application, self::$feed, self::$publisher, 'title_entry', 'subtitle', 'hello', "test@mail.com");
|
||||
Feed_Entry_Item::create(self::$application['phraseanet.appbox'], self::$entry, static::$records['record_1']);
|
||||
Feed_Entry_Item::create(self::$application['phraseanet.appbox'], self::$entry, static::$records['record_2']);
|
||||
Feed_Entry_Item::create(self::$application['phraseanet.appbox'], self::$entry, self::$DI['record_1']);
|
||||
Feed_Entry_Item::create(self::$application['phraseanet.appbox'], self::$entry, self::$DI['record_2']);
|
||||
self::$feed->set_public(true);
|
||||
}
|
||||
|
||||
@@ -104,21 +104,21 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
self::$feed_1_private = Feed_Adapter::create(self::$application, self::$user, self::$feed_1_private_title, self::$feed_1_private_subtitle);
|
||||
self::$feed_1_private = Feed_Adapter::create(self::$application, self::$DI['user'], self::$feed_1_private_title, self::$feed_1_private_subtitle);
|
||||
self::$feed_1_private->set_public(false);
|
||||
self::$feed_1_private->set_icon(__DIR__ . '/../../../../testfiles/logocoll.gif');
|
||||
|
||||
self::$feed_2_private = Feed_Adapter::create(self::$application, self::$user, self::$feed_2_private_title, self::$feed_2_private_subtitle);
|
||||
self::$feed_2_private = Feed_Adapter::create(self::$application, self::$DI['user'], self::$feed_2_private_title, self::$feed_2_private_subtitle);
|
||||
self::$feed_2_private->set_public(false);
|
||||
|
||||
self::$feed_3_public = Feed_Adapter::create(self::$application, self::$user, self::$feed_3_public_title, self::$feed_3_public_subtitle);
|
||||
self::$feed_3_public = Feed_Adapter::create(self::$application, self::$DI['user'], self::$feed_3_public_title, self::$feed_3_public_subtitle);
|
||||
self::$feed_3_public->set_public(true);
|
||||
self::$feed_3_public->set_icon(__DIR__ . '/../../../../testfiles/logocoll.gif');
|
||||
|
||||
self::$feed_4_public = Feed_Adapter::create(self::$application, self::$user, self::$feed_4_public_title, self::$feed_4_public_subtitle);
|
||||
self::$feed_4_public = Feed_Adapter::create(self::$application, self::$DI['user'], self::$feed_4_public_title, self::$feed_4_public_subtitle);
|
||||
self::$feed_4_public->set_public(true);
|
||||
|
||||
$publisher = array_shift(self::$feed_4_public->get_publishers());
|
||||
@@ -126,38 +126,38 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
for ($i = 1; $i != 15; $i ++ ) {
|
||||
$entry = Feed_Entry_Adapter::create(self::$application, self::$feed_4_public, $publisher, 'titre entry', 'soustitre entry', 'Jean-Marie Biggaro', 'author@example.com');
|
||||
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_1']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_6']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_7']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_8']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_9']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_10']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_1']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_13']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_15']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_16']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_19']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_1']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_6']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_7']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_8']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_9']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_10']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_1']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_13']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_15']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_16']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_19']);
|
||||
|
||||
$entry = Feed_Entry_Adapter::create(self::$application, self::$feed_1_private, $publisher, 'titre entry', 'soustitre entry', 'Jean-Marie Biggaro', 'author@example.com');
|
||||
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_1']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_6']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_7']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_8']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_9']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_10']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_1']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_13']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_15']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_16']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, static::$records['record_19']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_1']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_6']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_7']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_8']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_9']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_10']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_1']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_13']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_15']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_16']);
|
||||
$item = Feed_Entry_Item::create($appbox, $entry, self::$DI['record_19']);
|
||||
|
||||
self::$feed_4_entries[] = $entry;
|
||||
}
|
||||
|
||||
|
||||
self::$public_feeds = Feed_Collection::load_public_feeds(self::$application);
|
||||
self::$private_feeds = Feed_Collection::load_all(self::$application, self::$user);
|
||||
self::$private_feeds = Feed_Collection::load_all(self::$application, self::$DI['user']);
|
||||
self::$application->closeAccount();
|
||||
}
|
||||
|
||||
@@ -217,10 +217,10 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
public function testPublicFeed()
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
$link = self::$feed_3_public->get_user_link($appbox->get_registry(), self::$user, Feed_Adapter::FORMAT_ATOM)->get_href();
|
||||
$link = self::$feed_3_public->get_user_link($appbox->get_registry(), self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href();
|
||||
$link = str_replace($appbox->get_registry()->get('GV_ServerName') . 'feeds/', '/', $link);
|
||||
|
||||
self::$application->closeAccount();
|
||||
@@ -237,10 +237,10 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
public function testUserFeedAggregated()
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
$link = self::$private_feeds->get_aggregate()->get_user_link($appbox->get_registry(), self::$user, Feed_Adapter::FORMAT_ATOM)->get_href();
|
||||
$link = self::$private_feeds->get_aggregate()->get_user_link($appbox->get_registry(), self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href();
|
||||
$link = str_replace($appbox->get_registry()->get('GV_ServerName') . 'feeds/', '/', $link);
|
||||
|
||||
self::$application->closeAccount();
|
||||
@@ -257,10 +257,10 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
public function testUserFeed()
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
$link = self::$feed_1_private->get_user_link($appbox->get_registry(), self::$user, Feed_Adapter::FORMAT_ATOM)->get_href();
|
||||
$link = self::$feed_1_private->get_user_link($appbox->get_registry(), self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href();
|
||||
$link = str_replace($appbox->get_registry()->get('GV_ServerName') . 'feeds/', '/', $link);
|
||||
|
||||
self::$application->closeAccount();
|
||||
@@ -364,7 +364,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
|
||||
public function testPrivateFeedAccess()
|
||||
{
|
||||
$private_feed = Feed_Adapter::create(self::$application, self::$user, 'title', 'subtitle');
|
||||
$private_feed = Feed_Adapter::create(self::$application, self::$DI['user'], 'title', 'subtitle');
|
||||
$private_feed->set_public(false);
|
||||
$this->client->request("GET", "/feeds/feed/" . $private_feed->get_id() . "/rss/");
|
||||
$this->assertFalse($this->client->getResponse()->isOk());
|
||||
|
@@ -36,21 +36,21 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testFind()
|
||||
{
|
||||
$results = $this->object->find('BABE', self::$user, self::$collection->get_databox());
|
||||
$results = $this->object->find('BABE', self::$DI['user'], self::$collection->get_databox());
|
||||
|
||||
$this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $results);
|
||||
|
||||
$results = $this->object->find(self::$user->get_email(), self::$user, self::$collection->get_databox());
|
||||
$results = $this->object->find(self::$DI['user']->get_email(), self::$DI['user'], self::$collection->get_databox());
|
||||
|
||||
$this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $results);
|
||||
$this->assertTrue($results->count() > 0);
|
||||
|
||||
$results = $this->object->find(self::$user->get_firstname(), self::$user, self::$collection->get_databox());
|
||||
$results = $this->object->find(self::$DI['user']->get_firstname(), self::$DI['user'], self::$collection->get_databox());
|
||||
|
||||
$this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $results);
|
||||
$this->assertTrue($results->count() > 0);
|
||||
|
||||
$results = $this->object->find(self::$user->get_lastname(), self::$user, self::$collection->get_databox());
|
||||
$results = $this->object->find(self::$DI['user']->get_lastname(), self::$DI['user'], self::$collection->get_databox());
|
||||
|
||||
$this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $results);
|
||||
$this->assertTrue($results->count() > 0);
|
||||
@@ -60,7 +60,7 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
|
||||
{
|
||||
$this->assertFalse($this->object->validate(-200));
|
||||
$this->assertFalse($this->object->validate('A'));
|
||||
$this->assertTrue($this->object->validate(self::$user->get_id()));
|
||||
$this->assertTrue($this->object->validate(self::$DI['user']->get_id()));
|
||||
}
|
||||
|
||||
public function testGetValue()
|
||||
@@ -79,6 +79,6 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
}
|
||||
|
||||
$this->assertEquals(self::$user->get_display_name(), $this->object->getValue(self::$user->get_id()));
|
||||
$this->assertEquals(self::$DI['user']->get_display_name(), $this->object->getValue(self::$DI['user']->get_id()));
|
||||
}
|
||||
}
|
||||
|
@@ -33,9 +33,9 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAbstract
|
||||
}
|
||||
|
||||
try {
|
||||
self::$account = Bridge_Account::load_account_from_distant_id(self::$application, self::$api, self::$user, 'kirikoo');
|
||||
self::$account = Bridge_Account::load_account_from_distant_id(self::$application, self::$api, self::$DI['user'], 'kirikoo');
|
||||
} catch (Bridge_Exception_AccountNotFound $e) {
|
||||
self::$account = Bridge_Account::create(self::$application, self::$api, self::$user, 'kirikoo', 'coucou');
|
||||
self::$account = Bridge_Account::create(self::$application, self::$api, self::$DI['user'], 'kirikoo', 'coucou');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -29,7 +29,7 @@ class Bridge_AccountSettingsTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->api = Bridge_Api::create(self::$application, 'Apitest');
|
||||
$this->dist_id = 'EZ1565loPP';
|
||||
$this->named = 'Fête à pinpins';
|
||||
$this->account = Bridge_Account::create(self::$application, $this->api, self::$user, $this->dist_id, $this->named);
|
||||
$this->account = Bridge_Account::create(self::$application, $this->api, self::$DI['user'], $this->dist_id, $this->named);
|
||||
|
||||
$this->object = new Bridge_AccountSettings($appbox, $this->account);
|
||||
} catch (Exception $e) {
|
||||
|
@@ -30,7 +30,7 @@ class Bridge_AccountTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->api = Bridge_Api::create(self::$application, 'Apitest');
|
||||
$this->dist_id = 'EZ1565loPP';
|
||||
$this->named = 'Fête à pinpins';
|
||||
$account = Bridge_Account::create(self::$application, $this->api, self::$user, $this->dist_id, $this->named);
|
||||
$account = Bridge_Account::create(self::$application, $this->api, self::$DI['user'], $this->dist_id, $this->named);
|
||||
$this->id = $account->get_id();
|
||||
|
||||
$this->object = new Bridge_Account(self::$application, $this->api, $this->id);
|
||||
@@ -78,7 +78,7 @@ class Bridge_AccountTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testGet_user()
|
||||
{
|
||||
$this->assertInstanceOf('User_Adapter', $this->object->get_user());
|
||||
$this->assertEquals(self::$user->get_id(), $this->object->get_user()->get_id());
|
||||
$this->assertEquals(self::$DI['user']->get_id(), $this->object->get_user()->get_id());
|
||||
}
|
||||
|
||||
public function testGet_name()
|
||||
@@ -135,7 +135,7 @@ class Bridge_AccountTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_accounts_by_user()
|
||||
{
|
||||
$accounts = Bridge_Account::get_accounts_by_user(self::$application, self::$user);
|
||||
$accounts = Bridge_Account::get_accounts_by_user(self::$application, self::$DI['user']);
|
||||
|
||||
$this->assertTrue(is_array($accounts));
|
||||
$this->assertTrue(count($accounts) > 0);
|
||||
|
@@ -32,12 +32,12 @@ class Bridge_ElementTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->api = Bridge_Api::create(self::$application, 'Apitest');
|
||||
$this->dist_id = 'EZ1565loPP';
|
||||
$this->named = 'Fête à pinpins';
|
||||
$this->account = Bridge_Account::create(self::$application, $this->api, self::$user, $this->dist_id, $this->named);
|
||||
$this->account = Bridge_Account::create(self::$application, $this->api, self::$DI['user'], $this->dist_id, $this->named);
|
||||
|
||||
$this->title = 'GOGACKO';
|
||||
$this->status = 'Processing';
|
||||
|
||||
$element = Bridge_Element::create(self::$application, $this->account, static::$records['record_1'], $this->title, $this->status, $this->account->get_api()->get_connector()->get_default_element_type());
|
||||
$element = Bridge_Element::create(self::$application, $this->account, self::$DI['record_1'], $this->title, $this->status, $this->account->get_api()->get_connector()->get_default_element_type());
|
||||
$this->id = $element->get_id();
|
||||
$this->object = new Bridge_Element(self::$application, $this->account, $this->id);
|
||||
}
|
||||
@@ -75,8 +75,8 @@ class Bridge_ElementTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testGet_record()
|
||||
{
|
||||
$this->assertInstanceOf('record_adapter', $this->object->get_record());
|
||||
$this->assertEquals(static::$records['record_1']->get_sbas_id(), $this->object->get_record()->get_sbas_id());
|
||||
$this->assertEquals(static::$records['record_1']->get_record_id(), $this->object->get_record()->get_record_id());
|
||||
$this->assertEquals(self::$DI['record_1']->get_sbas_id(), $this->object->get_record()->get_sbas_id());
|
||||
$this->assertEquals(self::$DI['record_1']->get_record_id(), $this->object->get_record()->get_record_id());
|
||||
}
|
||||
|
||||
public function testGet_dist_id()
|
||||
|
@@ -96,7 +96,7 @@ class EntityBasketTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
$basketElement = new \Entities\BasketElement();
|
||||
|
||||
$basketElement->setRecord(static::$records['record_1']);
|
||||
$basketElement->setRecord(self::$DI['record_1']);
|
||||
|
||||
$basketElement->setBasket($this->basket);
|
||||
|
||||
@@ -112,17 +112,17 @@ class EntityBasketTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testGetPusher()
|
||||
{
|
||||
$this->assertNull($this->basket->getPusher(self::$application)); //no pusher
|
||||
$this->basket->setPusherId(self::$user->get_id());
|
||||
$this->basket->setPusherId(self::$DI['user']->get_id());
|
||||
$this->assertInstanceOf('\User_Adapter', $this->basket->getPusher(self::$application));
|
||||
$this->assertEquals($this->basket->getPusher(self::$application)->get_id(), self::$user->get_id());
|
||||
$this->assertEquals($this->basket->getPusher(self::$application)->get_id(), self::$DI['user']->get_id());
|
||||
}
|
||||
|
||||
public function testGetOwner()
|
||||
{
|
||||
$this->assertNotNull($this->basket->getOwner(self::$application)); //no owner
|
||||
$this->basket->setUsrId(self::$user->get_id());
|
||||
$this->basket->setUsrId(self::$DI['user']->get_id());
|
||||
$this->assertInstanceOf('\User_Adapter', $this->basket->getOwner(self::$application));
|
||||
$this->assertEquals($this->basket->getOwner(self::$application)->get_id(), self::$user->get_id());
|
||||
$this->assertEquals($this->basket->getOwner(self::$application)->get_id(), self::$DI['user']->get_id());
|
||||
}
|
||||
|
||||
public function testGetValidation()
|
||||
@@ -142,7 +142,7 @@ class EntityBasketTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
$validationSession->setExpires($expires);
|
||||
|
||||
$validationSession->setInitiator(self::$user);
|
||||
$validationSession->setInitiator(self::$DI['user']);
|
||||
|
||||
$this->em->persist($validationSession);
|
||||
|
||||
|
67
tests/Exercice.php
Normal file
67
tests/Exercice.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Ces codes ne s'éxécutent pas correctement ; soit une erreur est lancé par
|
||||
* PHP, soit il manque quelque chose à la logique
|
||||
*
|
||||
*/
|
||||
|
||||
class Cochon
|
||||
{
|
||||
private $prenom;
|
||||
protected $sauvage;
|
||||
public function __construct($prenom)
|
||||
{
|
||||
$this->prenom = $prenom;
|
||||
$this->sauvage = false;
|
||||
}
|
||||
|
||||
public function isSauvage()
|
||||
{
|
||||
return $this->sauvage;
|
||||
}
|
||||
}
|
||||
|
||||
class Sanglier extends Cochon
|
||||
{
|
||||
public function __construct($prenom)
|
||||
{
|
||||
$this->sauvage = true;
|
||||
parent::__construct($prenom);
|
||||
}
|
||||
}
|
||||
|
||||
$Robert = new Sanglier('Robert');
|
||||
|
||||
assert($Robert->isSauvage());
|
||||
|
||||
/**
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
$connection = new PDO('sqlite::memory:');
|
||||
|
||||
$connection->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
$sql = 'INSERT INTO usr (id, nom, prenom, created_on)
|
||||
VALUES (:id, :nom, :prenom, NOW())';
|
||||
|
||||
$stmt = $connection->prepare($sql);
|
||||
|
||||
$n = 0;
|
||||
|
||||
while ($n++ < 100) {
|
||||
$stmt->execute(array(
|
||||
':id' => $n,
|
||||
':nom' => 'jean',
|
||||
':prenom' => 'bonno',
|
||||
));
|
||||
}
|
||||
|
||||
} catch (\PDOException $e) {
|
||||
$connection->rollBack();
|
||||
}
|
||||
|
@@ -28,11 +28,11 @@ class Feed_Entry_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$user, self::$feed_title, self::$feed_subtitle);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], self::$feed, self::$user);
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$DI['user'], self::$feed_title, self::$feed_subtitle);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], self::$feed, self::$DI['user']);
|
||||
self::$object = Feed_Entry_Adapter::create(self::$application, self::$feed, $publisher, self::$title, self::$subtitle, self::$author_name, self::$author_email);
|
||||
}
|
||||
|
||||
@@ -103,9 +103,9 @@ class Feed_Entry_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testSetFeed()
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$new_feed = Feed_Adapter::create(self::$application, self::$user, self::$feed_title, self::$feed_subtitle);
|
||||
$new_feed = Feed_Adapter::create(self::$application, self::$DI['user'], self::$feed_title, self::$feed_subtitle);
|
||||
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $new_feed, self::$user);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $new_feed, self::$DI['user']);
|
||||
$entry = Feed_Entry_Adapter::create(self::$application, self::$feed, $publisher, self::$title, self::$subtitle, self::$author_name, self::$author_email);
|
||||
|
||||
$this->assertEquals(self::$feed, $entry->get_feed());
|
||||
@@ -127,7 +127,7 @@ class Feed_Entry_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testGet_publisher()
|
||||
{
|
||||
$this->assertInstanceOf('Feed_Publisher_Adapter', self::$object->get_publisher());
|
||||
$this->assertEquals(self::$object->get_publisher()->get_user()->get_id(), self::$user->get_id());
|
||||
$this->assertEquals(self::$object->get_publisher()->get_user()->get_id(), self::$DI['user']->get_id());
|
||||
}
|
||||
|
||||
public function testGet_created_on()
|
||||
|
@@ -39,14 +39,14 @@ class Feed_Entry_CollectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$user, self::$feed_title, self::$feed_subtitle);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], self::$feed, self::$user);
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$DI['user'], self::$feed_title, self::$feed_subtitle);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], self::$feed, self::$DI['user']);
|
||||
self::$entry = Feed_Entry_Adapter::create(self::$application, self::$feed, $publisher, self::$title, self::$subtitle, self::$author_name, self::$author_email);
|
||||
|
||||
self::$item = Feed_Entry_Item::create($appbox, self::$entry, static::$records['record_1']);
|
||||
self::$item = Feed_Entry_Item::create($appbox, self::$entry, self::$DI['record_1']);
|
||||
|
||||
self::$object = new Feed_Entry_Collection();
|
||||
}
|
||||
|
@@ -34,14 +34,14 @@ class Feed_Entry_ItemTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$user, self::$feed_title, self::$feed_subtitle);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], self::$feed, self::$user);
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$DI['user'], self::$feed_title, self::$feed_subtitle);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], self::$feed, self::$DI['user']);
|
||||
self::$entry = Feed_Entry_Adapter::create(self::$application, self::$feed, $publisher, self::$title, self::$subtitle, self::$author_name, self::$author_email);
|
||||
|
||||
self::$object = Feed_Entry_Item::create($appbox, self::$entry, static::$records['record_1']);
|
||||
self::$object = Feed_Entry_Item::create($appbox, self::$entry, self::$DI['record_1']);
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
@@ -58,9 +58,9 @@ class Feed_Entry_ItemTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testGet_record()
|
||||
{
|
||||
$this->assertInstanceOf('record_adapter', self::$object->get_record());
|
||||
$this->assertEquals(static::$records['record_1']->get_record_id(), self::$object->get_record()->get_record_id());
|
||||
$this->assertEquals(static::$records['record_1']->get_sbas_id(), self::$object->get_record()->get_sbas_id());
|
||||
$this->assertEquals(static::$records['record_1']->get_base_id(), self::$object->get_record()->get_base_id());
|
||||
$this->assertEquals(self::$DI['record_1']->get_record_id(), self::$object->get_record()->get_record_id());
|
||||
$this->assertEquals(self::$DI['record_1']->get_sbas_id(), self::$object->get_record()->get_sbas_id());
|
||||
$this->assertEquals(self::$DI['record_1']->get_base_id(), self::$object->get_record()->get_base_id());
|
||||
}
|
||||
|
||||
public function testGet_ord()
|
||||
|
@@ -18,9 +18,9 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
self::$object = Feed_Adapter::create(self::$application, self::$user, self::$title, self::$subtitle);
|
||||
self::$object = Feed_Adapter::create(self::$application, self::$DI['user'], self::$title, self::$subtitle);
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
@@ -58,12 +58,12 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testIs_owner()
|
||||
{
|
||||
$this->assertTrue(self::$object->is_owner(self::$user));
|
||||
$this->assertTrue(self::$object->is_owner(self::$DI['user']));
|
||||
}
|
||||
|
||||
public function testIs_publisher()
|
||||
{
|
||||
$this->assertTrue(self::$object->is_publisher(self::$user));
|
||||
$this->assertTrue(self::$object->is_publisher(self::$DI['user']));
|
||||
}
|
||||
|
||||
public function testIs_public()
|
||||
@@ -104,7 +104,7 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testAdd_publisher()
|
||||
{
|
||||
self::$object->add_publisher(self::$user);
|
||||
self::$object->add_publisher(self::$DI['user']);
|
||||
$publishers = self::$object->get_publishers();
|
||||
$this->assertEquals(1, count($publishers));
|
||||
}
|
||||
@@ -191,7 +191,7 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testLoad_with_user()
|
||||
{
|
||||
$this->assertEquals(Feed_Adapter::load_with_user(self::$application, self::$user, self::$object->get_id())->get_id(), self::$object->get_id());
|
||||
$this->assertEquals(Feed_Adapter::load_with_user(self::$application, self::$DI['user'], self::$object->get_id())->get_id(), self::$object->get_id());
|
||||
}
|
||||
|
||||
public function testGet_count_total_entries()
|
||||
@@ -224,18 +224,18 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
$registry = self::$application['phraseanet.registry'];
|
||||
|
||||
$link = self::$object->get_user_link($registry, self::$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\//';
|
||||
|
||||
$atom = $link->get_href();
|
||||
|
||||
$this->assertRegExp($supposed, str_replace($registry->get('GV_ServerName'), '', $atom));
|
||||
$this->assertEquals($atom, self::$object->get_user_link($registry, self::$user, Feed_Adapter::FORMAT_ATOM)->get_href());
|
||||
$this->assertEquals($atom, self::$object->get_user_link($registry, self::$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($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href());
|
||||
|
||||
$this->assertNotEquals($atom, self::$object->get_user_link($registry, self::$user, Feed_Adapter::FORMAT_ATOM, null, true)->get_href());
|
||||
$this->assertNotEquals($atom, self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM, null, true)->get_href());
|
||||
|
||||
$link = self::$object->get_user_link($registry, self::$user, Feed_Adapter::FORMAT_RSS);
|
||||
$link = self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_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()));
|
||||
}
|
||||
|
@@ -18,10 +18,10 @@ class Feed_AggregateTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
$objects[] = Feed_Adapter::create(self::$application, self::$user, self::$title, self::$subtitle);
|
||||
$objects[] = Feed_Adapter::create(self::$application, self::$user, self::$title, self::$subtitle);
|
||||
$objects[] = Feed_Adapter::create(self::$application, self::$DI['user'], self::$title, self::$subtitle);
|
||||
$objects[] = Feed_Adapter::create(self::$application, self::$DI['user'], self::$title, self::$subtitle);
|
||||
|
||||
self::$feeds = $objects;
|
||||
self::$object = new Feed_Aggregate(self::$application, self::$feeds);
|
||||
@@ -69,18 +69,18 @@ class Feed_AggregateTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
$registry = self::$application['phraseanet.registry'];
|
||||
|
||||
$link = self::$object->get_user_link($registry, self::$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\//';
|
||||
|
||||
$atom = $link->get_href();
|
||||
|
||||
$this->assertRegExp($supposed, str_replace($registry->get('GV_ServerName'), '', $atom));
|
||||
$this->assertEquals($atom, self::$object->get_user_link($registry, self::$user, Feed_Adapter::FORMAT_ATOM)->get_href());
|
||||
$this->assertEquals($atom, self::$object->get_user_link($registry, self::$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($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM)->get_href());
|
||||
|
||||
$this->assertNotEquals($atom, self::$object->get_user_link($registry, self::$user, Feed_Adapter::FORMAT_ATOM, null, true)->get_href());
|
||||
$this->assertNotEquals($atom, self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_ATOM, null, true)->get_href());
|
||||
|
||||
$link = self::$object->get_user_link($registry, self::$user, Feed_Adapter::FORMAT_RSS);
|
||||
$link = self::$object->get_user_link($registry, self::$DI['user'], Feed_Adapter::FORMAT_RSS);
|
||||
$supposed = '/feeds\/userfeed\/aggregated\/([a-zA-Z0-9]{12})\/rss\//';
|
||||
$this->assertRegExp($supposed, str_replace($registry->get('GV_ServerName'), '', $link->get_href()));
|
||||
}
|
||||
|
@@ -18,9 +18,9 @@ class Feed_CollectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
self::$object = Feed_Adapter::create(self::$application, self::$user, self::$title, self::$subtitle);
|
||||
self::$object = Feed_Adapter::create(self::$application, self::$DI['user'], self::$title, self::$subtitle);
|
||||
self::$object->set_public(true);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class Feed_CollectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testLoad_all()
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$coll = Feed_Collection::load_all(self::$application, self::$user);
|
||||
$coll = Feed_Collection::load_all(self::$application, self::$DI['user']);
|
||||
|
||||
foreach ($coll->get_feeds() as $feed) {
|
||||
$this->assertInstanceOf('Feed_Adapter', $feed);
|
||||
|
@@ -22,9 +22,9 @@ class Feed_Publisher_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$user, self::$title, self::$subtitle);
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$DI['user'], self::$title, self::$subtitle);
|
||||
self::$object = array_pop(self::$feed->get_publishers());
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class Feed_Publisher_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testGet_user()
|
||||
{
|
||||
$this->assertInstanceOf('user_Adapter', self::$object->get_user());
|
||||
$this->assertEquals(self::$user->get_id(), self::$object->get_user()->get_id());
|
||||
$this->assertEquals(self::$DI['user']->get_id(), self::$object->get_user()->get_id());
|
||||
}
|
||||
|
||||
public function testIs_owner()
|
||||
|
@@ -19,6 +19,12 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
const USER_AGENT_IE6 = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)';
|
||||
const USER_AGENT_IPHONE = 'Mozilla/5.0 (iPod; U; CPU iPhone OS 2_1 like Mac OS X; fr-fr) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5F137 Safari/525.20';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var \Pimple
|
||||
*/
|
||||
protected static $DI;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Symfony\Component\HttpKernel\Client
|
||||
@@ -28,30 +34,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
public static $recordsInitialized = false;
|
||||
protected static $useExceptionHandler = false;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var User_Adapter
|
||||
*/
|
||||
protected static $user;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var User_Adapter
|
||||
*/
|
||||
protected static $user_notAdmin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var User_Adapter
|
||||
*/
|
||||
protected static $user_alt1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var User_Adapter
|
||||
*/
|
||||
protected static $user_alt2;
|
||||
|
||||
/**
|
||||
* Tell if tables were updated with new schemas
|
||||
* @var boolean
|
||||
@@ -100,15 +82,17 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
exit("\033[0;31mPhraseanet is not set up\033[0;37m\r\n");
|
||||
}
|
||||
|
||||
self::$DI = new \Pimple();
|
||||
$application = new Application('test');
|
||||
self::createSetOfUserTests($application);
|
||||
|
||||
static::loadApplication();
|
||||
|
||||
self::updateTablesSchema();
|
||||
|
||||
self::createSetOfUserTests();
|
||||
self::setCollection($application);
|
||||
|
||||
self::setCollection();
|
||||
|
||||
self::generateRecords();
|
||||
self::generateRecords($application);
|
||||
}
|
||||
|
||||
protected static function loadApplication()
|
||||
@@ -165,6 +149,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
return $em;
|
||||
}));
|
||||
}
|
||||
protected static $testsTime = array();
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
@@ -181,8 +166,8 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
|
||||
// $this->purgeDatabase();
|
||||
|
||||
self::$user->ACL()->revoke_access_from_bases(array(self::$collection_no_access->get_base_id()));
|
||||
self::$user->ACL()->set_masks_on_base(self::$collection_no_access_by_status->get_base_id(), '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000');
|
||||
self::$DI['user']->ACL()->revoke_access_from_bases(array(self::$collection_no_access->get_base_id()));
|
||||
self::$DI['user']->ACL()->set_masks_on_base(self::$collection_no_access_by_status->get_base_id(), '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000');
|
||||
|
||||
\PHPUnit_Framework_Error_Warning::$enabled = true;
|
||||
\PHPUnit_Framework_Error_Notice::$enabled = true;
|
||||
@@ -254,7 +239,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
try {
|
||||
$basketFixture = new PhraseaFixture\Basket\LoadOneBasket();
|
||||
|
||||
$basketFixture->setUser(self::$user);
|
||||
$basketFixture->setUser(self::$DI['user']);
|
||||
|
||||
$loader = new Loader();
|
||||
$loader->addFixture($basketFixture);
|
||||
@@ -277,7 +262,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
try {
|
||||
$lazaretFixture = new PhraseaFixture\Lazaret\LoadOneFile();
|
||||
|
||||
$lazaretFixture->setUser(self::$user);
|
||||
$lazaretFixture->setUser(self::$DI['user']);
|
||||
$lazaretFixture->setCollectionId(self::$collection->get_base_id());
|
||||
|
||||
$loader = new Loader();
|
||||
@@ -358,7 +343,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
try {
|
||||
$basketFixture = new PhraseaFixture\Basket\LoadFiveBaskets();
|
||||
|
||||
$basketFixture->setUser(self::$user);
|
||||
$basketFixture->setUser(self::$DI['user']);
|
||||
|
||||
$loader = new Loader();
|
||||
$loader->addFixture($basketFixture);
|
||||
@@ -380,7 +365,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
$basket = $this->insertOneBasket();
|
||||
|
||||
$basketElement = new \Entities\BasketElement();
|
||||
$basketElement->setRecord(static::$records['record_1']);
|
||||
$basketElement->setRecord(self::$DI['record_1']);
|
||||
$basketElement->setBasket($basket);
|
||||
|
||||
$basket->addBasketElement($basketElement);
|
||||
@@ -409,7 +394,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
|
||||
$Validation = new Entities\ValidationSession();
|
||||
$Validation->setBasket($basket);
|
||||
$Validation->setInitiator(self::$user);
|
||||
$Validation->setInitiator(self::$DI['user']);
|
||||
|
||||
if (isset($parameters['expires']) && $parameters['expires'] instanceof \DateTime) {
|
||||
$Validation->setExpires($parameters['expires']);
|
||||
@@ -420,7 +405,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
$em->merge($basket);
|
||||
|
||||
$Participant = new Entities\ValidationParticipant();
|
||||
$Participant->setUser(self::$user);
|
||||
$Participant->setUser(self::$DI['user']);
|
||||
$Participant->setCanAgree(true);
|
||||
$Participant->setCanSeeOthers(true);
|
||||
|
||||
@@ -457,13 +442,13 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
try {
|
||||
$basketFixture = new PhraseaFixture\Basket\LoadOneBasketEnv();
|
||||
|
||||
$basketFixture->setUser(self::$user);
|
||||
$basketFixture->setUser(self::$DI['user']);
|
||||
|
||||
$basketFixture->addParticipant(self::$user_alt1);
|
||||
$basketFixture->addParticipant(self::$user_alt2);
|
||||
$basketFixture->addParticipant(self::$DI['user_alt1']);
|
||||
$basketFixture->addParticipant(self::$DI['user_alt2']);
|
||||
|
||||
$basketFixture->addBasketElement(static::$records['record_1']);
|
||||
$basketFixture->addBasketElement(static::$records['record_2']);
|
||||
$basketFixture->addBasketElement(self::$DI['record_1']);
|
||||
$basketFixture->addBasketElement(self::$DI['record_2']);
|
||||
|
||||
$loader = new Loader();
|
||||
$loader->addFixture($basketFixture);
|
||||
@@ -486,15 +471,15 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
protected function insertOneWZ()
|
||||
{
|
||||
try {
|
||||
$currentUser = self::$user;
|
||||
$altUser = self::$user_alt1;
|
||||
$currentUser = self::$DI['user'];
|
||||
$altUser = self::$DI['user_alt1'];
|
||||
//add one basket
|
||||
$basket = new PhraseaFixture\Basket\LoadOneBasket();
|
||||
$basket->setUser($currentUser);
|
||||
//add one story
|
||||
$story = new PhraseaFixture\Story\LoadOneStory();
|
||||
$story->setUser($currentUser);
|
||||
$story->setRecord(static::$records['record_1']);
|
||||
$story->setRecord(self::$DI['record_1']);
|
||||
//add a validation session initiated by alt user
|
||||
$validationSession = new PhraseaFixture\ValidationSession\LoadOneValidationSession();
|
||||
$validationSession->setUser($altUser);
|
||||
@@ -592,50 +577,57 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
|
||||
/**
|
||||
* Create a set of users for the test suite
|
||||
* self::$user
|
||||
* self::$user_alt1
|
||||
* self::$user_alt2
|
||||
* self::$DI['user']
|
||||
* self::$DI['user_alt1']
|
||||
* self::$DI['user_alt2']
|
||||
*
|
||||
* @return void;
|
||||
*/
|
||||
private static function createSetOfUserTests()
|
||||
private static function createSetOfUserTests(Application $application)
|
||||
{
|
||||
static $loaded;
|
||||
self::$DI['user'] = self::$DI->share(function () use ($application) {
|
||||
$usr_id = User_Adapter::get_usr_id_from_login($application, 'test_phpunit');
|
||||
|
||||
if (!$loaded) {
|
||||
if (!$usr_id) {
|
||||
$user = User_Adapter::create($application, 'test_phpunit', random::generatePassword(), 'noone@example.com', false);
|
||||
$usr_id = $user->get_id();
|
||||
}
|
||||
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
return new User_Adapter($usr_id, $application);
|
||||
});
|
||||
|
||||
$usr_id = User_Adapter::get_usr_id_from_login(self::$application, 'test_phpunit');
|
||||
$usr_id_noadmin = User_Adapter::get_usr_id_from_login(self::$application, 'test_phpunit_not_admin');
|
||||
$usr_alt1_id = User_Adapter::get_usr_id_from_login(self::$application, 'test_phpunit_alt1');
|
||||
$usr_alt2_id = User_Adapter::get_usr_id_from_login(self::$application, 'test_phpunit_alt2');
|
||||
self::$DI['user_notAdmin'] = self::$DI->share(function () use ($application) {
|
||||
$usr_id = User_Adapter::get_usr_id_from_login($application, 'test_phpunit_not_admin');
|
||||
|
||||
if (!$usr_id) {
|
||||
$user = User_Adapter::create(self::$application, 'test_phpunit', random::generatePassword(), 'noone@example.com', false);
|
||||
$usr_id = $user->get_id();
|
||||
}
|
||||
if (!$usr_id_noadmin) {
|
||||
$user = User_Adapter::create(self::$application, 'test_phpunit_not_admin', random::generatePassword(), 'noone_not_admin@example.com', false);
|
||||
$usr_id_noadmin = $user->get_id();
|
||||
}
|
||||
if (!$usr_alt1_id) {
|
||||
$user = User_Adapter::create(self::$application, 'test_phpunit_alt1', random::generatePassword(), 'noonealt1@example.com', false);
|
||||
$usr_alt1_id = $user->get_id();
|
||||
}
|
||||
if (!$usr_alt2_id) {
|
||||
$user = User_Adapter::create(self::$application, 'test_phpunit_alt2', random::generatePassword(), 'noonealt2@example.com', false);
|
||||
$usr_alt2_id = $user->get_id();
|
||||
}
|
||||
if (!$usr_id) {
|
||||
$user = User_Adapter::create($application, 'test_phpunit_not_admin', random::generatePassword(), 'noone@example.com', false);
|
||||
$usr_id = $user->get_id();
|
||||
}
|
||||
|
||||
self::$user = User_Adapter::getInstance($usr_id, self::$application);
|
||||
self::$user_notAdmin = User_Adapter::getInstance($usr_id_noadmin, self::$application);
|
||||
self::$user_alt1 = User_Adapter::getInstance($usr_alt2_id, self::$application);
|
||||
self::$user_alt2 = User_Adapter::getInstance($usr_alt1_id, self::$application);
|
||||
return new User_Adapter($usr_id, $application);
|
||||
});
|
||||
|
||||
$loaded = true;
|
||||
}
|
||||
return;
|
||||
self::$DI['user_alt1'] = self::$DI->share(function () use ($application) {
|
||||
$usr_id = User_Adapter::get_usr_id_from_login($application, 'test_phpunit_alt1');
|
||||
|
||||
if (!$usr_id) {
|
||||
$user = User_Adapter::create($application, 'test_phpunit_alt1', random::generatePassword(), 'noone@example.com', false);
|
||||
$usr_id = $user->get_id();
|
||||
}
|
||||
|
||||
return new User_Adapter($usr_id, $application);
|
||||
});
|
||||
|
||||
self::$DI['user_alt2'] = self::$DI->share(function () use ($application) {
|
||||
$usr_id = User_Adapter::get_usr_id_from_login($application, 'test_phpunit_alt2');
|
||||
|
||||
if (!$usr_id) {
|
||||
$user = User_Adapter::create($application, 'test_phpunit_alt2', random::generatePassword(), 'noone@example.com', false);
|
||||
$usr_id = $user->get_id();
|
||||
}
|
||||
|
||||
return new User_Adapter($usr_id, $application);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -697,12 +689,12 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
* Set self::$collection
|
||||
* @return void
|
||||
*/
|
||||
private static function setCollection()
|
||||
private static function setCollection(Application $application)
|
||||
{
|
||||
static $loaded;
|
||||
|
||||
if (!$loaded) {
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$appbox = $application['phraseanet.appbox'];
|
||||
$coll = $collection_no_acces = $collection_no_acces_by_status = $db = null;
|
||||
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
@@ -729,10 +721,10 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
self::fail('Unable to find a collection');
|
||||
}
|
||||
if (!$collection_no_acces instanceof collection) {
|
||||
$collection_no_acces = collection::create(self::$application, $databox, $appbox, 'BIBOO', self::$user);
|
||||
$collection_no_acces = collection::create($application, $databox, $appbox, 'BIBOO', self::$DI['user']);
|
||||
}
|
||||
if (!$collection_no_acces_by_status instanceof collection) {
|
||||
$collection_no_acces_by_status = collection::create(self::$application, $databox, $appbox, 'BIBOONOACCESBYSTATUS');
|
||||
$collection_no_acces_by_status = collection::create($application, $databox, $appbox, 'BIBOONOACCESBYSTATUS');
|
||||
}
|
||||
|
||||
self::$collection = $coll;
|
||||
@@ -749,17 +741,14 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
/**
|
||||
* Generate a set of records for the current tests suites
|
||||
*/
|
||||
private static function generateRecords()
|
||||
private static function generateRecords(Application $app)
|
||||
{
|
||||
|
||||
if (self::$recordsInitialized === false) {
|
||||
|
||||
$logger = new \Monolog\Logger('tests');
|
||||
$logger->pushHandler(new \Monolog\Handler\NullHandler());
|
||||
self::$recordsInitialized = array();
|
||||
|
||||
static::$records = new Pimple();
|
||||
|
||||
$collection = self::$collection;
|
||||
|
||||
$resolvePathfile = function($i) {
|
||||
@@ -776,10 +765,8 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
throw new Exception(sprintf('File %d not found', $i));
|
||||
};
|
||||
|
||||
$app = self::$application;
|
||||
|
||||
foreach (range(1, 24) as $i) {
|
||||
static::$records['record_' . $i] = static::$records->share(function() use ($logger, $collection, $resolvePathfile, $i, $app) {
|
||||
self::$DI['record_' . $i] = self::$DI->share(function() use ($logger, $collection, $resolvePathfile, $i, $app) {
|
||||
|
||||
PhraseanetPHPUnitAbstract::$recordsInitialized[] = $i;
|
||||
|
||||
@@ -793,7 +780,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
});
|
||||
}
|
||||
foreach (range(1, 2) as $i) {
|
||||
static::$records['record_story_' . $i] = static::$records->share(function() use ($collection, $i, $app) {
|
||||
self::$DI['record_story_' . $i] = self::$DI->share(function() use ($collection, $i, $app) {
|
||||
|
||||
PhraseanetPHPUnitAbstract::$recordsInitialized[] = 'story_' . $i;
|
||||
|
||||
@@ -803,7 +790,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
|
||||
$collection_no_access = self::$collection_no_access;
|
||||
|
||||
static::$records['record_no_access'] = static::$records->share(function() use ($collection_no_access, $app) {
|
||||
self::$DI['record_no_access'] = self::$DI->share(function() use ($collection_no_access, $app) {
|
||||
|
||||
PhraseanetPHPUnitAbstract::$recordsInitialized[] = 'no_access';
|
||||
|
||||
@@ -812,7 +799,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
return \record_adapter::createFromFile($file, $app);
|
||||
});
|
||||
|
||||
static::$records['record_no_access_by_status'] = static::$records->share(function()use($collection_no_access, $app) {
|
||||
self::$DI['record_no_access_by_status'] = self::$DI->share(function()use($collection_no_access, $app) {
|
||||
|
||||
PhraseanetPHPUnitAbstract::$recordsInitialized[] = 'no_access_by_status';
|
||||
|
||||
@@ -821,10 +808,10 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
return \record_adapter::createFromFile($file, $app);
|
||||
});
|
||||
|
||||
self::giveRightsToUser(self::$user);
|
||||
self::$user->ACL()->set_admin(true);
|
||||
self::giveRightsToUser(self::$user_notAdmin);
|
||||
self::$user_notAdmin->ACL()->set_admin(false);
|
||||
self::giveRightsToUser(self::$DI['user']);
|
||||
self::$DI['user']->ACL()->set_admin(true);
|
||||
self::giveRightsToUser(self::$DI['user_notAdmin']);
|
||||
self::$DI['user_notAdmin']->ACL()->set_admin(false);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -851,7 +838,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
|
||||
if (self::$recordsInitialized !== false) {
|
||||
foreach (self::$recordsInitialized as $i) {
|
||||
// static::$records['record_' . $i]->delete();
|
||||
// self::$DI['record_' . $i]->delete();
|
||||
}
|
||||
|
||||
self::$recordsInitialized = array();
|
||||
|
@@ -12,7 +12,7 @@ abstract class PhraseanetPHPUnitAuthenticatedAbstract extends PhraseanetPHPUnitA
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,7 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
|
||||
|
||||
$stubAuthenticatedUser->expects($this->any())
|
||||
->method('get_id')
|
||||
->will($this->returnValue(self::$user->get_id()));
|
||||
->will($this->returnValue(self::$DI['user']->get_id()));
|
||||
|
||||
self::$application['phraseanet.user'] = $stubAuthenticatedUser;
|
||||
|
||||
|
@@ -19,7 +19,7 @@ class Session_LoggerTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
protected function feed_datas()
|
||||
{
|
||||
$user = self::$user;
|
||||
$user = self::$DI['user'];
|
||||
$auth = new Session_Authentication_None($user);
|
||||
|
||||
self::$application->openAccount($auth);
|
||||
|
@@ -18,8 +18,8 @@ class API_OAuth2_AuthCodeTest extends PhraseanetPHPUnitAbstract
|
||||
{
|
||||
parent::setUp();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$this->application = API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$this->account = API_OAuth2_Account::load_with_user(self::$application, $this->application, self::$user);
|
||||
$this->application = API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
$this->account = API_OAuth2_Account::load_with_user(self::$application, $this->application, self::$DI['user']);
|
||||
|
||||
$expires = time() + 100;
|
||||
$this->code = random::generatePassword(8);
|
||||
|
@@ -19,8 +19,8 @@ class API_OAuth2_RefreshTokenTest extends PhraseanetPHPUnitAbstract
|
||||
{
|
||||
parent::setUp();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$this->application = API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$this->account = API_OAuth2_Account::load_with_user(self::$application, $this->application, self::$user);
|
||||
$this->application = API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
$this->account = API_OAuth2_Account::load_with_user(self::$application, $this->application, self::$DI['user']);
|
||||
|
||||
$expires = time() + 100;
|
||||
$this->token = random::generatePassword(8);
|
||||
|
@@ -16,8 +16,8 @@ class API_OAuth2_AccountTest extends PhraseanetPHPUnitAbstract
|
||||
{
|
||||
parent::setUp();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$this->application = API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$this->object = API_OAuth2_Account::load_with_user(self::$application, $this->application, self::$user);
|
||||
$this->application = API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
$this->object = API_OAuth2_Account::load_with_user(self::$application, $this->application, self::$DI['user']);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
@@ -34,7 +34,7 @@ class API_OAuth2_AccountTest extends PhraseanetPHPUnitAbstract
|
||||
public function testGet_user()
|
||||
{
|
||||
$this->assertInstanceOf('User_Adapter', $this->object->get_user());
|
||||
$this->assertEquals(self::$user, $this->object->get_user());
|
||||
$this->assertEquals(self::$DI['user'], $this->object->get_user());
|
||||
}
|
||||
|
||||
public function testGet_api_version()
|
||||
@@ -74,7 +74,7 @@ class API_OAuth2_AccountTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testLoad_with_user()
|
||||
{
|
||||
$loaded = API_OAuth2_Account::load_with_user(self::$application, $this->application, self::$user);
|
||||
$loaded = API_OAuth2_Account::load_with_user(self::$application, $this->application, self::$DI['user']);
|
||||
$this->assertInstanceOf('API_OAuth2_Account', $loaded);
|
||||
$this->assertEquals($this->object, $loaded);
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ class API_OAuth2_ApplicationTest extends PhraseanetPHPUnitAbstract
|
||||
{
|
||||
parent::setUp();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$this->object = API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$this->object = API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
@@ -34,7 +34,7 @@ class API_OAuth2_ApplicationTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testLoad_dev_app_by_user()
|
||||
{
|
||||
$apps = API_OAuth2_Application::load_dev_app_by_user(self::$application, self::$user);
|
||||
$apps = API_OAuth2_Application::load_dev_app_by_user(self::$application, self::$DI['user']);
|
||||
$this->assertTrue(is_array($apps));
|
||||
$this->assertTrue(count($apps) > 0);
|
||||
$found = false;
|
||||
@@ -50,7 +50,7 @@ class API_OAuth2_ApplicationTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testLoad_app_by_user()
|
||||
{
|
||||
$apps = API_OAuth2_Application::load_app_by_user(self::$application, self::$user);
|
||||
$apps = API_OAuth2_Application::load_app_by_user(self::$application, self::$DI['user']);
|
||||
$this->assertTrue(is_array($apps));
|
||||
$this->assertTrue(count($apps) > 0);
|
||||
$found = false;
|
||||
@@ -192,6 +192,6 @@ class API_OAuth2_ApplicationTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testGet_user_account()
|
||||
{
|
||||
$this->assertInstanceOf('API_OAuth2_Account', $this->object->get_user_account(self::$user));
|
||||
$this->assertInstanceOf('API_OAuth2_Account', $this->object->get_user_account(self::$DI['user']));
|
||||
}
|
||||
}
|
||||
|
@@ -16,8 +16,8 @@ class API_OAuth2_TokenTest extends PhraseanetPHPUnitAbstract
|
||||
{
|
||||
parent::setUp();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$this->application = API_OAuth2_Application::create(self::$application, self::$user, 'test app');
|
||||
$account = API_OAuth2_Account::load_with_user(self::$application, $this->application, self::$user);
|
||||
$this->application = API_OAuth2_Application::create(self::$application, self::$DI['user'], 'test app');
|
||||
$account = API_OAuth2_Account::load_with_user(self::$application, $this->application, self::$DI['user']);
|
||||
|
||||
try {
|
||||
new API_OAuth2_Token($appbox, $account);
|
||||
|
@@ -118,11 +118,11 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$result = $this->object->get_record($request, static::$records['record_1']->get_sbas_id(), "-40");
|
||||
$result = $this->object->get_record($request, self::$DI['record_1']->get_sbas_id(), "-40");
|
||||
$this->assertEquals(400, $result->get_http_code());
|
||||
|
||||
$request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$result = $this->object->get_record($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $this->object->get_record($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertEquals(200, $result->get_http_code());
|
||||
$this->assertEquals('application/json', $result->get_content_type());
|
||||
$this->assertTrue(is_array(json_decode($result->format(), true)));
|
||||
@@ -178,7 +178,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$result = $this->object->get_record_related($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $this->object->get_record_related($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertEquals(200, $result->get_http_code());
|
||||
$this->assertEquals('application/json', $result->get_content_type());
|
||||
$this->assertTrue(is_array(json_decode($result->format(), true)));
|
||||
@@ -189,7 +189,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$result = $this->object->get_record_metadatas($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $this->object->get_record_metadatas($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertEquals(200, $result->get_http_code());
|
||||
$this->assertEquals('application/json', $result->get_content_type());
|
||||
$this->assertTrue(is_array(json_decode($result->format(), true)));
|
||||
@@ -201,7 +201,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
$request = new Request();
|
||||
$request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$result = $this->object->get_record_status($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $this->object->get_record_status($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertEquals(200, $result->get_http_code());
|
||||
$this->assertEquals('application/json', $result->get_content_type());
|
||||
$this->assertTrue(is_array(json_decode($result->format(), true)));
|
||||
@@ -212,7 +212,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$result = $this->object->get_record_embed($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $this->object->get_record_embed($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertEquals(200, $result->get_http_code());
|
||||
$this->assertEquals('application/json', $result->get_content_type());
|
||||
$this->assertTrue(is_array(json_decode($result->format(), true)));
|
||||
@@ -221,25 +221,25 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testSet_record_metadatas()
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$databox = static::$records['record_1']->get_databox();
|
||||
$databox = self::$DI['record_1']->get_databox();
|
||||
$request = new Request(array("salut" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$result = $this->object->set_record_metadatas($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $this->object->set_record_metadatas($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertEquals(400, $result->get_http_code());
|
||||
|
||||
$request = new Request(array("metadatas" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$this->object->set_record_metadatas($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$this->object->set_record_metadatas($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertEquals(400, $result->get_http_code());
|
||||
|
||||
if (sizeof(static::$records['record_1']->get_caption()->get_fields()) == 0) {
|
||||
$caption_field_value = caption_Field_Value::create(self::$application, databox_field::get_instance(self::$application, $databox, 1), static::$records['record_1'], 'my value');
|
||||
if (sizeof(self::$DI['record_1']->get_caption()->get_fields()) == 0) {
|
||||
$caption_field_value = caption_Field_Value::create(self::$application, databox_field::get_instance(self::$application, $databox, 1), self::$DI['record_1'], 'my value');
|
||||
}
|
||||
|
||||
//valide metas
|
||||
$metadatas = array();
|
||||
|
||||
foreach (static::$records['record_1']->get_databox()->get_meta_structure()->get_elements() as $field) {
|
||||
foreach (self::$DI['record_1']->get_databox()->get_meta_structure()->get_elements() as $field) {
|
||||
try {
|
||||
$values = static::$records['record_1']->get_caption()->get_field($field->get_name())->get_values();
|
||||
$values = self::$DI['record_1']->get_caption()->get_field($field->get_name())->get_values();
|
||||
$value = array_pop($values);
|
||||
$meta_id = $value->getId();
|
||||
} catch (\Exception $e) {
|
||||
@@ -255,7 +255,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
$request = new Request(array("metadatas" => $metadatas), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
|
||||
$result = $this->object->set_record_metadatas($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $this->object->set_record_metadatas($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
|
||||
$response = json_decode($result->format(), true);
|
||||
|
||||
@@ -268,7 +268,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
$app = self::$application;
|
||||
$stub = $this->getMock("API_V1_adapter", array("list_record_status"), array($app));
|
||||
$databox = static::$records['record_1']->get_databox();
|
||||
$databox = self::$DI['record_1']->get_databox();
|
||||
|
||||
$statusbit = null;
|
||||
foreach ($databox->get_statusbits() as $key => $value) {
|
||||
@@ -281,11 +281,11 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
}
|
||||
|
||||
$request = new Request(array("salut" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$result = $stub->set_record_status($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $stub->set_record_status($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertEquals(400, $result->get_http_code());
|
||||
|
||||
$request = new Request(array("status" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$stub->set_record_status($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$stub->set_record_status($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertEquals(400, $result->get_http_code());
|
||||
|
||||
$status = array($statusbit => '1');
|
||||
@@ -296,7 +296,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
->method("list_record_status")
|
||||
->will($this->returnValue(new stdClass()));
|
||||
//check for metadas fiels in response
|
||||
$result = $stub->set_record_status($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $stub->set_record_status($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->checkResponseField($result, "status", 'array');
|
||||
}
|
||||
|
||||
@@ -304,10 +304,10 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
$app = self::$application;
|
||||
$stub = $this->getMock("API_V1_adapter", array("list_record"), array($app));
|
||||
$databox = static::$records['record_1']->get_databox();
|
||||
$databox = self::$DI['record_1']->get_databox();
|
||||
|
||||
$request = new Request(array("salut" => "salut c'est la fete"), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$result = $stub->set_record_collection($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $stub->set_record_collection($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertEquals(400, $result->get_http_code());
|
||||
|
||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
@@ -323,7 +323,7 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
->method("list_record")
|
||||
->will($this->returnValue(new stdClass()));
|
||||
//check for metadas fiels in response
|
||||
$result = $stub->set_record_collection($request, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_record_id());
|
||||
$result = $stub->set_record_collection($request, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_record_id());
|
||||
$this->checkResponseField($result, "record", 'array');
|
||||
}
|
||||
|
||||
@@ -461,8 +461,8 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "hello", "salut");
|
||||
$result = $this->object->search_publications($request, self::$user);
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "hello", "salut");
|
||||
$result = $this->object->search_publications($request, self::$DI['user']);
|
||||
$this->checkResponseField($result, "feeds", 'array');
|
||||
$feed->delete();
|
||||
}
|
||||
@@ -481,13 +481,13 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
$date = new DateTime();
|
||||
$request = new Request(array(), array(), array(), array(), array(), array('HTTP_Accept' => 'application/json'));
|
||||
$feed = Feed_Adapter::create(self::$application, self::$user, "hello", "salut");
|
||||
$feed_publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $feed, self::$user);
|
||||
$feed = Feed_Adapter::create(self::$application, self::$DI['user'], "hello", "salut");
|
||||
$feed_publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $feed, self::$DI['user']);
|
||||
$feed_entry = Feed_Entry_Adapter::create(self::$application, $feed, $feed_publisher, "coucou", "hello", "me", "my@email.com");
|
||||
$feed_entry_item = Feed_Entry_Item::create($appbox, $feed_entry, static::$records['record_1']);
|
||||
$coll = Feed_Collection::load_all(self::$application, self::$user);
|
||||
$feed_entry_item = Feed_Entry_Item::create($appbox, $feed_entry, self::$DI['record_1']);
|
||||
$coll = Feed_Collection::load_all(self::$application, self::$DI['user']);
|
||||
foreach ($coll->get_feeds() as $feed) {
|
||||
$result = $this->object->get_publication($request, $feed->get_id(), self::$user);
|
||||
$result = $this->object->get_publication($request, $feed->get_id(), self::$DI['user']);
|
||||
$this->checkResponseField($result, "feed", 'array');
|
||||
$this->checkResponseField($result, "entries", 'array');
|
||||
$this->checkResponseField($result, "offset_start", 'integer');
|
||||
|
@@ -12,7 +12,7 @@ class caption_recordTest extends PhraseanetPHPUnitAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->object = new caption_record(self::$application, static::$records['record_1'], static::$records['record_1']->get_databox());
|
||||
$this->object = new caption_record(self::$application, self::$DI['record_1'], self::$DI['record_1']->get_databox());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,11 +21,11 @@ class caption_recordTest extends PhraseanetPHPUnitAbstract
|
||||
public function testSerializeXML()
|
||||
{
|
||||
|
||||
foreach (static::$records['record_1']->get_databox()->get_meta_structure() as $databox_field) {
|
||||
foreach (self::$DI['record_1']->get_databox()->get_meta_structure() as $databox_field) {
|
||||
$n = $databox_field->is_multi() ? 3 : 1;
|
||||
|
||||
for ($i = 0; $i < $n; $i ++ ) {
|
||||
\caption_Field_Value::create(self::$application, $databox_field, static::$records['record_1'], \random::generatePassword());
|
||||
\caption_Field_Value::create(self::$application, $databox_field, self::$DI['record_1'], \random::generatePassword());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class caption_recordTest extends PhraseanetPHPUnitAbstract
|
||||
$sxe = simplexml_load_string($xml);
|
||||
$this->assertInstanceOf('SimpleXMLElement', $sxe);
|
||||
|
||||
foreach (static::$records['record_1']->get_caption()->get_fields() as $field) {
|
||||
foreach (self::$DI['record_1']->get_caption()->get_fields() as $field) {
|
||||
if ($field->get_databox_field()->is_multi()) {
|
||||
$tagname = $field->get_name();
|
||||
$retrieved = array();
|
||||
|
@@ -20,7 +20,7 @@ class collectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$auth = new Session_Authentication_None(self::$DI['user']);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
$found = false;
|
||||
@@ -32,12 +32,12 @@ class collectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
if ( ! $found)
|
||||
self::fail('No databox found for collection test');
|
||||
|
||||
self::$object = collection::create(self::$application, $databox, $appbox, 'test_collection', self::$user);
|
||||
self::$object = collection::create(self::$application, $databox, $appbox, 'test_collection', self::$DI['user']);
|
||||
|
||||
if ( ! self::$object instanceof collection)
|
||||
self::fail('Unable to create collection');
|
||||
|
||||
self::$objectDisable = collection::create(self::$application, $databox, $appbox, 'test_collection', self::$user);
|
||||
self::$objectDisable = collection::create(self::$application, $databox, $appbox, 'test_collection', self::$DI['user']);
|
||||
self::$objectDisable->disable(self::$application['phraseanet.appbox']);
|
||||
if ( ! self::$objectDisable instanceof collection)
|
||||
self::fail('Unable to create disable collection');
|
||||
|
@@ -16,7 +16,7 @@ class databox_fieldTest extends PhraseanetPHPUnitAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->databox = static::$records['record_1']->get_databox();
|
||||
$this->databox = self::$DI['record_1']->get_databox();
|
||||
$this->name_mono = 'Field Test Mono';
|
||||
$this->name_multi = 'Field Test Multi';
|
||||
|
||||
@@ -77,9 +77,9 @@ class databox_fieldTest extends PhraseanetPHPUnitAbstract
|
||||
public function testGet_databox()
|
||||
{
|
||||
$this->assertInstanceOf('\databox', $this->object_mono->get_databox());
|
||||
$this->assertEquals(static::$records['record_1']->get_databox()->get_sbas_id(), $this->object_mono->get_databox()->get_sbas_id());
|
||||
$this->assertEquals(self::$DI['record_1']->get_databox()->get_sbas_id(), $this->object_mono->get_databox()->get_sbas_id());
|
||||
$this->assertInstanceOf('\databox', $this->object_multi->get_databox());
|
||||
$this->assertEquals(static::$records['record_1']->get_databox()->get_sbas_id(), $this->object_multi->get_databox()->get_sbas_id());
|
||||
$this->assertEquals(self::$DI['record_1']->get_databox()->get_sbas_id(), $this->object_multi->get_databox()->get_sbas_id());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -342,7 +342,7 @@ class databox_fieldTest extends PhraseanetPHPUnitAbstract
|
||||
{
|
||||
$AddedValue = 'scalar value';
|
||||
|
||||
static::$records['record_1']->set_metadatas(array(
|
||||
self::$DI['record_1']->set_metadatas(array(
|
||||
array(
|
||||
'meta_id' => null,
|
||||
'meta_struct_id' => $this->object_mono->get_id(),
|
||||
@@ -352,7 +352,7 @@ class databox_fieldTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
$this->object_mono->set_name('Bonobo yoyo')->save();
|
||||
|
||||
$value = array_pop(static::$records['record_1']->get_caption()->get_field('Bonoboyoyo')->get_values());
|
||||
$value = array_pop(self::$DI['record_1']->get_caption()->get_field('Bonoboyoyo')->get_values());
|
||||
$this->assertEquals($value->getValue(), $AddedValue);
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,7 @@ class databox_statusTest extends PhraseanetPHPUnitAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->databox = static::$records['record_1']->get_databox();
|
||||
$this->databox = self::$DI['record_1']->get_databox();
|
||||
$this->object = $this->databox->get_statusbits();
|
||||
}
|
||||
|
||||
|
@@ -12,8 +12,8 @@ class media_Permalink_AdapterTest extends PhraseanetPHPUnitAbstract
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$databox = static::$records['record_1']->get_databox();
|
||||
static::$object = media_Permalink_Adapter::getPermalink(self::$application, $databox, static::$records['record_1']->get_subdef('document'));
|
||||
$databox = self::$DI['record_1']->get_databox();
|
||||
static::$object = media_Permalink_Adapter::getPermalink(self::$application, $databox, self::$DI['record_1']->get_subdef('document'));
|
||||
}
|
||||
|
||||
public function testGetPermalink()
|
||||
@@ -44,7 +44,7 @@ class media_Permalink_AdapterTest extends PhraseanetPHPUnitAbstract
|
||||
public function testGet_url()
|
||||
{
|
||||
$registry = self::$application['phraseanet.registry'];
|
||||
$url = $registry->get('GV_ServerName') . 'permalink/v1/' . static::$object->get_label() . '/' . static::$records['record_1']->get_sbas_id() . '/' . static::$records['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/';
|
||||
|
||||
$this->assertEquals($url, static::$object->get_url($registry));
|
||||
|
@@ -56,7 +56,7 @@ class media_subdefTest extends \PhraseanetPHPUnitAbstract
|
||||
}
|
||||
|
||||
self::$objectNotPresent->remove_file();
|
||||
self::$storyPresent = self::$records['record_story_1']->get_subdef('thumbnail');
|
||||
self::$storyPresent = self::$DI['record_story_1']->get_subdef('thumbnail');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -8,7 +8,7 @@ class randomTest extends PhraseanetPHPUnitAbstract
|
||||
public function testCleanTokens()
|
||||
{
|
||||
$expires_on = new DateTime('-5 minutes');
|
||||
$usr_id = self::$user->get_id();
|
||||
$usr_id = self::$DI['user']->get_id();
|
||||
$token = random::getUrlToken(self::$application, \random::TYPE_PASSWORD, $usr_id, $expires_on, 'some nice datas');
|
||||
random::cleanTokens(self::$application);
|
||||
|
||||
@@ -59,7 +59,7 @@ class randomTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testGetUrlToken()
|
||||
{
|
||||
$usr_id = self::$user->get_id();
|
||||
$usr_id = self::$DI['user']->get_id();
|
||||
$token = random::getUrlToken(self::$application, \random::TYPE_PASSWORD, $usr_id, null, 'some nice datas');
|
||||
$datas = random::helloToken(self::$application, $token);
|
||||
$this->assertEquals('some nice datas', $datas['datas']);
|
||||
@@ -81,7 +81,7 @@ class randomTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testHelloToken()
|
||||
{
|
||||
$usr_id = self::$user->get_id();
|
||||
$usr_id = self::$DI['user']->get_id();
|
||||
$token = random::getUrlToken(self::$application, \random::TYPE_PASSWORD, $usr_id, null, 'some nice datas');
|
||||
$datas = random::helloToken(self::$application, $token);
|
||||
$this->assertEquals('some nice datas', $datas['datas']);
|
||||
@@ -102,7 +102,7 @@ class randomTest extends PhraseanetPHPUnitAbstract
|
||||
}
|
||||
|
||||
$expires_on = new DateTime('+5 minutes');
|
||||
$usr_id = self::$user->get_id();
|
||||
$usr_id = self::$DI['user']->get_id();
|
||||
$token = random::getUrlToken(self::$application, \random::TYPE_PASSWORD, $usr_id, $expires_on, 'some nice datas');
|
||||
$datas = random::helloToken(self::$application, $token);
|
||||
$this->assertEquals('some nice datas', $datas['datas']);
|
||||
@@ -125,7 +125,7 @@ class randomTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
|
||||
$expires_on = new DateTime('-5 minutes');
|
||||
$usr_id = self::$user->get_id();
|
||||
$usr_id = self::$DI['user']->get_id();
|
||||
$token = random::getUrlToken(self::$application, \random::TYPE_PASSWORD, $usr_id, $expires_on, 'some nice datas');
|
||||
|
||||
try {
|
||||
|
@@ -19,7 +19,7 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
/**
|
||||
* Reset thumbtitle in order to have consistent tests (testGet_title)
|
||||
*/
|
||||
foreach (static::$records['record_1']->get_databox()->get_meta_structure() as $databox_field) {
|
||||
foreach (self::$DI['record_1']->get_databox()->get_meta_structure() as $databox_field) {
|
||||
|
||||
/* @var $databox_field \databox_field */
|
||||
$databox_field->set_thumbtitle(false)->save();
|
||||
@@ -36,14 +36,14 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$basket = new \Entities\Basket();
|
||||
|
||||
$basket->setName('hello');
|
||||
$basket->setOwner(self::$user);
|
||||
$basket->setOwner(self::$DI['user']);
|
||||
$basket->setDescription('hello');
|
||||
|
||||
$em = self::$application['EM'];
|
||||
|
||||
$basketElement = new \Entities\BasketElement();
|
||||
|
||||
$basketElement->setRecord(static::$records['record_1']);
|
||||
$basketElement->setRecord(self::$DI['record_1']);
|
||||
$basketElement->setBasket($basket);
|
||||
|
||||
$em->persist($basketElement);
|
||||
@@ -53,20 +53,20 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$em->persist($basket);
|
||||
$em->flush();
|
||||
|
||||
$receveid = array(static::$records['record_1']->get_serialize_key() => static::$records['record_1']);
|
||||
$receveid = array(self::$DI['record_1']->get_serialize_key() => self::$DI['record_1']);
|
||||
|
||||
self::$application['phraseanet.user']->ACL()->update_rights_to_base(static::$records['record_1']->get_base_id(), array('order_master' => true));
|
||||
self::$application['phraseanet.user']->ACL()->update_rights_to_base(self::$DI['record_1']->get_base_id(), array('order_master' => true));
|
||||
|
||||
return \set_order::create(
|
||||
self::$application, new RecordsRequest($receveid, new ArrayCollection($receveid), $basket), self::$user_alt2, 'I need this photos', new \DateTime('+10 minutes')
|
||||
self::$application, new RecordsRequest($receveid, new ArrayCollection($receveid), $basket), self::$DI['user_alt2'], 'I need this photos', new \DateTime('+10 minutes')
|
||||
);
|
||||
}
|
||||
|
||||
public function testGet_creation_date()
|
||||
{
|
||||
$date_obj = new DateTime();
|
||||
$this->assertTrue((static::$records['record_1']->get_creation_date() instanceof DateTime));
|
||||
$this->assertTrue((static::$records['record_1']->get_creation_date() <= $date_obj));
|
||||
$this->assertTrue((self::$DI['record_1']->get_creation_date() instanceof DateTime));
|
||||
$this->assertTrue((self::$DI['record_1']->get_creation_date() <= $date_obj));
|
||||
}
|
||||
|
||||
protected function assertDateAtom($date)
|
||||
@@ -76,26 +76,26 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_uuid()
|
||||
{
|
||||
$this->assertTrue(uuid::is_valid(static::$records['record_1']->get_uuid()));
|
||||
$this->assertTrue(uuid::is_valid(self::$DI['record_1']->get_uuid()));
|
||||
}
|
||||
|
||||
public function testGet_modification_date()
|
||||
{
|
||||
$date_obj = new DateTime();
|
||||
$this->assertTrue((static::$records['record_1']->get_creation_date() instanceof DateTime));
|
||||
$this->assertTrue((static::$records['record_1']->get_creation_date() <= $date_obj));
|
||||
$this->assertTrue((self::$DI['record_1']->get_creation_date() instanceof DateTime));
|
||||
$this->assertTrue((self::$DI['record_1']->get_creation_date() <= $date_obj));
|
||||
}
|
||||
|
||||
public function testGet_number()
|
||||
{
|
||||
static::$records['record_1']->set_number(24);
|
||||
$this->assertEquals(24, static::$records['record_1']->get_number());
|
||||
static::$records['record_1']->set_number(42);
|
||||
$this->assertEquals(42, static::$records['record_1']->get_number());
|
||||
static::$records['record_1']->set_number(0);
|
||||
$this->assertEquals(0, static::$records['record_1']->get_number());
|
||||
static::$records['record_1']->set_number(null);
|
||||
$this->assertEquals(0, static::$records['record_1']->get_number());
|
||||
self::$DI['record_1']->set_number(24);
|
||||
$this->assertEquals(24, self::$DI['record_1']->get_number());
|
||||
self::$DI['record_1']->set_number(42);
|
||||
$this->assertEquals(42, self::$DI['record_1']->get_number());
|
||||
self::$DI['record_1']->set_number(0);
|
||||
$this->assertEquals(0, self::$DI['record_1']->get_number());
|
||||
self::$DI['record_1']->set_number(null);
|
||||
$this->assertEquals(0, self::$DI['record_1']->get_number());
|
||||
}
|
||||
|
||||
public function testSet_number()
|
||||
@@ -106,46 +106,46 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testSet_type()
|
||||
{
|
||||
try {
|
||||
static::$records['record_1']->set_type('jambon');
|
||||
self::$DI['record_1']->set_type('jambon');
|
||||
$this->fail();
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
$old_type = static::$records['record_1']->get_type();
|
||||
static::$records['record_1']->set_type('video');
|
||||
$this->assertEquals('video', static::$records['record_1']->get_type());
|
||||
static::$records['record_1']->set_type($old_type);
|
||||
$this->assertEquals($old_type, static::$records['record_1']->get_type());
|
||||
$old_type = self::$DI['record_1']->get_type();
|
||||
self::$DI['record_1']->set_type('video');
|
||||
$this->assertEquals('video', self::$DI['record_1']->get_type());
|
||||
self::$DI['record_1']->set_type($old_type);
|
||||
$this->assertEquals($old_type, self::$DI['record_1']->get_type());
|
||||
}
|
||||
|
||||
public function testIs_grouping()
|
||||
{
|
||||
$this->assertFalse(static::$records['record_1']->is_grouping());
|
||||
$this->assertTrue(static::$records['record_story_1']->is_grouping());
|
||||
$this->assertFalse(self::$DI['record_1']->is_grouping());
|
||||
$this->assertTrue(self::$DI['record_story_1']->is_grouping());
|
||||
}
|
||||
|
||||
public function testGet_base_id()
|
||||
{
|
||||
$this->assertTrue(is_int(static::$records['record_1']->get_base_id()));
|
||||
$this->assertEquals(self::$collection->get_base_id(), static::$records['record_1']->get_base_id());
|
||||
$this->assertTrue(is_int(static::$records['record_story_1']->get_base_id()));
|
||||
$this->assertEquals(self::$collection->get_base_id(), static::$records['record_story_1']->get_base_id());
|
||||
$this->assertTrue(is_int(self::$DI['record_1']->get_base_id()));
|
||||
$this->assertEquals(self::$collection->get_base_id(), self::$DI['record_1']->get_base_id());
|
||||
$this->assertTrue(is_int(self::$DI['record_story_1']->get_base_id()));
|
||||
$this->assertEquals(self::$collection->get_base_id(), self::$DI['record_story_1']->get_base_id());
|
||||
}
|
||||
|
||||
public function testGet_record_id()
|
||||
{
|
||||
$this->assertTrue(is_int(static::$records['record_1']->get_record_id()));
|
||||
$this->assertTrue(is_int(static::$records['record_story_1']->get_record_id()));
|
||||
$this->assertTrue(is_int(self::$DI['record_1']->get_record_id()));
|
||||
$this->assertTrue(is_int(self::$DI['record_story_1']->get_record_id()));
|
||||
}
|
||||
|
||||
public function testGet_thumbnail()
|
||||
{
|
||||
$this->assertTrue((static::$records['record_1']->get_thumbnail() instanceof media_subdef));
|
||||
$this->assertTrue((self::$DI['record_1']->get_thumbnail() instanceof media_subdef));
|
||||
}
|
||||
|
||||
public function testGet_embedable_medias()
|
||||
{
|
||||
$embeddables = static::$records['record_1']->get_embedable_medias();
|
||||
$embeddables = self::$DI['record_1']->get_embedable_medias();
|
||||
$this->assertTrue(is_array($embeddables));
|
||||
foreach ($embeddables as $subdef) {
|
||||
$this->assertInstanceOf('media_subdef', $subdef);
|
||||
@@ -162,58 +162,58 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_type()
|
||||
{
|
||||
$this->assertTrue(in_array(static::$records['record_1']->get_type(), array('video', 'audio', 'image', 'document', 'flash', 'unknown')));
|
||||
$this->assertTrue(in_array(self::$DI['record_1']->get_type(), array('video', 'audio', 'image', 'document', 'flash', 'unknown')));
|
||||
}
|
||||
|
||||
public function testGet_formated_duration()
|
||||
{
|
||||
$this->assertTrue(strpos(static::$records['record_23']->get_formated_duration(), '00:17') === 0);
|
||||
$this->assertEquals('', static::$records['record_1']->get_formated_duration());
|
||||
$this->assertTrue(strpos(self::$DI['record_23']->get_formated_duration(), '00:17') === 0);
|
||||
$this->assertEquals('', self::$DI['record_1']->get_formated_duration());
|
||||
}
|
||||
|
||||
public function testGet_duration()
|
||||
{
|
||||
$this->assertEquals(17, round(static::$records['record_23']->get_duration()));
|
||||
$this->assertEquals(false, static::$records['record_1']->get_duration());
|
||||
$this->assertEquals(17, round(self::$DI['record_23']->get_duration()));
|
||||
$this->assertEquals(false, self::$DI['record_1']->get_duration());
|
||||
}
|
||||
|
||||
public function testGet_rollover_thumbnail()
|
||||
{
|
||||
$this->assertInstanceOf('media_subdef', static::$records['record_23']->get_rollover_thumbnail());
|
||||
$this->assertNull(static::$records['record_1']->get_rollover_thumbnail());
|
||||
$this->assertInstanceOf('media_subdef', self::$DI['record_23']->get_rollover_thumbnail());
|
||||
$this->assertNull(self::$DI['record_1']->get_rollover_thumbnail());
|
||||
}
|
||||
|
||||
public function testGet_sha256()
|
||||
{
|
||||
$this->assertNotNull(static::$records['record_1']->get_sha256());
|
||||
$this->assertRegExp('/[a-zA-Z0-9]{64}/', static::$records['record_1']->get_sha256());
|
||||
$this->assertNull(static::$records['record_story_1']->get_sha256());
|
||||
$this->assertNotNull(self::$DI['record_1']->get_sha256());
|
||||
$this->assertRegExp('/[a-zA-Z0-9]{64}/', self::$DI['record_1']->get_sha256());
|
||||
$this->assertNull(self::$DI['record_story_1']->get_sha256());
|
||||
}
|
||||
|
||||
public function testGet_mime()
|
||||
{
|
||||
$this->assertRegExp('/image\/\w+/', static::$records['record_1']->get_mime());
|
||||
$this->assertRegExp('/image\/\w+/', self::$DI['record_1']->get_mime());
|
||||
}
|
||||
|
||||
public function testGet_status()
|
||||
{
|
||||
$this->assertRegExp('/[01]{64}/', static::$records['record_1']->get_status());
|
||||
$this->assertRegExp('/[01]{64}/', self::$DI['record_1']->get_status());
|
||||
}
|
||||
|
||||
public function testGet_subdef()
|
||||
{
|
||||
$this->assertInstanceOf('media_subdef', static::$records['record_1']->get_subdef('document'));
|
||||
$this->assertInstanceOf('media_subdef', static::$records['record_1']->get_subdef('preview'));
|
||||
$this->assertInstanceOf('media_subdef', static::$records['record_1']->get_subdef('thumbnail'));
|
||||
$this->assertInstanceOf('media_subdef', static::$records['record_23']->get_subdef('document'));
|
||||
$this->assertInstanceOf('media_subdef', static::$records['record_23']->get_subdef('preview'));
|
||||
$this->assertInstanceOf('media_subdef', static::$records['record_23']->get_subdef('thumbnail'));
|
||||
$this->assertInstanceOf('media_subdef', static::$records['record_23']->get_subdef('thumbnailGIF'));
|
||||
$this->assertInstanceOf('media_subdef', self::$DI['record_1']->get_subdef('document'));
|
||||
$this->assertInstanceOf('media_subdef', self::$DI['record_1']->get_subdef('preview'));
|
||||
$this->assertInstanceOf('media_subdef', self::$DI['record_1']->get_subdef('thumbnail'));
|
||||
$this->assertInstanceOf('media_subdef', self::$DI['record_23']->get_subdef('document'));
|
||||
$this->assertInstanceOf('media_subdef', self::$DI['record_23']->get_subdef('preview'));
|
||||
$this->assertInstanceOf('media_subdef', self::$DI['record_23']->get_subdef('thumbnail'));
|
||||
$this->assertInstanceOf('media_subdef', self::$DI['record_23']->get_subdef('thumbnailGIF'));
|
||||
}
|
||||
|
||||
public function testGet_subdefs()
|
||||
{
|
||||
$subdefs = static::$records['record_1']->get_subdefs();
|
||||
$subdefs = self::$DI['record_1']->get_subdefs();
|
||||
$this->assertTrue(is_array($subdefs));
|
||||
foreach ($subdefs as $subdef) {
|
||||
$this->assertInstanceOf('media_subdef', $subdef);
|
||||
@@ -233,43 +233,43 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_technical_infos()
|
||||
{
|
||||
$this->assertTrue(is_array(static::$records['record_1']->get_technical_infos()));
|
||||
$this->assertTrue(is_array(self::$DI['record_1']->get_technical_infos()));
|
||||
}
|
||||
|
||||
public function testGet_caption()
|
||||
{
|
||||
$this->assertTrue((static::$records['record_1']->get_caption() instanceof caption_record));
|
||||
$this->assertTrue((self::$DI['record_1']->get_caption() instanceof caption_record));
|
||||
}
|
||||
|
||||
public function testGet_original_name()
|
||||
{
|
||||
$this->assertEquals('test001.CR2', static::$records['record_1']->get_original_name());
|
||||
$this->assertEquals('test001.CR2', self::$DI['record_1']->get_original_name());
|
||||
}
|
||||
|
||||
public function testGet_title()
|
||||
{
|
||||
$this->assertEquals('test001.CR2', static::$records['record_1']->get_title());
|
||||
$this->assertEquals('test023.mp4', static::$records['record_23']->get_title());
|
||||
$this->assertEquals('test001.CR2', self::$DI['record_1']->get_title());
|
||||
$this->assertEquals('test023.mp4', self::$DI['record_23']->get_title());
|
||||
}
|
||||
|
||||
public function testGet_preview()
|
||||
{
|
||||
$this->assertTrue((static::$records['record_1']->get_preview() instanceof media_subdef));
|
||||
$this->assertTrue((self::$DI['record_1']->get_preview() instanceof media_subdef));
|
||||
}
|
||||
|
||||
public function testHas_preview()
|
||||
{
|
||||
$this->assertTrue(static::$records['record_1']->has_preview());
|
||||
$this->assertTrue(self::$DI['record_1']->has_preview());
|
||||
}
|
||||
|
||||
public function testGet_serialize_key()
|
||||
{
|
||||
$this->assertTrue(static::$records['record_1']->get_serialize_key() == static::$records['record_1']->get_sbas_id() . '_' . static::$records['record_1']->get_record_id());
|
||||
$this->assertTrue(self::$DI['record_1']->get_serialize_key() == self::$DI['record_1']->get_sbas_id() . '_' . self::$DI['record_1']->get_record_id());
|
||||
}
|
||||
|
||||
public function testGet_sbas_id()
|
||||
{
|
||||
$this->assertTrue(is_int(static::$records['record_1']->get_sbas_id()));
|
||||
$this->assertTrue(is_int(self::$DI['record_1']->get_sbas_id()));
|
||||
}
|
||||
|
||||
public function testSubstitute_subdef()
|
||||
@@ -285,7 +285,7 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
$meta_structure_el = self::$collection->get_databox()->get_meta_structure()->get_elements();
|
||||
|
||||
$current_caption = static::$records['record_1']->get_caption();
|
||||
$current_caption = self::$DI['record_1']->get_caption();
|
||||
|
||||
$metadatas = array();
|
||||
|
||||
@@ -350,9 +350,9 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
}
|
||||
}
|
||||
|
||||
static::$records['record_1']->set_metadatas($metadatas, true);
|
||||
self::$DI['record_1']->set_metadatas($metadatas, true);
|
||||
|
||||
$caption = static::$records['record_1']->get_caption();
|
||||
$caption = self::$DI['record_1']->get_caption();
|
||||
|
||||
|
||||
|
||||
@@ -388,56 +388,56 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testReindex()
|
||||
{
|
||||
static::$records['record_1']->reindex();
|
||||
self::$DI['record_1']->reindex();
|
||||
$sql = 'SELECT record_id FROM record
|
||||
WHERE (status & 7) IN (4,5,6) AND record_id = :record_id';
|
||||
$stmt = static::$records['record_1']->get_databox()->get_connection()->prepare($sql);
|
||||
$stmt = self::$DI['record_1']->get_databox()->get_connection()->prepare($sql);
|
||||
|
||||
$stmt->execute(array(':record_id' => static::$records['record_1']->get_record_id()));
|
||||
$stmt->execute(array(':record_id' => self::$DI['record_1']->get_record_id()));
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ( ! $row)
|
||||
$this->fail();
|
||||
if ($row['record_id'] != static::$records['record_1']->get_record_id())
|
||||
if ($row['record_id'] != self::$DI['record_1']->get_record_id())
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testRebuild_subdefs()
|
||||
{
|
||||
|
||||
static::$records['record_1']->rebuild_subdefs();
|
||||
self::$DI['record_1']->rebuild_subdefs();
|
||||
$sql = 'SELECT record_id
|
||||
FROM record
|
||||
WHERE jeton & ' . JETON_MAKE_SUBDEF . ' > 0
|
||||
AND record_id = :record_id';
|
||||
$stmt = static::$records['record_1']->get_databox()->get_connection()->prepare($sql);
|
||||
$stmt = self::$DI['record_1']->get_databox()->get_connection()->prepare($sql);
|
||||
|
||||
$stmt->execute(array(':record_id' => static::$records['record_1']->get_record_id()));
|
||||
$stmt->execute(array(':record_id' => self::$DI['record_1']->get_record_id()));
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ( ! $row)
|
||||
$this->fail();
|
||||
if ($row['record_id'] != static::$records['record_1']->get_record_id())
|
||||
if ($row['record_id'] != self::$DI['record_1']->get_record_id())
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testWrite_metas()
|
||||
{
|
||||
static::$records['record_1']->write_metas();
|
||||
self::$DI['record_1']->write_metas();
|
||||
$sql = 'SELECT record_id, coll_id, jeton
|
||||
FROM record WHERE (jeton & ' . JETON_WRITE_META . ' > 0)
|
||||
AND record_id = :record_id';
|
||||
$stmt = static::$records['record_1']->get_databox()->get_connection()->prepare($sql);
|
||||
$stmt = self::$DI['record_1']->get_databox()->get_connection()->prepare($sql);
|
||||
|
||||
$stmt->execute(array(':record_id' => static::$records['record_1']->get_record_id()));
|
||||
$stmt->execute(array(':record_id' => self::$DI['record_1']->get_record_id()));
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ( ! $row)
|
||||
$this->fail();
|
||||
if ($row['record_id'] != static::$records['record_1']->get_record_id())
|
||||
if ($row['record_id'] != self::$DI['record_1']->get_record_id())
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
@@ -454,28 +454,28 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_record_by_sha()
|
||||
{
|
||||
$tmp_records = record_adapter::get_record_by_sha(self::$application, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_sha256());
|
||||
$tmp_records = record_adapter::get_record_by_sha(self::$application, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_sha256());
|
||||
$this->assertTrue(is_array($tmp_records));
|
||||
|
||||
foreach ($tmp_records as $tmp_record) {
|
||||
$this->assertInstanceOf('record_adapter', $tmp_record);
|
||||
$this->assertEquals(static::$records['record_1']->get_sha256(), $tmp_record->get_sha256());
|
||||
$this->assertEquals(self::$DI['record_1']->get_sha256(), $tmp_record->get_sha256());
|
||||
}
|
||||
|
||||
$tmp_records = record_adapter::get_record_by_sha(self::$application, static::$records['record_1']->get_sbas_id(), static::$records['record_1']->get_sha256(), static::$records['record_1']->get_record_id());
|
||||
$tmp_records = record_adapter::get_record_by_sha(self::$application, self::$DI['record_1']->get_sbas_id(), self::$DI['record_1']->get_sha256(), self::$DI['record_1']->get_record_id());
|
||||
$this->assertTrue(is_array($tmp_records));
|
||||
$this->assertTrue(count($tmp_records) === 1);
|
||||
|
||||
foreach ($tmp_records as $tmp_record) {
|
||||
$this->assertInstanceOf('record_adapter', $tmp_record);
|
||||
$this->assertEquals(static::$records['record_1']->get_sha256(), $tmp_record->get_sha256());
|
||||
$this->assertEquals(static::$records['record_1']->get_record_id(), $tmp_record->get_record_id());
|
||||
$this->assertEquals(self::$DI['record_1']->get_sha256(), $tmp_record->get_sha256());
|
||||
$this->assertEquals(self::$DI['record_1']->get_record_id(), $tmp_record->get_record_id());
|
||||
}
|
||||
}
|
||||
|
||||
public function testGet_hd_file()
|
||||
{
|
||||
$this->assertInstanceOf('\SplFileInfo', static::$records['record_1']->get_hd_file());
|
||||
$this->assertInstanceOf('\SplFileInfo', self::$DI['record_1']->get_hd_file());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -496,7 +496,7 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
/* @var $basket \Entities\Basket */
|
||||
$basket_element = new \Entities\BasketElement();
|
||||
$basket_element->setRecord(static::$records['record_1']);
|
||||
$basket_element->setRecord(self::$DI['record_1']);
|
||||
$basket_element->setBasket($basket);
|
||||
|
||||
self::$application['EM']->persist($basket_element);
|
||||
@@ -508,10 +508,10 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
$found = $sselcont_id = false;
|
||||
|
||||
$sbas_id = static::$records['record_1']->get_sbas_id();
|
||||
$record_id = static::$records['record_1']->get_record_id();
|
||||
$sbas_id = self::$DI['record_1']->get_sbas_id();
|
||||
$record_id = self::$DI['record_1']->get_record_id();
|
||||
|
||||
foreach (static::$records['record_1']->get_container_baskets(self::$application['EM'], self::$application['phraseanet.user']) as $c_basket) {
|
||||
foreach (self::$DI['record_1']->get_container_baskets(self::$application['EM'], self::$application['phraseanet.user']) as $c_basket) {
|
||||
if ($c_basket->getId() == $basket->getId()) {
|
||||
$found = true;
|
||||
foreach ($c_basket->getElements() as $b_el) {
|
||||
|
@@ -55,7 +55,7 @@ class activityTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$sbasid,
|
||||
$colllist
|
||||
);
|
||||
$report->setUser_id(self::$user->get_id());
|
||||
$report->setUser_id(self::$DI['user']->get_id());
|
||||
$this->activerPerHours($report);
|
||||
$this->ConnexionBase($report);
|
||||
$this->activiteAddedDocument($report, $sbasid, $colllist);
|
||||
@@ -90,7 +90,7 @@ class activityTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function allQuestion($report)
|
||||
{
|
||||
$allQuestion = $report->getAllQuestionByUser(self::$user->get_id(), 'usrid');
|
||||
$allQuestion = $report->getAllQuestionByUser(self::$DI['user']->get_id(), 'usrid');
|
||||
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $allQuestion);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class activityTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function allDownloadByUserBase($report)
|
||||
{
|
||||
$allDownload = $report->getAllDownloadByUserBase(self::$user->get_id());
|
||||
$allDownload = $report->getAllDownloadByUserBase(self::$DI['user']->get_id());
|
||||
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $allDownload);
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,7 @@ class dashboardTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->dashboard = new module_report_dashboard(self::$application, self::$user);
|
||||
$this->dashboard = new module_report_dashboard(self::$application, self::$DI['user']);
|
||||
$this->dashboard->setDate('-2 month', 'now');
|
||||
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $this->dashboard->legendDay);
|
||||
$this->assertNotNull($this->dashboard->dmin);
|
||||
|
@@ -48,7 +48,7 @@ class reportTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
foreach ($this->ret as $sbasid => $collections) {
|
||||
$this->report = new module_report(self::$application, $this->dmin, $this->dmax, $sbasid, $collections);
|
||||
$this->report->setUser_id(self::$user->get_id());
|
||||
$this->report->setUser_id(self::$DI['user']->get_id());
|
||||
$this->assertEquals($collections, $this->report->getListCollId());
|
||||
$this->host($this->report);
|
||||
}
|
||||
|
@@ -47,7 +47,7 @@ class sqlFilterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
}
|
||||
|
||||
$this->report->setFilter(array(array('f' => 'user', 'o' => '=', 'v' => 'admin'), array('f' => 'ddate', 'o' => 'LIKE', 'v' => '*'), array('f' => '1', 'o' => 'OR', 'v' => '1')));
|
||||
$this->report->setUser_id(self::$user->get_id());
|
||||
$this->report->setUser_id(self::$DI['user']->get_id());
|
||||
$this->report->setOrder('user', 'ASC');
|
||||
$this->filter = new module_report_sqlfilter(self::$application, $this->report);
|
||||
}
|
||||
|
@@ -107,15 +107,15 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testSet_bases()
|
||||
{
|
||||
$bases = array_keys(self::$user->ACL()->get_granted_base());
|
||||
$this->object->set_bases($bases, self::$user->ACL());
|
||||
$bases = array_keys(self::$DI['user']->ACL()->get_granted_base());
|
||||
$this->object->set_bases($bases, self::$DI['user']->ACL());
|
||||
$this->assertEquals(array_values($bases), array_values($this->object->get_bases()));
|
||||
}
|
||||
|
||||
public function testGet_bases()
|
||||
{
|
||||
$bases = array_keys(self::$user->ACL()->get_granted_base());
|
||||
$this->object->set_bases($bases, self::$user->ACL());
|
||||
$bases = array_keys(self::$DI['user']->ACL()->get_granted_base());
|
||||
$this->object->set_bases($bases, self::$DI['user']->ACL());
|
||||
$this->assertEquals(array_values($bases), array_values($this->object->get_bases()));
|
||||
}
|
||||
|
||||
@@ -217,8 +217,8 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testSerialize()
|
||||
{
|
||||
$bases = array_keys(self::$user->ACL()->get_granted_base());
|
||||
$this->object->set_bases($bases, self::$user->ACL());
|
||||
$bases = array_keys(self::$DI['user']->ACL()->get_granted_base());
|
||||
$this->object->set_bases($bases, self::$DI['user']->ACL());
|
||||
$this->object->set_date_fields(array());
|
||||
$this->object->set_locale('fr_FR');
|
||||
$this->object->set_max_date(null);
|
||||
|
@@ -13,19 +13,19 @@ class userTest extends PhraseanetPHPUnitAbstract
|
||||
try {
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
self::$user->set_email(null);
|
||||
self::$DI['user']->set_email(null);
|
||||
|
||||
$this->assertFalse(User_Adapter::get_usr_id_from_email(self::$application, null));
|
||||
self::$user->set_email('');
|
||||
self::$DI['user']->set_email('');
|
||||
$this->assertFalse(User_Adapter::get_usr_id_from_email(self::$application, null));
|
||||
self::$user->set_email('noone@example.com');
|
||||
$this->assertEquals(self::$user->get_id(), User_Adapter::get_usr_id_from_email(self::$application, 'noone@example.com'));
|
||||
self::$DI['user']->set_email('noone@example.com');
|
||||
$this->assertEquals(self::$DI['user']->get_id(), User_Adapter::get_usr_id_from_email(self::$application, 'noone@example.com'));
|
||||
} catch (Exception $e) {
|
||||
$this->fail($e->getMessage());
|
||||
}
|
||||
try {
|
||||
|
||||
self::$user->set_email('noonealt1@example.com');
|
||||
self::$DI['user']->set_email('noonealt1@example.com');
|
||||
$this->fail('A user already got this address');
|
||||
} catch (Exception $e) {
|
||||
|
||||
|
Reference in New Issue
Block a user