private function generateSubdefPathname(\record_adapter $record, \databox_subdef $subdef, $oldVersion = null) { if ($oldVersion) { $pathdest = \p4string::addEndSlash(pathinfo($oldVersion, PATHINFO_DIRNAME)); } else { $pathdest = \databox::dispatch($this->filesystem, $subdef->get_path()); } return $pathdest . $record->get_record_id() . '_' . $subdef->get_name() . '.' . $this->getExtensionFromSpec($subdef->getSpecs()); }
/** * @covers databox_subdef::__construct * @covers databox_subdef::get_class * @covers databox_subdef::get_name * @covers databox_subdef::meta_writeable * @covers databox_subdef::getAvailableSubdefTypes * @covers databox_subdef::is_downloadable * @covers databox_subdef::get_labels * @covers databox_subdef::getSubdefGroup * @covers databox_subdef::getSubdefType * @covers databox_subdef::get_path * @covers databox_subdef::getSpecs * @covers databox_subdef::getOptions * @covers databox_subdef::buildVideoSubdef */ public function testVideo() { $xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <subdef class="thumbnail" name="video_api" downloadable="false"> <path>/home/datas/noweb/db_alch_phrasea/video/</path> <meta>no</meta> <mediatype>video</mediatype> <size>196</size> <dpi>72</dpi> <strip>yes</strip> <quality>75</quality> <fps>10</fps> <threads>1</threads> <bitrate>192</bitrate> <acodec>libfaac</acodec> <vcodec>libx264</vcodec> </subdef>'; $type = new \Alchemy\Phrasea\Media\Type\Video(); $object = new databox_subdef($type, simplexml_load_string($xml), $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface')); $this->assertEquals(databox_subdef::CLASS_THUMBNAIL, $object->get_class()); $this->assertEquals('/home/datas/noweb/db_alch_phrasea/video/', $object->get_path()); $this->assertInstanceOf('\\Alchemy\\Phrasea\\Media\\Subdef\\Subdef', $object->getSubdefType()); $this->assertEquals($type, $object->getSubdefGroup()); $labels = $object->get_labels(); $this->assertTrue(is_array($labels)); $this->assertEquals(0, count($labels)); $this->assertFalse($object->is_downloadable()); $this->assertTrue(is_array($object->getAvailableSubdefTypes())); $this->assertTrue(count($object->getAvailableSubdefTypes()) > 0); foreach ($object->getAvailableSubdefTypes() as $type) { $this->assertInstanceOf('\\Alchemy\\Phrasea\\Media\\Subdef\\Subdef', $type); } $this->assertFalse($object->meta_writeable()); $this->assertEquals('video_api', $object->get_name()); $this->assertInstanceOf('\\MediaAlchemyst\\Specification\\Video', $object->getSpecs()); $options = $object->getOptions(); $this->assertTrue(is_array($options)); foreach ($options as $option) { $this->assertInstanceOf('\\Alchemy\\Phrasea\\Media\\Subdef\\OptionType\\OptionType', $option); } }