modify datas for bridge

This commit is contained in:
Nicolas Le Goff
2012-01-17 16:44:12 +01:00
parent 989ea15dbb
commit c0c33d9e35

View File

@@ -170,8 +170,12 @@ class Bridge_Api_Apitest_Element implements Bridge_Api_ElementInterface
class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Interface
{
const AUTH_TYPE = 'None';
public static $hasError = false;
public static $hasException = false;
public function __construct(registryInterface $registry, Bridge_Api_Auth_Interface $auth)
{
parent::__construct($registry, $auth);
@@ -380,19 +384,31 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
}
public function create_container($container_type, Request $request)
public function create_container($container_type, \Symfony\Component\HttpFoundation\Request $request)
{
if (self::$hasException)
{
self::$hasException = false;
throw new \Exception("une erreur");
}
}
public function add_element_to_container($element_type, $element_id, $destination, $container_id)
{
if (self::$hasException)
{
self::$hasException = false;
throw new \Exception("une erreur");
}
}
public function delete_object($object, $object_id)
{
if (self::$hasException)
{
self::$hasException = false;
throw new \Exception("une erreur");
}
}
/**
@@ -401,7 +417,11 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
*/
public function acceptable_records()
{
$func = function($record)
{
return true;
};
return $func;
}
public function get_element_status(Bridge_Element $element)
@@ -436,12 +456,17 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
public function check_upload_constraints(array $datas, record_adapter $record)
{
if (self::$hasError)
{
self::$hasError = false;
return array('title' => 'too long');
}
return array();
}
public function get_upload_datas(Request $request, record_adapter $record)
public function get_upload_datas(\Symfony\Component\HttpFoundation\Request $request, record_adapter $record)
{
return array();
}
public function is_multiple_upload()
@@ -451,12 +476,26 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
public function check_update_constraints(Array $datas)
{
if (!self::$hasError)
{
if (self::$hasException)
{
self::$hasException = false;
throw new \Exception('une erreur');
}
public function get_update_datas(Request $request)
return array();
}
elseif (self::$hasError)
{
self::$hasError = false;
return array('title' => 'too long');
}
}
public function get_update_datas(\Symfony\Component\HttpFoundation\Request $request)
{
return array();
}
}