mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Update unit tests
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../../PhraseanetWebTestCaseAbstract.class.inc';
|
||||
require_once __DIR__ . '/../Bridge_datas.inc';
|
||||
|
||||
@@ -18,22 +20,22 @@ class Bridge_Api_AbstractTest extends PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
parent::setUp();
|
||||
$this->auth = $this->getMock("Bridge_Api_Auth_Interface");
|
||||
$this->bridgeApi = $this->getMock('Bridge_Api_Abstract', array("is_configured", "initialize_transport", "set_auth_params", "set_transport_authentication_params"), array(registry::get_instance(), $this->auth, "Mock_Bridge_Api_Abstract"));
|
||||
$this->bridgeApi = $this->getMock('Bridge_Api_Abstract', array("is_configured", "initialize_transport", "set_auth_params", "set_transport_authentication_params"), array(self::$application['phraseanet.registry'], $this->auth, "Mock_Bridge_Api_Abstract"));
|
||||
}
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
try {
|
||||
self::$api = Bridge_Api::get_by_api_name(appbox::get_instance(\bootstrap::getCore()), 'apitest');
|
||||
self::$api = Bridge_Api::get_by_api_name(self::$application, 'apitest');
|
||||
} catch (Bridge_Exception_ApiNotFound $e) {
|
||||
self::$api = Bridge_Api::create(appbox::get_instance(\bootstrap::getCore()), 'apitest');
|
||||
self::$api = Bridge_Api::create(self::$application, 'apitest');
|
||||
}
|
||||
|
||||
try {
|
||||
self::$account = Bridge_Account::load_account_from_distant_id(appbox::get_instance(\bootstrap::getCore()), self::$api, self::$user, 'kirikoo');
|
||||
self::$account = Bridge_Account::load_account_from_distant_id(self::$application, self::$api, self::$user, 'kirikoo');
|
||||
} catch (Bridge_Exception_AccountNotFound $e) {
|
||||
self::$account = Bridge_Account::create(appbox::get_instance(\bootstrap::getCore()), self::$api, self::$user, 'kirikoo', 'coucou');
|
||||
self::$account = Bridge_Account::create(self::$application, self::$api, self::$user, 'kirikoo', 'coucou');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
require_once __DIR__ . '/Bridge_datas.inc';
|
||||
|
||||
@@ -18,16 +20,16 @@ class Bridge_AccountSettingsTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$sql = 'DELETE FROM bridge_apis WHERE name = "Apitest"';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
$this->api = Bridge_Api::create($appbox, 'Apitest');
|
||||
$this->api = Bridge_Api::create(self::$application, 'Apitest');
|
||||
$this->dist_id = 'EZ1565loPP';
|
||||
$this->named = 'Fête à pinpins';
|
||||
$this->account = Bridge_Account::create($appbox, $this->api, self::$user, $this->dist_id, $this->named);
|
||||
$this->account = Bridge_Account::create(self::$application, $this->api, self::$user, $this->dist_id, $this->named);
|
||||
|
||||
$this->object = new Bridge_AccountSettings($appbox, $this->account);
|
||||
} catch (Exception $e) {
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
require_once __DIR__ . '/Bridge_datas.inc';
|
||||
|
||||
@@ -18,20 +20,20 @@ class Bridge_AccountTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$sql = 'DELETE FROM bridge_apis WHERE name = "Apitest"';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
|
||||
$this->api = Bridge_Api::create($appbox, 'Apitest');
|
||||
$this->api = Bridge_Api::create(self::$application, 'Apitest');
|
||||
$this->dist_id = 'EZ1565loPP';
|
||||
$this->named = 'Fête à pinpins';
|
||||
$account = Bridge_Account::create($appbox, $this->api, self::$user, $this->dist_id, $this->named);
|
||||
$account = Bridge_Account::create(self::$application, $this->api, self::$user, $this->dist_id, $this->named);
|
||||
$this->id = $account->get_id();
|
||||
|
||||
$this->object = new Bridge_Account($appbox, $this->api, $this->id);
|
||||
$this->object = new Bridge_Account(self::$application, $this->api, $this->id);
|
||||
} catch (Exception $e) {
|
||||
$this->fail($e->getMessage());
|
||||
}
|
||||
@@ -39,11 +41,11 @@ class Bridge_AccountTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$this->object->delete();
|
||||
|
||||
try {
|
||||
new Bridge_Account($appbox, $this->api, $this->id);
|
||||
new Bridge_Account(self::$application, $this->api, $this->id);
|
||||
$this->fail();
|
||||
} catch (Bridge_Exception_AccountNotFound $e) {
|
||||
|
||||
@@ -114,7 +116,7 @@ class Bridge_AccountTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_accounts_by_api()
|
||||
{
|
||||
$accounts = Bridge_Account::get_accounts_by_api(appbox::get_instance(\bootstrap::getCore()), $this->api);
|
||||
$accounts = Bridge_Account::get_accounts_by_api(self::$application, $this->api);
|
||||
$this->assertTrue(is_array($accounts));
|
||||
|
||||
$this->assertGreaterThan(0, count($accounts));
|
||||
@@ -131,7 +133,7 @@ class Bridge_AccountTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_accounts_by_user()
|
||||
{
|
||||
$accounts = Bridge_Account::get_accounts_by_user(appbox::get_instance(\bootstrap::getCore()), self::$user);
|
||||
$accounts = Bridge_Account::get_accounts_by_user(self::$application, self::$user);
|
||||
|
||||
$this->assertTrue(is_array($accounts));
|
||||
$this->assertTrue(count($accounts) > 0);
|
||||
@@ -143,7 +145,7 @@ class Bridge_AccountTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testLoad_account()
|
||||
{
|
||||
$account = Bridge_Account::load_account(appbox::get_instance(\bootstrap::getCore()), $this->object->get_id());
|
||||
$account = Bridge_Account::load_account(self::$application, $this->object->get_id());
|
||||
$this->assertEquals($this->object->get_id(), $account->get_id());
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
require_once __DIR__ . '/Bridge_datas.inc';
|
||||
|
||||
@@ -15,7 +17,7 @@ class Bridge_ApiTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$sql = 'DELETE FROM bridge_apis WHERE name = "Apitest"';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
@@ -23,20 +25,20 @@ class Bridge_ApiTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$stmt->closeCursor();
|
||||
|
||||
$this->type = 'Apitest';
|
||||
$api = Bridge_Api::create($appbox, $this->type);
|
||||
$api = Bridge_Api::create(self::$application, $this->type);
|
||||
|
||||
$this->id = $api->get_id();
|
||||
$this->object = new Bridge_Api($appbox, $api->get_id());
|
||||
$this->object = new Bridge_Api(self::$application, $api->get_id());
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$this->object->delete();
|
||||
|
||||
try {
|
||||
new Bridge_Api($appbox, $this->id);
|
||||
new Bridge_Api(self::$application, $this->id);
|
||||
$this->fail();
|
||||
} catch (Bridge_Exception_ApiNotFound $e) {
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
require_once __DIR__ . '/Bridge_datas.inc';
|
||||
|
||||
@@ -20,34 +22,34 @@ class Bridge_ElementTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
|
||||
$sql = 'DELETE FROM bridge_apis WHERE name = "Apitest"';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
|
||||
$this->api = Bridge_Api::create($appbox, 'Apitest');
|
||||
$this->api = Bridge_Api::create(self::$application, 'Apitest');
|
||||
$this->dist_id = 'EZ1565loPP';
|
||||
$this->named = 'Fête à pinpins';
|
||||
$this->account = Bridge_Account::create($appbox, $this->api, self::$user, $this->dist_id, $this->named);
|
||||
$this->account = Bridge_Account::create(self::$application, $this->api, self::$user, $this->dist_id, $this->named);
|
||||
|
||||
$this->title = 'GOGACKO';
|
||||
$this->status = 'Processing';
|
||||
|
||||
$element = Bridge_Element::create($appbox, $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, static::$records['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($appbox, $this->account, $this->id);
|
||||
$this->object = new Bridge_Element(self::$application, $this->account, $this->id);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$this->object->delete();
|
||||
|
||||
try {
|
||||
new Bridge_Element($appbox, $this->account, $this->id);
|
||||
new Bridge_Element(self::$application, $this->account, $this->id);
|
||||
$this->fail();
|
||||
} catch (Bridge_Exception_ElementNotFound $e) {
|
||||
|
||||
@@ -143,7 +145,7 @@ class Bridge_ElementTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_elements_by_account()
|
||||
{
|
||||
$elements = Bridge_Element::get_elements_by_account(appbox::get_instance(\bootstrap::getCore()), $this->account);
|
||||
$elements = Bridge_Element::get_elements_by_account(self::$application, $this->account);
|
||||
$this->assertTrue(is_array($elements));
|
||||
$this->assertGreaterThan(0, count($elements));
|
||||
|
||||
|
@@ -19,7 +19,7 @@ class EntityBasketTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->em = self::$core->getEntityManager();
|
||||
$this->em = self::$application['EM'];
|
||||
$this->basket = $this->insertOneBasket();
|
||||
}
|
||||
|
||||
@@ -111,18 +111,18 @@ class EntityBasketTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGetPusher()
|
||||
{
|
||||
$this->assertNull($this->basket->getPusher()); //no pusher
|
||||
$this->assertNull($this->basket->getPusher(self::$application)); //no pusher
|
||||
$this->basket->setPusherId(self::$user->get_id());
|
||||
$this->assertInstanceOf('\User_Adapter', $this->basket->getPusher());
|
||||
$this->assertEquals($this->basket->getPusher()->get_id(), self::$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());
|
||||
}
|
||||
|
||||
public function testGetOwner()
|
||||
{
|
||||
$this->assertNotNull($this->basket->getOwner()); //no owner
|
||||
$this->assertNotNull($this->basket->getOwner(self::$application)); //no owner
|
||||
$this->basket->setUsrId(self::$user->get_id());
|
||||
$this->assertInstanceOf('\User_Adapter', $this->basket->getOwner());
|
||||
$this->assertEquals($this->basket->getOwner()->get_id(), self::$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());
|
||||
}
|
||||
|
||||
public function testGetValidation()
|
||||
|
@@ -11,7 +11,7 @@ class ValidationParticipantRepositoryTest extends PhraseanetPHPUnitAuthenticated
|
||||
'expires' => new \DateTime('+1 days')
|
||||
));
|
||||
|
||||
$em = self::$core->getEntityManager();
|
||||
$em = self::$application['EM'];
|
||||
$repo = $em->getRepository('\Entities\ValidationParticipant');
|
||||
/* @var $repo \Repositories\ValidationParticipantRepository */
|
||||
$expireDate = new \DateTime('+2 days');
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
|
||||
class Feed_Entry_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
@@ -25,13 +27,13 @@ class Feed_Entry_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$appbox->get_session()->authenticate($auth);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
self::$feed = Feed_Adapter::create($appbox, self::$user, self::$feed_title, self::$feed_subtitle);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher($appbox, self::$feed, self::$user);
|
||||
self::$object = Feed_Entry_Adapter::create($appbox, self::$feed, $publisher, self::$title, self::$subtitle, self::$author_name, self::$author_email);
|
||||
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::$object = Feed_Entry_Adapter::create(self::$application, self::$feed, $publisher, self::$title, self::$subtitle, self::$author_name, self::$author_email);
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
@@ -100,11 +102,11 @@ class Feed_Entry_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testSetFeed()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$new_feed = Feed_Adapter::create($appbox, self::$user, self::$feed_title, self::$feed_subtitle);
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$new_feed = Feed_Adapter::create(self::$application, self::$user, self::$feed_title, self::$feed_subtitle);
|
||||
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher($appbox, $new_feed, self::$user);
|
||||
$entry = Feed_Entry_Adapter::create($appbox, self::$feed, $publisher, self::$title, self::$subtitle, self::$author_name, self::$author_email);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher(self::$application['phraseanet.appbox'], $new_feed, self::$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());
|
||||
$entry->set_feed($new_feed);
|
||||
@@ -156,7 +158,7 @@ class Feed_Entry_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testLoad_from_id()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$test_entry = Feed_Entry_Adapter::load_from_id($appbox, self::$object->get_id());
|
||||
|
||||
$this->assertInstanceOf('Feed_Entry_Adapter', $test_entry);
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
|
||||
class Feed_Entry_CollectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
@@ -36,13 +38,13 @@ class Feed_Entry_CollectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$appbox->get_session()->authenticate($auth);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
self::$feed = Feed_Adapter::create($appbox, self::$user, self::$feed_title, self::$feed_subtitle);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher($appbox, self::$feed, self::$user);
|
||||
self::$entry = Feed_Entry_Adapter::create($appbox, self::$feed, $publisher, self::$title, self::$subtitle, self::$author_name, self::$author_email);
|
||||
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::$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']);
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
|
||||
class Feed_Entry_ItemTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
@@ -31,13 +33,13 @@ class Feed_Entry_ItemTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$appbox->get_session()->authenticate($auth);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
self::$feed = Feed_Adapter::create($appbox, self::$user, self::$feed_title, self::$feed_subtitle);
|
||||
$publisher = Feed_Publisher_Adapter::getPublisher($appbox, self::$feed, self::$user);
|
||||
self::$entry = Feed_Entry_Adapter::create($appbox, self::$feed, $publisher, self::$title, self::$subtitle, self::$author_name, self::$author_email);
|
||||
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::$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']);
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
|
||||
class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
@@ -15,10 +17,10 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$appbox->get_session()->authenticate($auth);
|
||||
self::$object = Feed_Adapter::create($appbox, self::$user, self::$title, self::$subtitle);
|
||||
self::$application->openAccount($auth);
|
||||
self::$object = Feed_Adapter::create(self::$application, self::$user, self::$title, self::$subtitle);
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
@@ -71,7 +73,7 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->assertTrue(self::$object->is_public());
|
||||
|
||||
$coll = null;
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$coll = $collection;
|
||||
@@ -117,7 +119,7 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
|
||||
$coll = null;
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$coll = $collection;
|
||||
@@ -189,8 +191,7 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testLoad_with_user()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$this->assertEquals(Feed_Adapter::load_with_user($appbox, self::$user, self::$object->get_id())->get_id(), self::$object->get_id());
|
||||
$this->assertEquals(Feed_Adapter::load_with_user(self::$application, self::$user, self::$object->get_id())->get_id(), self::$object->get_id());
|
||||
}
|
||||
|
||||
public function testGet_count_total_entries()
|
||||
@@ -210,7 +211,7 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testGet_homepage_link()
|
||||
{
|
||||
self::$object->set_public(false);
|
||||
$registry = registry::get_instance();
|
||||
$registry = self::$application['phraseanet.registry'];
|
||||
$link = self::$object->get_homepage_link($registry, Feed_Adapter::FORMAT_ATOM);
|
||||
$this->assertNull($link);
|
||||
|
||||
@@ -221,7 +222,7 @@ class Feed_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_user_link()
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$registry = self::$application['phraseanet.registry'];
|
||||
|
||||
$link = self::$object->get_user_link($registry, self::$user, Feed_Adapter::FORMAT_ATOM);
|
||||
$supposed = '/feeds\/userfeed\/([a-zA-Z0-9]{12})\/' . self::$object->get_id() . '\/atom\//';
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
|
||||
class Feed_AggregateTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
@@ -15,14 +17,14 @@ class Feed_AggregateTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$appbox->get_session()->authenticate($auth);
|
||||
$objects[] = Feed_Adapter::create($appbox, self::$user, self::$title, self::$subtitle);
|
||||
$objects[] = Feed_Adapter::create($appbox, self::$user, self::$title, self::$subtitle);
|
||||
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);
|
||||
|
||||
self::$feeds = $objects;
|
||||
self::$object = new Feed_Aggregate($appbox, self::$feeds);
|
||||
self::$object = new Feed_Aggregate(self::$application, self::$feeds);
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
@@ -57,7 +59,7 @@ class Feed_AggregateTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_homepage_link()
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$registry = self::$application['phraseanet.registry'];
|
||||
$link = self::$object->get_homepage_link($registry, Feed_Adapter::FORMAT_ATOM);
|
||||
$this->assertInstanceOf('Feed_Link', $link);
|
||||
$this->assertEquals($registry->get('GV_ServerName') . 'feeds/aggregated/atom/', $link->get_href());
|
||||
@@ -65,7 +67,7 @@ class Feed_AggregateTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_user_link()
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$registry = self::$application['phraseanet.registry'];
|
||||
|
||||
$link = self::$object->get_user_link($registry, self::$user, Feed_Adapter::FORMAT_ATOM);
|
||||
$supposed = '/feeds\/userfeed\/aggregated\/([a-zA-Z0-9]{12})\/atom\//';
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
|
||||
class Feed_CollectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
@@ -15,10 +17,10 @@ class Feed_CollectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$appbox->get_session()->authenticate($auth);
|
||||
self::$object = Feed_Adapter::create($appbox, self::$user, self::$title, self::$subtitle);
|
||||
self::$application->openAccount($auth);
|
||||
self::$object = Feed_Adapter::create(self::$application, self::$user, self::$title, self::$subtitle);
|
||||
self::$object->set_public(true);
|
||||
}
|
||||
|
||||
@@ -30,8 +32,8 @@ class Feed_CollectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testLoad_all()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$coll = Feed_Collection::load_all($appbox, self::$user);
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$coll = Feed_Collection::load_all(self::$application, self::$user);
|
||||
|
||||
foreach ($coll->get_feeds() as $feed) {
|
||||
$this->assertInstanceOf('Feed_Adapter', $feed);
|
||||
@@ -40,8 +42,8 @@ class Feed_CollectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_feeds()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$coll = Feed_Collection::load_public_feeds($appbox);
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$coll = Feed_Collection::load_public_feeds(self::$application);
|
||||
|
||||
foreach ($coll->get_feeds() as $feed) {
|
||||
$this->assertInstanceOf('Feed_Adapter', $feed);
|
||||
@@ -50,16 +52,16 @@ class Feed_CollectionTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGet_aggregate()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$coll = Feed_Collection::load_public_feeds($appbox);
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$coll = Feed_Collection::load_public_feeds(self::$application);
|
||||
|
||||
$this->assertInstanceOf('Feed_Aggregate', $coll->get_aggregate());
|
||||
}
|
||||
|
||||
public function testLoad_public_feeds()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$coll = Feed_Collection::load_public_feeds($appbox);
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$coll = Feed_Collection::load_public_feeds(self::$application);
|
||||
|
||||
foreach ($coll->get_feeds() as $feed) {
|
||||
$this->assertTrue($feed->is_public());
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../../PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
|
||||
class Feed_Publisher_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
@@ -19,10 +21,10 @@ class Feed_Publisher_AdapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$auth = new Session_Authentication_None(self::$user);
|
||||
$appbox->get_session()->authenticate($auth);
|
||||
self::$feed = Feed_Adapter::create($appbox, self::$user, self::$title, self::$subtitle);
|
||||
self::$application->openAccount($auth);
|
||||
self::$feed = Feed_Adapter::create(self::$application, self::$user, self::$title, self::$subtitle);
|
||||
self::$object = array_pop(self::$feed->get_publishers());
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../../PhraseanetPHPUnitAbstract.class.inc';
|
||||
|
||||
class Session_Authentication_GuestTest extends PhraseanetPHPUnitAbstract
|
||||
@@ -12,7 +14,7 @@ class Session_Authentication_GuestTest extends PhraseanetPHPUnitAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->object = new Session_Authentication_Guest(appbox::get_instance(\bootstrap::getCore()));
|
||||
$this->object = new Session_Authentication_Guest(self::$application);
|
||||
}
|
||||
|
||||
public function testSignOn()
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../../PhraseanetPHPUnitAbstract.class.inc';
|
||||
|
||||
class Session_Authentication_NativeTest extends PhraseanetPHPUnitAbstract
|
||||
@@ -15,13 +17,13 @@ class Session_Authentication_NativeTest extends PhraseanetPHPUnitAbstract
|
||||
parent::setUp();
|
||||
$login = 'testlogin';
|
||||
$password = 'testpassword';
|
||||
$usr_id = User_Adapter::get_usr_id_from_login($login);
|
||||
$usr_id = User_Adapter::get_usr_id_from_login(self::$application, $login);
|
||||
if ($usr_id) {
|
||||
$this->local_user = User_Adapter::getInstance($usr_id, appbox::get_instance(\bootstrap::getCore()));
|
||||
$this->local_user = User_Adapter::getInstance($usr_id, self::$application);
|
||||
} else {
|
||||
$this->local_user = User_Adapter::create(appbox::get_instance(\bootstrap::getCore()), $login, $password, null, false);
|
||||
$this->local_user = User_Adapter::create(self::$application, $login, $password, null, false);
|
||||
}
|
||||
$this->object = new Session_Authentication_Native(appbox::get_instance(\bootstrap::getCore()), $login, $password);
|
||||
$this->object = new Session_Authentication_Native(self::$application, $login, $password);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
|
@@ -1,347 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../PhraseanetPHPUnitAbstract.class.inc';
|
||||
|
||||
class Session_HandlerTest extends PhraseanetPHPUnitAbstract
|
||||
{
|
||||
/**
|
||||
* @var Session_Handler
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->object = Session_Handler::getInstance(appbox::get_instance(\bootstrap::getCore()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
if ($this->object->is_authenticated()) {
|
||||
$this->object->logout();
|
||||
}
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testGetInstance()
|
||||
{
|
||||
$this->assertInstanceOf('Session_Handler', $this->object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testLogout().
|
||||
*/
|
||||
public function testLogout()
|
||||
{
|
||||
$user = self::$user;
|
||||
$auth = new Session_Authentication_None($user);
|
||||
$databoxes = $user->ACL()->get_granted_sbas();
|
||||
|
||||
$this->assertFalse($this->object->is_authenticated());
|
||||
$this->object->authenticate($auth);
|
||||
$this->assertTrue($this->object->is_authenticated());
|
||||
$this->assertTrue(is_int($this->object->get_ses_id()));
|
||||
|
||||
$ses_id = $this->object->get_ses_id();
|
||||
|
||||
$conn = connection::getPDOConnection();
|
||||
$sql = 'SELECT session_id FROM cache WHERE session_id = :ses_id';
|
||||
$params = array(':ses_id' => $ses_id);
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
$this->assertEquals(1, $stmt->rowCount());
|
||||
|
||||
$loggers = array();
|
||||
|
||||
foreach ($databoxes as $databox) {
|
||||
$logger = $this->object->get_logger($databox);
|
||||
$this->assertInstanceOf('Session_Logger', $logger);
|
||||
$loggers[$databox->get_sbas_id()] = $logger;
|
||||
}
|
||||
|
||||
$this->object->logout();
|
||||
$this->assertFalse($this->object->is_authenticated());
|
||||
|
||||
$stmt->execute($params);
|
||||
$this->assertEquals(0, $stmt->rowCount());
|
||||
$stmt->closeCursor();
|
||||
|
||||
|
||||
foreach ($databoxes as $databox) {
|
||||
|
||||
$logger = $this->object->get_logger($databox);
|
||||
$this->assertInstanceOf('Session_Logger', $logger);
|
||||
$this->assertNotEquals($loggers[$databox->get_sbas_id()]->get_id(), $logger->get_id());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testStorage().
|
||||
*/
|
||||
public function testStorage()
|
||||
{
|
||||
$this->assertInstanceOf('Session_Storage_Interface', $this->object->storage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testClose_storage().
|
||||
*/
|
||||
public function testClose_storage()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testGet_locale().
|
||||
*/
|
||||
public function testGet_locale()
|
||||
{
|
||||
$this->assertRegExp('/[a-z]{2}_[A-Z]{2}/', Session_Handler::get_locale());
|
||||
}
|
||||
|
||||
public function testSet_locale()
|
||||
{
|
||||
Session_Handler::set_locale('fr_FR');
|
||||
$this->assertEquals('fr_FR', Session_Handler::get_locale());
|
||||
Session_Handler::set_locale('en_GB');
|
||||
$this->assertEquals('en_GB', Session_Handler::get_locale());
|
||||
}
|
||||
|
||||
public function testGet_l10n()
|
||||
{
|
||||
Session_Handler::set_locale('fr_FR');
|
||||
$this->assertEquals('FR', $this->object->get_l10n());
|
||||
Session_Handler::set_locale('en_GB');
|
||||
$this->assertEquals('GB', $this->object->get_l10n());
|
||||
}
|
||||
|
||||
public function testGet_I18n()
|
||||
{
|
||||
Session_Handler::set_locale('fr_FR');
|
||||
$this->assertEquals('fr', $this->object->get_I18n());
|
||||
Session_Handler::set_locale('en_GB');
|
||||
$this->assertEquals('en', $this->object->get_I18n());
|
||||
}
|
||||
|
||||
public function testIs_authenticated()
|
||||
{
|
||||
$user = self::$user;
|
||||
$auth = new Session_Authentication_None($user);
|
||||
$this->assertFalse($this->object->is_authenticated());
|
||||
$this->object->authenticate($auth);
|
||||
$this->assertTrue($this->object->is_authenticated());
|
||||
$this->object->logout();
|
||||
$this->assertFalse($this->object->is_authenticated());
|
||||
}
|
||||
|
||||
public function testGet_usr_id()
|
||||
{
|
||||
$this->assertNull($this->object->get_usr_id());
|
||||
|
||||
$user = self::$user;
|
||||
$auth = new Session_Authentication_None($user);
|
||||
$this->object->authenticate($auth);
|
||||
|
||||
$this->assertTrue(is_int($this->object->get_usr_id()));
|
||||
$this->assertEquals($user->get_id(), $this->object->get_usr_id());
|
||||
|
||||
$this->object->logout();
|
||||
$this->assertNull($this->object->get_usr_id());
|
||||
}
|
||||
|
||||
public function testGet_ses_id()
|
||||
{
|
||||
$this->assertNull($this->object->get_ses_id());
|
||||
|
||||
$user = self::$user;
|
||||
$auth = new Session_Authentication_None($user);
|
||||
$this->object->authenticate($auth);
|
||||
|
||||
$this->assertTrue(is_int($this->object->get_ses_id()));
|
||||
|
||||
$this->object->logout();
|
||||
$this->assertNull($this->object->get_ses_id());
|
||||
}
|
||||
|
||||
public function testSet_session_prefs()
|
||||
{
|
||||
$datas = array('bla' => 1, 2 => 'boum');
|
||||
$this->object->set_session_prefs('test', $datas);
|
||||
$this->assertEquals($datas, $this->object->get_session_prefs('test'));
|
||||
}
|
||||
|
||||
public function testGet_session_prefs()
|
||||
{
|
||||
$this->testSet_session_prefs();
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testGet_cookie().
|
||||
*/
|
||||
public function testGet_cookie()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testSet_cookie().
|
||||
*/
|
||||
public function testSet_cookie()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testIsset_cookie().
|
||||
*/
|
||||
public function testIsset_cookie()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
public function testOpen_phrasea_session()
|
||||
{
|
||||
try {
|
||||
$this->object->open_phrasea_session();
|
||||
$this->fail();
|
||||
} catch (Exception_Session_Closed $e) {
|
||||
|
||||
}
|
||||
|
||||
$user = self::$user;
|
||||
$auth = new Session_Authentication_None($user);
|
||||
$this->object->authenticate($auth);
|
||||
|
||||
$this->object->open_phrasea_session();
|
||||
|
||||
$this->object->logout();
|
||||
|
||||
try {
|
||||
$this->object->open_phrasea_session();
|
||||
$this->fail();
|
||||
} catch (Exception_Session_Closed $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function testRestore()
|
||||
{
|
||||
$user = self::$user;
|
||||
$auth = new Session_Authentication_None($user);
|
||||
$this->object->authenticate($auth);
|
||||
|
||||
$ses_id = $this->object->get_ses_id();
|
||||
$this->object->storage()->reset();
|
||||
|
||||
$this->assertFalse($this->object->is_authenticated());
|
||||
|
||||
$this->object->restore($user, $ses_id);
|
||||
|
||||
$this->assertTrue($this->object->is_authenticated());
|
||||
|
||||
$databoxes = $user->ACL()->get_granted_sbas();
|
||||
foreach ($databoxes as $databox) {
|
||||
$this->assertInstanceOf('Session_Logger', $this->object->get_logger($databox));
|
||||
}
|
||||
}
|
||||
|
||||
public function testAuthenticate()
|
||||
{
|
||||
$user = self::$user;
|
||||
$auth = new Session_Authentication_None($user);
|
||||
$this->object->authenticate($auth);
|
||||
|
||||
$registry = registry::get_instance();
|
||||
|
||||
|
||||
foreach ($user->ACL()->get_granted_sbas() as $databox) {
|
||||
$sql = 'SELECT usr_id FROM collusr WHERE site = :site AND usr_id = :usr_id AND coll_id = :coll_id';
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
|
||||
foreach ($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $collection) {
|
||||
$stmt->execute(array(':site' => $registry->get('GV_sit'), ':usr_id' => $user->get_id(), ':coll_id' => $collection->get_coll_id()));
|
||||
$this->assertEquals(1, $stmt->rowCount());
|
||||
}
|
||||
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
|
||||
$this->object->logout();
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testAdd_persistent_cookie().
|
||||
*/
|
||||
public function testAdd_persistent_cookie()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
public function testGet_logger()
|
||||
{
|
||||
$user = self::$user;
|
||||
$auth = new Session_Authentication_None($user);
|
||||
$databoxes = $user->ACL()->get_granted_sbas();
|
||||
|
||||
$this->object->authenticate($auth);
|
||||
$this->assertTrue($this->object->is_authenticated());
|
||||
|
||||
foreach ($databoxes as $databox) {
|
||||
$this->assertInstanceOf('Session_Logger', $this->object->get_logger($databox));
|
||||
}
|
||||
$this->assertTrue(is_int($this->object->get_logger($databox)->get_id()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testGet_my_sessions().
|
||||
*/
|
||||
public function testGet_my_sessions()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testSet_event_module().
|
||||
*/
|
||||
public function testSet_event_module()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testGet_active_sessions().
|
||||
*/
|
||||
public function testGet_active_sessions()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
require_once __DIR__ . '/../PhraseanetPHPUnitAbstract.class.inc';
|
||||
|
||||
class Session_LoggerTest extends PhraseanetPHPUnitAbstract
|
||||
@@ -9,12 +11,6 @@ class Session_LoggerTest extends PhraseanetPHPUnitAbstract
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Session_Handler
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var databox
|
||||
@@ -23,17 +19,14 @@ class Session_LoggerTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
protected function feed_datas()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$this->session = $appbox->get_session();
|
||||
$appbox = self::$application['phraseanet.appbox'];
|
||||
$user = self::$user;
|
||||
$auth = new Session_Authentication_None($user);
|
||||
|
||||
|
||||
|
||||
$this->session->authenticate($auth);
|
||||
self::$application->openAccount($auth);
|
||||
|
||||
foreach ($user->ACL()->get_granted_sbas() as $databox) {
|
||||
$this->object = $this->session->get_logger($databox);
|
||||
$this->object = self::$application['phraseanet.logger']($databox);
|
||||
$this->databox = $databox;
|
||||
break;
|
||||
}
|
||||
@@ -47,13 +40,13 @@ class Session_LoggerTest extends PhraseanetPHPUnitAbstract
|
||||
$log_id = $this->object->get_id();
|
||||
$this->assertTrue(is_int($log_id));
|
||||
|
||||
$registry = registry::get_instance();
|
||||
$registry = self::$application['phraseanet.registry'];
|
||||
|
||||
$sql = 'SELECT id FROM log
|
||||
WHERE sit_session = :ses_id AND usrid = :usr_id AND site = :site';
|
||||
$params = array(
|
||||
':ses_id' => $this->session->get_ses_id()
|
||||
, ':usr_id' => $this->session->get_usr_id()
|
||||
':ses_id' => self::$application['session']->get('phrasea_session_id')
|
||||
, ':usr_id' => self::$application['phraseanet.user']->get_id()
|
||||
, ':site' => $registry->get('GV_sit')
|
||||
);
|
||||
|
||||
@@ -63,10 +56,10 @@ class Session_LoggerTest extends PhraseanetPHPUnitAbstract
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$this->assertEquals($this->object->get_id(), $row['id']);
|
||||
$log_id = $this->object->get_id();
|
||||
$ses_id = $this->session->get_ses_id();
|
||||
$usr_id = $this->session->get_usr_id();
|
||||
$ses_id = self::$application['session']->get('phrasea_session_id');
|
||||
$usr_id = self::$application['phraseanet.user']->get_id();
|
||||
|
||||
$this->session->logout();
|
||||
self::$application->closeAccount();
|
||||
|
||||
$sql = 'SELECT id FROM log
|
||||
WHERE sit_session = :ses_id AND usrid = :usr_id AND site = :site';
|
||||
|
Reference in New Issue
Block a user