mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Fix tests on PHP 5.4
This commit is contained in:
@@ -18,7 +18,8 @@ class ApplicationLightboxTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
parent::setUp();
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
$this->feed = Feed_Adapter::create(self::$DI['app'], self::$DI['user'], "salut", 'coucou');
|
||||
$publisher = array_shift($this->feed->get_publishers());
|
||||
$publishers = $this->feed->get_publishers();
|
||||
$publisher = array_shift($publishers);
|
||||
$this->entry = Feed_Entry_Adapter::create(self::$DI['app'], $this->feed, $publisher, 'title', "sub Titkle", " jean pierre", "jp@test.com");
|
||||
$this->item = Feed_Entry_Item::create($appbox, $this->entry, self::$DI['record_1']);
|
||||
}
|
||||
|
@@ -69,7 +69,8 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function createOneCollection()
|
||||
{
|
||||
$collection = \collection::create(self::$DI['app'], array_shift(self::$DI['app']['phraseanet.appbox']->get_databoxes()), self::$DI['app']['phraseanet.appbox'], 'TESTTODELETE');
|
||||
$databoxes = self::$DI['app']['phraseanet.appbox']->get_databoxes();
|
||||
$collection = \collection::create(self::$DI['app'], array_shift($databoxes), self::$DI['app']['phraseanet.appbox'], 'TESTTODELETE');
|
||||
|
||||
self::$createdCollections[] = $collection;
|
||||
|
||||
|
@@ -63,7 +63,8 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function createOneCollection()
|
||||
{
|
||||
$collection = \collection::create(self::$DI['app'], array_shift(self::$DI['app']['phraseanet.appbox']->get_databoxes()), self::$DI['app']['phraseanet.appbox'], 'TESTTODELETE');
|
||||
$databoxes = self::$DI['app']['phraseanet.appbox']->get_databoxes();
|
||||
$collection = \collection::create(self::$DI['app'], array_shift($databoxes), self::$DI['app']['phraseanet.appbox'], 'TESTTODELETE');
|
||||
|
||||
self::$DI['app']['phraseanet.user']->ACL();
|
||||
|
||||
|
@@ -15,7 +15,8 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testRouteDescription()
|
||||
{
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
$databox = array_shift($appbox->get_databoxes());
|
||||
$databoxes = $appbox->get_databoxes();
|
||||
$databox = array_shift($databoxes);
|
||||
$name = "testtest" . uniqid();
|
||||
$field = \databox_field::create(self::$DI['app'], $databox, $name, false);
|
||||
$id = $field->get_id();
|
||||
@@ -38,7 +39,8 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testPostDelete()
|
||||
{
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
$databox = array_shift($appbox->get_databoxes());
|
||||
$databoxes = $appbox->get_databoxes();
|
||||
$databox = array_shift($databoxes);
|
||||
$name = "test" . uniqid();
|
||||
$field = \databox_field::create(self::$DI['app'], $databox, $name, false);
|
||||
$id = $field->get_id();
|
||||
@@ -61,7 +63,8 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testPostCreate()
|
||||
{
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
$databox = array_shift($appbox->get_databoxes());
|
||||
$databoxes = $appbox->get_databoxes();
|
||||
$databox = array_shift($databoxes);
|
||||
|
||||
$name = 'test' . uniqid();
|
||||
|
||||
@@ -89,7 +92,8 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testPostDescriptionException()
|
||||
{
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
$databox = array_shift($appbox->get_databoxes());
|
||||
$databoxes = $appbox->get_databoxes();
|
||||
$databox = array_shift($databoxes);
|
||||
|
||||
self::$DI['client']->request("POST", "/admin/description/" . $databox->get_sbas_id() . "/", array(
|
||||
'todelete_ids' => array('unknow_id')
|
||||
@@ -181,7 +185,8 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
$this->setAdmin(false);
|
||||
|
||||
$databox = array_shift(self::$DI['app']['phraseanet.appbox']->get_databoxes());
|
||||
$databoxes = self::$DI['app']['phraseanet.appbox']->get_databoxes();
|
||||
$databox = array_shift($databoxes);
|
||||
$name = "test" . uniqid();
|
||||
$field = \databox_field::create(self::$DI['app'], $databox, $name, false);
|
||||
$id = $field->get_id();
|
||||
@@ -212,7 +217,8 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->setAdmin(false);
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
|
||||
$databox = array_shift($appbox->get_databoxes());
|
||||
$databoxes = $appbox->get_databoxes();
|
||||
$databox = array_shift($databoxes);
|
||||
|
||||
try {
|
||||
self::$DI['client']->request("GET", "/admin/description/" . $databox->get_sbas_id() . "/");
|
||||
@@ -225,7 +231,8 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testGetDescription()
|
||||
{
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
$databox = array_shift($appbox->get_databoxes());
|
||||
$databoxes = $appbox->get_databoxes();
|
||||
$databox = array_shift($databoxes);
|
||||
|
||||
self::$DI['client']->request("GET", "/admin/description/" . $databox->get_sbas_id() . "/");
|
||||
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
|
||||
@@ -234,7 +241,8 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testGetMetadatas()
|
||||
{
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
$databox = array_shift($appbox->get_databoxes());
|
||||
$databoxes = $appbox->get_databoxes();
|
||||
$databox = array_shift($databoxes);
|
||||
|
||||
self::$DI['client']->request("GET", "/admin/description/metadatas/search/", array('term' => ''));
|
||||
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
|
||||
|
@@ -12,7 +12,8 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testCheckMulti()
|
||||
{
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
$databox = array_shift($appbox->get_databoxes());
|
||||
$databoxes = $appbox->get_databoxes();
|
||||
$databox = array_shift($databoxes);
|
||||
|
||||
$tag = new PHPExiftool\Driver\Tag\IPTC\ObjectName();
|
||||
|
||||
@@ -34,7 +35,8 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function testCheckReadOnly()
|
||||
{
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
$databox = array_shift($appbox->get_databoxes());
|
||||
$databoxes = $appbox->get_databoxes();
|
||||
$databox = array_shift($databoxes);
|
||||
|
||||
$tag = new PHPExiftool\Driver\Tag\IPTC\ObjectName();
|
||||
|
||||
|
@@ -47,7 +47,8 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
$count_after = sizeof($feeds->get_feeds());
|
||||
$this->assertGreaterThan($count, $count_after);
|
||||
|
||||
$feed = array_pop($feeds->get_feeds());
|
||||
$all_feeds = $feeds->get_feeds();
|
||||
$feed = array_pop($all_feeds);
|
||||
|
||||
$feed->delete();
|
||||
}
|
||||
|
@@ -11,7 +11,8 @@ class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->databox = array_shift(self::$DI['app']['phraseanet.appbox']->get_databoxes());
|
||||
$databoxes = self::$DI['app']['phraseanet.appbox']->get_databoxes();
|
||||
$this->databox = array_shift($databoxes);
|
||||
}
|
||||
|
||||
public function getSubdefName()
|
||||
|
@@ -49,7 +49,8 @@ class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract {
|
||||
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
|
||||
|
||||
$location = self::$DI['client']->getResponse()->headers->get('location');
|
||||
$tid = array_pop(explode('/', $location));
|
||||
$data = explode('/', $location);
|
||||
$tid = array_pop($data);
|
||||
|
||||
self::$DI['client']->request(
|
||||
'GET', '/admin/task-manager/task/' . $tid . '/log', array()
|
||||
|
@@ -96,7 +96,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteQuota()
|
||||
{
|
||||
$base_id = array_pop(array_keys(self::$DI['user']->ACL()->get_granted_base()));
|
||||
$keys = array_keys(self::$DI['user']->ACL()->get_granted_base());
|
||||
$base_id = array_pop($keys);
|
||||
$params = array('base_id' => $base_id, 'users' => self::$DI['user']->get_id());
|
||||
|
||||
self::$DI['client']->request('POST', '/admin/users/rights/quotas/', $params);
|
||||
@@ -116,7 +117,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteQuotaRemove()
|
||||
{
|
||||
$base_id = array_pop(array_keys(self::$DI['user']->ACL()->get_granted_base()));
|
||||
$keys = array_keys(self::$DI['user']->ACL()->get_granted_base());
|
||||
$base_id = array_pop($keys);
|
||||
$params = array('base_id' => $base_id, 'users' => self::$DI['user']->get_id());
|
||||
|
||||
self::$DI['client']->request('POST', '/admin/users/rights/quotas/apply/', $params);
|
||||
@@ -126,7 +128,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteRightTime()
|
||||
{
|
||||
$base_id = array_pop(array_keys(self::$DI['user']->ACL()->get_granted_base()));
|
||||
$keys = array_keys(self::$DI['user']->ACL()->get_granted_base());
|
||||
$base_id = array_pop($keys);
|
||||
$params = array('base_id' => $base_id, 'users' => self::$DI['user']->get_id());
|
||||
|
||||
self::$DI['client']->request('POST', '/admin/users/rights/time/', $params);
|
||||
@@ -154,7 +157,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteRightMask()
|
||||
{
|
||||
$base_id = array_pop(array_keys(self::$DI['user']->ACL()->get_granted_base()));
|
||||
$keys = array_keys(self::$DI['user']->ACL()->get_granted_base());
|
||||
$base_id = array_pop($keys);
|
||||
$params = array('base_id' => $base_id, 'users' => self::$DI['user']->get_id());
|
||||
|
||||
self::$DI['client']->request('POST', '/admin/users/rights/masks/', $params);
|
||||
|
@@ -55,8 +55,9 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$query = self::$DI['app']['EM']->createQuery('SELECT b FROM \Entities\Basket b');
|
||||
|
||||
$result = $query->getResult();
|
||||
|
||||
$basket = array_shift($query->getResult());
|
||||
$basket = array_shift($result);
|
||||
/* @var $basket \Entities\Basket */
|
||||
$this->assertEquals(2, $basket->getElements()->count());
|
||||
}
|
||||
|
@@ -343,7 +343,8 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
/**
|
||||
* @todo change this
|
||||
*/
|
||||
if ( ! \login::register_enabled(self::$DI['app'])) {
|
||||
$login = new \login();
|
||||
if ( ! $login->register_enabled(self::$DI['app'])) {
|
||||
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
|
||||
} else {
|
||||
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
|
||||
|
@@ -127,7 +127,8 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
self::$feed_4_public = Feed_Adapter::create($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());
|
||||
$publishers = self::$feed_4_public->get_publishers();
|
||||
$publisher = array_shift($publishers);
|
||||
|
||||
for ($i = 1; $i != 15; $i++) {
|
||||
$entry = Feed_Entry_Adapter::create($application, self::$feed_4_public, $publisher, 'titre entry', 'soustitre entry', 'Jean-Marie Biggaro', 'author@example.com');
|
||||
@@ -280,7 +281,8 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
public function testGetFeedFormat()
|
||||
{
|
||||
$feeds = Feed_Collection::load_public_feeds(self::$DI['app']);
|
||||
$feed = array_shift($feeds->get_feeds());
|
||||
$all_feeds = $feeds->get_feeds();
|
||||
$feed = array_shift($all_feeds);
|
||||
|
||||
$crawler = self::$DI['client']->request("GET", "/feeds/feed/" . $feed->get_id() . "/rss/");
|
||||
$this->assertEquals("application/rss+xml", self::$DI['client']->getResponse()->headers->get("content-type"));
|
||||
|
@@ -49,7 +49,8 @@ class BorderManagerTest extends \PhraseanetPHPUnitAbstract
|
||||
*/
|
||||
public function testGetMandatoryOptions()
|
||||
{
|
||||
$this->assertInternalType('array', BorderManager::getMandatoryOptions());
|
||||
$manager = new BorderManager(self::$DI['app'], array('enabled' => true, 'checkers' => array()));
|
||||
$this->assertInternalType('array', $manager->getMandatoryOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -24,7 +24,8 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
$this->assertTrue(is_scalar($type));
|
||||
|
||||
$classname = array_pop(explode('\\', get_class($this->object)));
|
||||
$data = explode('\\', get_class($this->object));
|
||||
$classname = array_pop($data);
|
||||
|
||||
$this->assertEquals($classname, $type . 'Provider');
|
||||
}
|
||||
|
@@ -40,11 +40,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
*/
|
||||
protected static $time_start;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var \Alchemy\Phrasea\Application
|
||||
*/
|
||||
protected static $application;
|
||||
public $app;
|
||||
protected $start;
|
||||
/**
|
||||
|
Reference in New Issue
Block a user