mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
183 lines
4.4 KiB
PHP
183 lines
4.4 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/../PhraseanetPHPUnitAbstract.class.inc';
|
|
|
|
/**
|
|
* Test class for caption_record.
|
|
* Generated by PHPUnit on 2012-03-20 at 15:12:31.
|
|
*/
|
|
class caption_recordTest extends PhraseanetPHPUnitAbstract
|
|
{
|
|
|
|
/**
|
|
* @var caption_record
|
|
*/
|
|
protected $object;
|
|
protected static $need_records = 1;
|
|
|
|
/**
|
|
* 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 caption_record(self::$record_1, self::$record_1->get_databox());
|
|
}
|
|
|
|
/**
|
|
* @covers {className}::{origMethodName}
|
|
* @todo Implement testSerialize().
|
|
*/
|
|
public function testSerializeXML()
|
|
{
|
|
|
|
foreach (self::$record_1->get_databox()->get_meta_structure() as $databox_field)
|
|
{
|
|
$n = $databox_field->is_multi() ? 3 : 1;
|
|
|
|
for ($i = 0; $i < $n; $i++)
|
|
{
|
|
\caption_Field_Value::create($databox_field, self::$record_1, \random::generatePassword());
|
|
}
|
|
}
|
|
|
|
$xml = $this->object->serialize(\caption_record::SERIALIZE_XML);
|
|
|
|
$sxe = simplexml_load_string($xml);
|
|
$this->assertInstanceOf('SimpleXMLElement', $sxe);
|
|
|
|
foreach (self::$record_1->get_caption()->get_fields() as $field)
|
|
{
|
|
if($field->get_databox_field()->is_multi())
|
|
{
|
|
$tagname = $field->get_name();
|
|
$retrieved = array();
|
|
foreach($sxe->description->$tagname as $value)
|
|
{
|
|
$retrieved[] = (string) $value;
|
|
}
|
|
|
|
$values = $field->get_values();
|
|
$this->assertEquals(count($values), count($retrieved));
|
|
foreach($values as $val)
|
|
{
|
|
$this->assertTrue(in_array($val->getValue(), $retrieved));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$tagname = $field->get_name();
|
|
$value = array_pop($field->get_values());
|
|
$this->assertEquals($value->getValue(), (string) $sxe->description->$tagname);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function testSerializeYAML()
|
|
{
|
|
// 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 testGet_field().
|
|
*/
|
|
public function testGet_field()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers {className}::{origMethodName}
|
|
* @todo Implement testGet_dc_field().
|
|
*/
|
|
public function testGet_dc_field()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers {className}::{origMethodName}
|
|
* @todo Implement testGet_highlight_fields().
|
|
*/
|
|
public function testGet_highlight_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_cache_key().
|
|
*/
|
|
public function testGet_cache_key()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers {className}::{origMethodName}
|
|
* @todo Implement testGet_data_from_cache().
|
|
*/
|
|
public function testGet_data_from_cache()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers {className}::{origMethodName}
|
|
* @todo Implement testSet_data_to_cache().
|
|
*/
|
|
public function testSet_data_to_cache()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers {className}::{origMethodName}
|
|
* @todo Implement testDelete_data_from_cache().
|
|
*/
|
|
public function testDelete_data_from_cache()
|
|
{
|
|
// Remove the following lines when you implement this test.
|
|
$this->markTestIncomplete(
|
|
'This test has not been implemented yet.'
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
?>
|