mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Merge
This commit is contained in:
@@ -442,8 +442,14 @@ class searchEngine_options implements Serializable
|
||||
|
||||
foreach ($serialized as $key => $value)
|
||||
{
|
||||
if (in_array($key, array('date_min', 'date_max')))
|
||||
if(is_null($value))
|
||||
{
|
||||
$value = null;
|
||||
}
|
||||
elseif (in_array($key, array('date_min', 'date_max')))
|
||||
{
|
||||
$value = new DateTime($value);
|
||||
}
|
||||
elseif ($value instanceof stdClass)
|
||||
$value = (array) $value;
|
||||
|
||||
|
360
lib/unitTest/searchEngine_optionsTest.php
Normal file
360
lib/unitTest/searchEngine_optionsTest.php
Normal file
@@ -0,0 +1,360 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__) . '/PhraseanetPHPUnitAuthenticatedAbstract.class.inc';
|
||||
|
||||
/**
|
||||
* Test class for searchEngine_options.
|
||||
* Generated by PHPUnit on 2012-01-11 at 15:13:53.
|
||||
*/
|
||||
class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @var searchEngine_options
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->object = new searchEngine_options();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
*/
|
||||
public function testSet_locale()
|
||||
{
|
||||
$locale = 'BABA';
|
||||
$this->object->set_locale($locale);
|
||||
$this->assertEquals($locale, $this->object->get_locale());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_locale().
|
||||
*/
|
||||
public function testGet_locale()
|
||||
{
|
||||
$locale = null;
|
||||
$this->object->set_locale($locale);
|
||||
$this->assertEquals($locale, $this->object->get_locale());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSet_sort().
|
||||
*/
|
||||
public function testSet_sort()
|
||||
{
|
||||
$by = 'NAME';
|
||||
$sort = 'ASC';
|
||||
$this->object->set_sort($by, $sort);
|
||||
$this->assertEquals($by, $this->object->get_sortby());
|
||||
$this->assertEquals($sort, $this->object->get_sortord());
|
||||
$this->object->set_sort($by);
|
||||
$this->assertEquals($by, $this->object->get_sortby());
|
||||
$this->assertEquals(searchEngine_options::SORT_MODE_DESC, $this->object->get_sortord());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_sortby().
|
||||
*/
|
||||
public function testGet_sortby()
|
||||
{
|
||||
$by = 'NAME';
|
||||
$sort = 'DESC';
|
||||
$this->object->set_sort($by, $sort);
|
||||
$this->assertEquals($by, $this->object->get_sortby());
|
||||
$this->assertEquals($sort, $this->object->get_sortord());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_sortord().
|
||||
*/
|
||||
public function testGet_sortord()
|
||||
{
|
||||
$by = 'NAME';
|
||||
$sort = 'DESC';
|
||||
$this->object->set_sort($by, $sort);
|
||||
$this->assertEquals($by, $this->object->get_sortby());
|
||||
$this->assertEquals($sort, $this->object->get_sortord());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSet_use_stemming().
|
||||
*/
|
||||
public function testSet_use_stemming()
|
||||
{
|
||||
$bool = true;
|
||||
$this->object->set_use_stemming($bool);
|
||||
$this->assertEquals($bool, $this->object->get_use_stemming());
|
||||
$bool = false;
|
||||
$this->object->set_use_stemming($bool);
|
||||
$this->assertEquals($bool, $this->object->get_use_stemming());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_use_stemming().
|
||||
*/
|
||||
public function testGet_use_stemming()
|
||||
{
|
||||
$bool = true;
|
||||
$this->object->set_use_stemming($bool);
|
||||
$this->assertEquals($bool, $this->object->get_use_stemming());
|
||||
$bool = false;
|
||||
$this->object->set_use_stemming($bool);
|
||||
$this->assertEquals($bool, $this->object->get_use_stemming());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSet_search_type().
|
||||
*/
|
||||
public function testSet_search_type()
|
||||
{
|
||||
$type = "caca";
|
||||
$this->object->set_search_type($type);
|
||||
$this->assertEquals(searchEngine_options::RECORD_RECORD, $this->object->get_search_type());
|
||||
$type = searchEngine_options::RECORD_RECORD;
|
||||
$this->object->set_search_type($type);
|
||||
$this->assertEquals(searchEngine_options::RECORD_RECORD, $this->object->get_search_type());
|
||||
$type = searchEngine_options::RECORD_GROUPING;
|
||||
$this->object->set_search_type($type);
|
||||
$this->assertEquals(searchEngine_options::RECORD_GROUPING, $this->object->get_search_type());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_search_type().
|
||||
*/
|
||||
public function testGet_search_type()
|
||||
{
|
||||
$type = "caca";
|
||||
$this->object->set_search_type($type);
|
||||
$this->assertEquals(searchEngine_options::RECORD_RECORD, $this->object->get_search_type());
|
||||
$type = searchEngine_options::RECORD_RECORD;
|
||||
$this->object->set_search_type($type);
|
||||
$this->assertEquals(searchEngine_options::RECORD_RECORD, $this->object->get_search_type());
|
||||
$type = searchEngine_options::RECORD_GROUPING;
|
||||
$this->object->set_search_type($type);
|
||||
$this->assertEquals(searchEngine_options::RECORD_GROUPING, $this->object->get_search_type());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSet_bases().
|
||||
*/
|
||||
public function testSet_bases()
|
||||
{
|
||||
$bases = array_keys(self::$user->ACL()->get_granted_base());
|
||||
$this->object->set_bases($bases, self::$user->ACL());
|
||||
$this->assertEquals(array_values($bases), array_values($this->object->get_bases()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_bases().
|
||||
*/
|
||||
public function testGet_bases()
|
||||
{
|
||||
$bases = array_keys(self::$user->ACL()->get_granted_base());
|
||||
$this->object->set_bases($bases, self::$user->ACL());
|
||||
$this->assertEquals(array_values($bases), array_values($this->object->get_bases()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSet_fields().
|
||||
*/
|
||||
public function testSet_fields()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_fields().
|
||||
*/
|
||||
public function testGet_fields()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSet_status().
|
||||
*/
|
||||
public function testSet_status()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_status().
|
||||
*/
|
||||
public function testGet_status()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSet_record_type().
|
||||
*/
|
||||
public function testSet_record_type()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_record_type().
|
||||
*/
|
||||
public function testGet_record_type()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSet_min_date().
|
||||
*/
|
||||
public function testSet_min_date()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_min_date().
|
||||
*/
|
||||
public function testGet_min_date()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSet_max_date().
|
||||
*/
|
||||
public function testSet_max_date()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_max_date().
|
||||
*/
|
||||
public function testGet_max_date()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSet_date_fields().
|
||||
*/
|
||||
public function testSet_date_fields()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testGet_date_fields().
|
||||
*/
|
||||
public function testGet_date_fields()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testSerialize().
|
||||
*/
|
||||
public function testSerialize()
|
||||
{
|
||||
$bases = array_keys(self::$user->ACL()->get_granted_base());
|
||||
$this->object->set_bases($bases, self::$user->ACL());
|
||||
$this->object->set_date_fields(array());
|
||||
$this->object->set_locale('fr_FR');
|
||||
$this->object->set_max_date(null);
|
||||
$this->object->set_min_date(null);
|
||||
$this->object->set_record_type(searchEngine_options::TYPE_AUDIO);
|
||||
$this->object->set_search_type(searchEngine_options::RECORD_RECORD);
|
||||
$this->object->set_sort('Name','DESC');
|
||||
$this->object->set_status(array());
|
||||
$this->object->set_use_stemming(true);
|
||||
$this->assertEquals($this->object, unserialize(serialize($this->object)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testUnserialize().
|
||||
*/
|
||||
public function testUnserialize()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user