mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Coding standards
This commit is contained in:
@@ -27,6 +27,7 @@ $finder
|
|||||||
->files()
|
->files()
|
||||||
->name('*.md')
|
->name('*.md')
|
||||||
->name('*.php')
|
->name('*.php')
|
||||||
|
->name('*.inc')
|
||||||
->name('*.php.dist')
|
->name('*.php.dist')
|
||||||
->name('*.twig')
|
->name('*.twig')
|
||||||
->name('*.xml')
|
->name('*.xml')
|
||||||
|
@@ -21,7 +21,7 @@ require_once __DIR__ . "/../../vendor/Phlickr/Api.php";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package
|
* @package
|
||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
@@ -34,17 +34,17 @@ class Bridge_Api_Apitest_Containers implements Bridge_Api_ContainerInterface
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_created_on()
|
public function get_created_on()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_description()
|
public function get_description()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_id()
|
public function get_id()
|
||||||
@@ -54,12 +54,12 @@ class Bridge_Api_Apitest_Containers implements Bridge_Api_ContainerInterface
|
|||||||
|
|
||||||
public function get_thumbnail($width = 120, $height = 90)
|
public function get_thumbnail($width = 120, $height = 90)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_title()
|
public function get_title()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_type()
|
public function get_type()
|
||||||
@@ -69,27 +69,27 @@ class Bridge_Api_Apitest_Containers implements Bridge_Api_ContainerInterface
|
|||||||
|
|
||||||
public function get_updated_on()
|
public function get_updated_on()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_url()
|
public function get_url()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_category()
|
public function get_category()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_private()
|
public function is_private()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_rating()
|
public function get_rating()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -102,27 +102,27 @@ class Bridge_Api_Apitest_Element implements Bridge_Api_ElementInterface
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_category()
|
public function get_category()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_created_on()
|
public function get_created_on()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_description()
|
public function get_description()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_duration()
|
public function get_duration()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_id()
|
public function get_id()
|
||||||
@@ -132,17 +132,17 @@ class Bridge_Api_Apitest_Element implements Bridge_Api_ElementInterface
|
|||||||
|
|
||||||
public function get_rating()
|
public function get_rating()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_thumbnail()
|
public function get_thumbnail()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_title()
|
public function get_title()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_type()
|
public function get_type()
|
||||||
@@ -152,22 +152,22 @@ class Bridge_Api_Apitest_Element implements Bridge_Api_ElementInterface
|
|||||||
|
|
||||||
public function get_updated_on()
|
public function get_updated_on()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_url()
|
public function get_url()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_view_count()
|
public function get_view_count()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_private()
|
public function is_private()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -187,17 +187,17 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
|
|
||||||
protected function initialize_transport()
|
protected function initialize_transport()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function set_auth_params()
|
protected function set_auth_params()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function set_transport_authentication_params()
|
protected function set_transport_authentication_params()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_terms_url()
|
public function get_terms_url()
|
||||||
@@ -206,7 +206,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function connect()
|
public function connect()
|
||||||
@@ -216,7 +216,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Bridge_Api_Interface
|
* @return Bridge_Api_Interface
|
||||||
*/
|
*/
|
||||||
public function reconnect()
|
public function reconnect()
|
||||||
{
|
{
|
||||||
@@ -225,7 +225,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Bridge_Api_Interface
|
* @return Bridge_Api_Interface
|
||||||
*/
|
*/
|
||||||
public function disconnect()
|
public function disconnect()
|
||||||
{
|
{
|
||||||
@@ -234,7 +234,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function is_connected()
|
public function is_connected()
|
||||||
{
|
{
|
||||||
@@ -242,16 +242,16 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Bridge_Api_Interface
|
* @return Bridge_Api_Interface
|
||||||
*/
|
*/
|
||||||
public function set_locale($locale)
|
public function set_locale($locale)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_name()
|
public function get_name()
|
||||||
@@ -260,39 +260,39 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_icon_url()
|
public function get_icon_url()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_image_url()
|
public function get_image_url()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_url()
|
public function get_url()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_infos()
|
public function get_infos()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_object_class_from_type($type)
|
public function get_object_class_from_type($type)
|
||||||
@@ -320,12 +320,12 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
|
|
||||||
public function get_element_types()
|
public function get_element_types()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_container_types()
|
public function get_container_types()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_element_from_id($element_id, $object)
|
public function get_element_from_id($element_id, $object)
|
||||||
@@ -333,6 +333,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
$element = new Bridge_Api_Apitest_Element();
|
$element = new Bridge_Api_Apitest_Element();
|
||||||
$element->id = $element_id;
|
$element->id = $element_id;
|
||||||
$element->type = $object;
|
$element->type = $object;
|
||||||
|
|
||||||
return $element;
|
return $element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,12 +342,13 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
$container = new Bridge_Api_Apitest_Containers();
|
$container = new Bridge_Api_Apitest_Containers();
|
||||||
$container->id = $element_id;
|
$container->id = $element_id;
|
||||||
$container->type = $object;
|
$container->type = $object;
|
||||||
|
|
||||||
return $container;
|
return $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_category_list()
|
public function get_category_list()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_user_name()
|
public function get_user_name()
|
||||||
@@ -368,6 +370,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
$element_collection->add_element(new Bridge_Api_Apitest_Element());
|
$element_collection->add_element(new Bridge_Api_Apitest_Element());
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $element_collection;
|
return $element_collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,12 +383,13 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
$container_collection->add_element(new Bridge_Api_Apitest_Containers());
|
$container_collection->add_element(new Bridge_Api_Apitest_Containers());
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $container_collection;
|
return $container_collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update_element($object, $object_id, Array $datas)
|
public function update_element($object, $object_id, Array $datas)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create_container($container_type, \Symfony\Component\HttpFoundation\Request $request)
|
public function create_container($container_type, \Symfony\Component\HttpFoundation\Request $request)
|
||||||
@@ -416,7 +420,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return Closure
|
* @return Closure
|
||||||
*/
|
*/
|
||||||
public function acceptable_records()
|
public function acceptable_records()
|
||||||
@@ -425,32 +429,33 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
return $func;
|
return $func;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_element_status(Bridge_Element $element)
|
public function get_element_status(Bridge_Element $element)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map_connector_to_element_status($status)
|
public function map_connector_to_element_status($status)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_error_message_from_status($connector_status)
|
public function get_error_message_from_status($connector_status)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upload(record_adapter &$record, array $options = array())
|
public function upload(record_adapter &$record, array $options = array())
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_valid_object_id($object_id)
|
public function is_valid_object_id($object_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_configured()
|
public function is_configured()
|
||||||
@@ -463,8 +468,10 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
if (self::$hasError)
|
if (self::$hasError)
|
||||||
{
|
{
|
||||||
self::$hasError = false;
|
self::$hasError = false;
|
||||||
|
|
||||||
return array('title' => 'too long');
|
return array('title' => 'too long');
|
||||||
}
|
}
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,7 +482,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
|
|
||||||
public function is_multiple_upload()
|
public function is_multiple_upload()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function check_update_constraints(Array $datas)
|
public function check_update_constraints(Array $datas)
|
||||||
@@ -493,6 +500,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
elseif (self::$hasError)
|
elseif (self::$hasError)
|
||||||
{
|
{
|
||||||
self::$hasError = false;
|
self::$hasError = false;
|
||||||
|
|
||||||
return array('title' => 'too long');
|
return array('title' => 'too long');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -509,12 +517,12 @@ class Bridge_Api_Auth_None extends Bridge_Api_Auth_Abstract implements Bridge_Ap
|
|||||||
|
|
||||||
public function connect($param)
|
public function connect($param)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parse_request_token()
|
public function parse_request_token()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reconnect()
|
public function reconnect()
|
||||||
@@ -539,12 +547,12 @@ class Bridge_Api_Auth_None extends Bridge_Api_Auth_Abstract implements Bridge_Ap
|
|||||||
|
|
||||||
public function get_auth_signatures()
|
public function get_auth_signatures()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set_parameters(Array $parameters)
|
public function set_parameters(Array $parameters)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$validator = new W3CFeedRawValidator($xml);
|
$validator = new W3CFeedRawValidator($xml);
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
{
|
{
|
||||||
print "\n" . $e->getMessage();
|
print "\n" . $e->getMessage();
|
||||||
}
|
}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
class W3CFeedValidatorException extends Exception
|
class W3CFeedValidatorException extends Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +55,7 @@ class W3CFeedUrlValidator extends W3CFeedValidator
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The URL of the document to validate
|
* The URL of the document to validate
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $url;
|
private $url;
|
||||||
|
|
||||||
@@ -88,12 +88,13 @@ class W3CFeedUrlValidator extends W3CFeedValidator
|
|||||||
{
|
{
|
||||||
throw new W3CFeedValidatorException("Unable to request W3C API");
|
throw new W3CFeedValidatorException("Unable to request W3C API");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new W3CFeedValidatorResponse($response);
|
return new W3CFeedValidatorResponse($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if an url is valid
|
* Check if an url is valid
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function isValidUrl($url)
|
private function isValidUrl($url)
|
||||||
@@ -112,14 +113,14 @@ class W3CFeedRawValidator extends W3CFeedValidator
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The source of the document to validate
|
* The source of the document to validate
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $rawData;
|
private $rawData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* Init instance which the specified data to validate
|
* Init instance which the specified data to validate
|
||||||
* @param string $rawData
|
* @param string $rawData
|
||||||
*/
|
*/
|
||||||
public function __construct($rawData)
|
public function __construct($rawData)
|
||||||
{
|
{
|
||||||
@@ -151,6 +152,7 @@ class W3CFeedRawValidator extends W3CFeedValidator
|
|||||||
{
|
{
|
||||||
throw new W3CFeedValidatorException("Unable to request W3C API");
|
throw new W3CFeedValidatorException("Unable to request W3C API");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new W3CFeedValidatorResponse($response);
|
return new W3CFeedValidatorResponse($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,36 +211,40 @@ class W3CFeedValidatorResponse
|
|||||||
$string .= $name . "=>" . $detail . "\n";
|
$string .= $name . "=>" . $detail . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the XML is valid
|
* Check if the XML is valid
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isValid()
|
public function isValid()
|
||||||
{
|
{
|
||||||
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:validity";
|
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:validity";
|
||||||
|
|
||||||
return $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== "false";
|
return $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for errors
|
* Check for errors
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function hasError()
|
public function hasError()
|
||||||
{
|
{
|
||||||
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:errors/m:errorcount";
|
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:errors/m:errorcount";
|
||||||
|
|
||||||
return (int) $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== 0;
|
return (int) $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check fro warnings
|
* check fro warnings
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function hasWarning()
|
public function hasWarning()
|
||||||
{
|
{
|
||||||
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:warnings/m:warningcount";
|
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:warnings/m:warningcount";
|
||||||
|
|
||||||
return (int) $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== 0;
|
return (int) $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,8 +277,8 @@ class W3CFeedValidatorResponse
|
|||||||
* 1 => etc ..
|
* 1 => etc ..
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getWarnings()
|
public function getWarnings()
|
||||||
{
|
{
|
||||||
@@ -286,12 +292,13 @@ class W3CFeedValidatorResponse
|
|||||||
$warnings[] = $this->domNodeToArray($warning);
|
$warnings[] = $this->domNodeToArray($warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $warnings;
|
return $warnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array with all errors as follow
|
* Get an array with all errors as follow
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getErrors()
|
public function getErrors()
|
||||||
{
|
{
|
||||||
@@ -305,14 +312,15 @@ class W3CFeedValidatorResponse
|
|||||||
$errors[] = $this->domNodeToArray($error);
|
$errors[] = $this->domNodeToArray($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @source http://www.ermshaus.org/2010/12/php-transform-domnode-to-array
|
* @source http://www.ermshaus.org/2010/12/php-transform-domnode-to-array
|
||||||
*
|
*
|
||||||
* Transforms the contents of a DOMNode to an associative array
|
* Transforms the contents of a DOMNode to an associative array
|
||||||
*
|
*
|
||||||
* XML node names become array keys, attributes will be discarded. If $node
|
* XML node names become array keys, attributes will be discarded. If $node
|
||||||
* doesn't contain child nodes, a string will be returned.
|
* doesn't contain child nodes, a string will be returned.
|
||||||
*
|
*
|
||||||
|
@@ -43,4 +43,4 @@ class SimpleTestListener implements PHPUnit_Framework_TestListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Doctrine\Common\DataFixtures\Loader;
|
use Doctrine\Common\DataFixtures\Loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package
|
* @package
|
||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
@@ -36,7 +36,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
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';
|
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 Symfony\Component\HttpKernel\Client
|
* @var Symfony\Component\HttpKernel\Client
|
||||||
*/
|
*/
|
||||||
protected $client;
|
protected $client;
|
||||||
|
|
||||||
@@ -353,14 +353,14 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell if tables were updated with new schemas
|
* Tell if tables were updated with new schemas
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected static $updated;
|
protected static $updated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if yo need record for your test
|
* if yo need record for your test
|
||||||
* just tell how many
|
* just tell how many
|
||||||
* example = $need_records = 2
|
* example = $need_records = 2
|
||||||
* will create 2 records self::$record_1 & self::$record_2
|
* will create 2 records self::$record_1 & self::$record_2
|
||||||
* You can use the same mechanism for subdef and stories
|
* You can use the same mechanism for subdef and stories
|
||||||
* @var mixed int|boolean
|
* @var mixed int|boolean
|
||||||
@@ -371,13 +371,13 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var collection
|
* @var collection
|
||||||
*/
|
*/
|
||||||
protected static $collection;
|
protected static $collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var collection
|
* @var collection
|
||||||
*/
|
*/
|
||||||
protected static $collection_no_access;
|
protected static $collection_no_access;
|
||||||
|
|
||||||
@@ -395,7 +395,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var \Alchemy\Phrasea\Core
|
* @var \Alchemy\Phrasea\Core
|
||||||
*/
|
*/
|
||||||
protected static $core;
|
protected static $core;
|
||||||
|
|
||||||
@@ -439,8 +439,8 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
* Delete temporay sqlite database
|
* Delete temporay sqlite database
|
||||||
* Create schema using $this->classesMetatdas
|
* Create schema using $this->classesMetatdas
|
||||||
* Load DoctrineTestServices
|
* Load DoctrineTestServices
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -487,9 +487,9 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
//set Mozilla user agent as default
|
//set Mozilla user agent as default
|
||||||
$browser = Browser::getInstance();
|
$browser = Browser::getInstance();
|
||||||
$browser->setUserAgent(self::USER_AGENT_FIREFOX8MAC);
|
$browser->setUserAgent(self::USER_AGENT_FIREFOX8MAC);
|
||||||
|
|
||||||
$this->purgeDatabase();
|
$this->purgeDatabase();
|
||||||
|
|
||||||
self::$user->ACL()->revoke_access_from_bases(array(self::$collection_no_access->get_base_id()));
|
self::$user->ACL()->revoke_access_from_bases(array(self::$collection_no_access->get_base_id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,8 +503,8 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
/**
|
/**
|
||||||
* Insert fixture contained in the specified fixtureLoader
|
* Insert fixture contained in the specified fixtureLoader
|
||||||
* into sqlLite test temporary database
|
* into sqlLite test temporary database
|
||||||
*
|
*
|
||||||
* @param Doctrine\Common\DataFixtures\Loader $fixtureLoader
|
* @param Doctrine\Common\DataFixtures\Loader $fixtureLoader
|
||||||
*/
|
*/
|
||||||
public function insertFixtureInDatabase(Doctrine\Common\DataFixtures\Loader $fixtureLoader, $append = true)
|
public function insertFixtureInDatabase(Doctrine\Common\DataFixtures\Loader $fixtureLoader, $append = true)
|
||||||
{
|
{
|
||||||
@@ -538,7 +538,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert one basket entry ans set current authenticated user as owner
|
* Insert one basket entry ans set current authenticated user as owner
|
||||||
*
|
*
|
||||||
* @return \Entities\Basket
|
* @return \Entities\Basket
|
||||||
*/
|
*/
|
||||||
protected function insertOneBasket()
|
protected function insertOneBasket()
|
||||||
@@ -561,23 +561,23 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
$this->fail('Fail load one Basket : ' . $e->getMessage());
|
$this->fail('Fail load one Basket : ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function insertOneUsrList(\User_Adapter $user)
|
protected function insertOneUsrList(\User_Adapter $user)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$loader = new Loader();
|
$loader = new Loader();
|
||||||
|
|
||||||
$UsrOwner = new PhraseaFixture\UsrLists\UsrListOwner();
|
$UsrOwner = new PhraseaFixture\UsrLists\UsrListOwner();
|
||||||
$UsrOwner->setUser($user);
|
$UsrOwner->setUser($user);
|
||||||
|
|
||||||
$loader->addFixture($UsrOwner);
|
$loader->addFixture($UsrOwner);
|
||||||
|
|
||||||
$UsrList = new PhraseaFixture\UsrLists\UsrList();
|
$UsrList = new PhraseaFixture\UsrLists\UsrList();
|
||||||
|
|
||||||
$loader->addFixture($UsrList);
|
$loader->addFixture($UsrList);
|
||||||
|
|
||||||
|
|
||||||
$this->insertFixtureInDatabase($loader);
|
$this->insertFixtureInDatabase($loader);
|
||||||
|
|
||||||
@@ -588,33 +588,33 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
$this->fail('Fail load one UsrList : ' . $e->getMessage());
|
$this->fail('Fail load one UsrList : ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param \Entities\UsrList $UsrList
|
* @param \Entities\UsrList $UsrList
|
||||||
* @return \Entities\UsrListEntry
|
* @return \Entities\UsrListEntry
|
||||||
*/
|
*/
|
||||||
protected function insertOneUsrListEntry(\User_adapter $owner, \User_adapter $user)
|
protected function insertOneUsrListEntry(\User_adapter $owner, \User_adapter $user)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$loader = new Loader();
|
$loader = new Loader();
|
||||||
|
|
||||||
$UsrOwner = new PhraseaFixture\UsrLists\UsrListOwner();
|
$UsrOwner = new PhraseaFixture\UsrLists\UsrListOwner();
|
||||||
$UsrOwner->setUser($owner);
|
$UsrOwner->setUser($owner);
|
||||||
|
|
||||||
$loader->addFixture($UsrOwner);
|
$loader->addFixture($UsrOwner);
|
||||||
|
|
||||||
$UsrList = new PhraseaFixture\UsrLists\UsrList();
|
$UsrList = new PhraseaFixture\UsrLists\UsrList();
|
||||||
|
|
||||||
$loader->addFixture($UsrList);
|
$loader->addFixture($UsrList);
|
||||||
|
|
||||||
$UsrEntry = new PhraseaFixture\UsrLists\UsrListEntry();
|
$UsrEntry = new PhraseaFixture\UsrLists\UsrListEntry();
|
||||||
// $UsrEntry->setList($UsrList);
|
// $UsrEntry->setList($UsrList);
|
||||||
$UsrEntry->setUser($user);
|
$UsrEntry->setUser($user);
|
||||||
|
|
||||||
$loader->addFixture($UsrEntry);
|
$loader->addFixture($UsrEntry);
|
||||||
|
|
||||||
|
|
||||||
$this->insertFixtureInDatabase($loader);
|
$this->insertFixtureInDatabase($loader);
|
||||||
|
|
||||||
@@ -628,7 +628,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert five baskets and set current authenticated user as owner
|
* Insert five baskets and set current authenticated user as owner
|
||||||
*
|
*
|
||||||
* @return \Entities\Basket
|
* @return \Entities\Basket
|
||||||
*/
|
*/
|
||||||
protected function insertFiveBasket()
|
protected function insertFiveBasket()
|
||||||
@@ -724,10 +724,10 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
/**
|
/**
|
||||||
* Create a new basket with current auhtenticated user as owner
|
* Create a new basket with current auhtenticated user as owner
|
||||||
* Create a new sessionValidation with the newly created basket
|
* Create a new sessionValidation with the newly created basket
|
||||||
* Set current authenticated user as sessionValidation initiator
|
* Set current authenticated user as sessionValidation initiator
|
||||||
* Add 2 records as elments of the newly created basket
|
* Add 2 records as elments of the newly created basket
|
||||||
* Add 2 participants to the newly created sessionValidation
|
* Add 2 participants to the newly created sessionValidation
|
||||||
*
|
*
|
||||||
* @return \Entities\Basket
|
* @return \Entities\Basket
|
||||||
*/
|
*/
|
||||||
protected function insertOneBasketEnv()
|
protected function insertOneBasketEnv()
|
||||||
@@ -765,7 +765,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
* One basket
|
* One basket
|
||||||
* One story
|
* One story
|
||||||
* One ValidationSession & one participant
|
* One ValidationSession & one participant
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected function insertOneWZ()
|
protected function insertOneWZ()
|
||||||
{
|
{
|
||||||
@@ -827,7 +827,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
$serviceName
|
$serviceName
|
||||||
, $confService
|
, $confService
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->app['Core']["Twig"] = $templateServiceBuilder->buildService()->getService();
|
$this->app['Core']["Twig"] = $templateServiceBuilder->buildService()->getService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -870,7 +870,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
$upgrader = new Setup_Upgrade($appbox);
|
$upgrader = new Setup_Upgrade($appbox);
|
||||||
$appbox->forceUpgrade($upgrader);
|
$appbox->forceUpgrade($upgrader);
|
||||||
unset($upgrader);
|
unset($upgrader);
|
||||||
|
|
||||||
self::$updated = true;
|
self::$updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -884,7 +884,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
* self::$user
|
* self::$user
|
||||||
* self::$user_alt1
|
* self::$user_alt1
|
||||||
* self::$user_alt2
|
* self::$user_alt2
|
||||||
*
|
*
|
||||||
* @return void;
|
* @return void;
|
||||||
*/
|
*/
|
||||||
private static function createSetOfUserTests()
|
private static function createSetOfUserTests()
|
||||||
@@ -920,8 +920,8 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Give Bases Rights to User
|
* Give Bases Rights to User
|
||||||
*
|
*
|
||||||
* @param \User_AAdapter $user
|
* @param \User_AAdapter $user
|
||||||
*/
|
*/
|
||||||
private static function giveRightsToUser(\User_Adapter $user)
|
private static function giveRightsToUser(\User_Adapter $user)
|
||||||
{
|
{
|
||||||
@@ -975,7 +975,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set self::$collection
|
* Set self::$collection
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private static function setCollection()
|
private static function setCollection()
|
||||||
{
|
{
|
||||||
@@ -1011,15 +1011,15 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
self::$collection = $coll;
|
self::$collection = $coll;
|
||||||
|
|
||||||
self::$collection_no_access = $collection_no_acces;
|
self::$collection_no_access = $collection_no_acces;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a set of stories for the current test suites
|
* Generate a set of stories for the current test suites
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private static function generateStories()
|
private static function generateStories()
|
||||||
@@ -1033,7 +1033,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
, true
|
, true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (static::$need_story && !self::$story_2 instanceof record_adapter)
|
if (static::$need_story && !self::$story_2 instanceof record_adapter)
|
||||||
{
|
{
|
||||||
self::$story_2 = \record_adapter::create(
|
self::$story_2 = \record_adapter::create(
|
||||||
@@ -1048,9 +1048,9 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a set subdef according to the records previously created
|
* Generate a set subdef according to the records previously created
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private static function generateSubdefs()
|
private static function generateSubdefs()
|
||||||
{
|
{
|
||||||
@@ -1172,6 +1172,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
self::$generated_subdefs['a23'] = true;
|
self::$generated_subdefs['a23'] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1310,8 +1311,8 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete previously created Ressources
|
* Delete previously created Ressources
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private static function deleteRessources()
|
private static function deleteRessources()
|
||||||
{
|
{
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package
|
* @package
|
||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
@@ -41,4 +41,4 @@ abstract class PhraseanetPHPUnitAuthenticatedAbstract extends PhraseanetPHPUnitA
|
|||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package
|
* @package
|
||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
@@ -24,4 +24,4 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
abstract class PhraseanetWebTestCaseAbstract extends \PhraseanetPHPUnitAbstract
|
abstract class PhraseanetWebTestCaseAbstract extends \PhraseanetPHPUnitAbstract
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package
|
* @package
|
||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
@@ -41,4 +41,4 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
|
|||||||
$session->logout();
|
$session->logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
function getRawEditorData($paramName) {
|
function getRawEditorData($paramName) {
|
||||||
if ($paramName) {
|
if ($paramName) {
|
||||||
if (isset($_POST[$paramName])) {
|
if (isset($_POST[$paramName])) {
|
||||||
return $_POST[$paramName];
|
return $_POST[$paramName];
|
||||||
} else if (isset($_GET[$paramName])) {
|
} else if (isset($_GET[$paramName])) {
|
||||||
return $_GET[$paramName];
|
return $_GET[$paramName];
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
function getRawData($paramName) {
|
function getRawData($paramName) {
|
||||||
if ($paramName) {
|
if ($paramName) {
|
||||||
if (isset($_POST[$paramName])) {
|
if (isset($_POST[$paramName])) {
|
||||||
return $_POST[$paramName];
|
return $_POST[$paramName];
|
||||||
} else if (isset($_GET[$paramName])) {
|
} else if (isset($_GET[$paramName])) {
|
||||||
return $_GET[$paramName];
|
return $_GET[$paramName];
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user