mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Add coverage
This commit is contained in:
@@ -37,6 +37,12 @@ class Factory
|
|||||||
case Attribute::NAME_STORY:
|
case Attribute::NAME_STORY:
|
||||||
return Story::loadFromString($serialized);
|
return Story::loadFromString($serialized);
|
||||||
break;
|
break;
|
||||||
|
case Attribute::NAME_METAFIELD:
|
||||||
|
return MetaField::loadFromString($serialized);
|
||||||
|
break;
|
||||||
|
case Attribute::NAME_STATUS:
|
||||||
|
return Status::loadFromString($serialized);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException(sprintf('Unknown attribute %s', $name));
|
throw new \InvalidArgumentException(sprintf('Unknown attribute %s', $name));
|
||||||
|
@@ -41,6 +41,38 @@ class FactoryTest extends \PhraseanetPHPUnitAbstract
|
|||||||
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Attribute\\Story', $attribute);
|
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Attribute\\Story', $attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Alchemy\Phrasea\Border\Attribute\Factory::getFileAttribute
|
||||||
|
*/
|
||||||
|
public function testGetFileAttributeMetaField()
|
||||||
|
{
|
||||||
|
$databox_field = null;
|
||||||
|
foreach (self::$collection->get_databox()->get_meta_structure() as $df) {
|
||||||
|
$databox_field = $df;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $databox_field) {
|
||||||
|
$this->markTestSkipped('No databox field found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$metafield = new MetaField($databox_field, 'value');
|
||||||
|
|
||||||
|
$attribute = Factory::getFileAttribute(Attribute::NAME_METAFIELD, $metafield->asString());
|
||||||
|
|
||||||
|
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Attribute\\MetaField', $attribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Alchemy\Phrasea\Border\Attribute\Factory::getFileAttribute
|
||||||
|
*/
|
||||||
|
public function testGetFileAttributeStatus()
|
||||||
|
{
|
||||||
|
$attribute = Factory::getFileAttribute(Attribute::NAME_STATUS, '000100');
|
||||||
|
|
||||||
|
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Attribute\\Status', $attribute);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers Alchemy\Phrasea\Border\Attribute\Factory::getFileAttribute
|
* @covers Alchemy\Phrasea\Border\Attribute\Factory::getFileAttribute
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
|
Reference in New Issue
Block a user