diff --git a/lib/Alchemy/Phrasea/Border/File.php b/lib/Alchemy/Phrasea/Border/File.php index ddf07d8e3d..6a759652d4 100644 --- a/lib/Alchemy/Phrasea/Border/File.php +++ b/lib/Alchemy/Phrasea/Border/File.php @@ -276,8 +276,10 @@ class File */ public function buildFromPathfile($pathfile, \collection $collection, $originalName = null) { + $core = \bootstrap::getCore(); + try { - $media = MediaVorus::guess(new \SplFileInfo($pathfile)); + $media = $core['mediavorus']->guess(new \SplFileInfo($pathfile)); } catch (\MediaVorus\Exception\FileNotFoundException $e) { throw new \InvalidArgumentException(sprintf('Unable to build media file from non existant %s', $pathfile)); } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php index 8e7030bbd4..5b12ca708d 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php @@ -132,7 +132,7 @@ class Publications implements ControllerProviderInterface throw new \Exception_BadRequest('Uploaded file is invalid'); } - $media = \MediaVorus\MediaVorus::guess($file); + $media = $app['Core']['mediavorus']->guess($file); if ($media->getType() !== \MediaVorus\Media\Media::TYPE_IMAGE) { throw new \Exception_BadRequest('Bad filetype'); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php index 0ddcc4adcb..ea2766b7dd 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php @@ -401,7 +401,7 @@ class Lazaret implements ControllerProviderInterface return self::formatJson($app['Core']['Serializer'], $ret); } - $media = MediaVorus::guess(new \SplFileInfo($lazaretFile->getPathname())); + $media = $app['Core']['mediavorus']->guess(new \SplFileInfo($lazaretFile->getPathname())); $record = $lazaretFile->getCollection()->get_databox()->get_record($recordId); $record->substitute_subdef('document', $media); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php index a040ae9f5b..14e97f0879 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php @@ -143,7 +143,7 @@ class Tools implements ControllerProviderInterface , $request->get('record_id') ); - $media = MediaVorus::guess($file); + $media = $app['Core']['mediavorus']->guess($file); $record->substitute_subdef('document', $media); @@ -194,7 +194,7 @@ class Tools implements ControllerProviderInterface , $request->get('record_id') ); - $media = MediaVorus::guess($file); + $media = $app['Core']['mediavorus']->guess($file); $record->substitute_subdef('thumbnail', $media); @@ -254,7 +254,7 @@ class Tools implements ControllerProviderInterface file_put_contents($fileName, $dataUri->getData()); - $media = MediaVorus::guess(new \SplFileInfo($fileName)); + $media = $app['Core']['mediavorus']->guess(new \SplFileInfo($fileName)); $record->substitute_subdef('thumbnail', $media); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php index 0d1ef08332..78a810703a 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php @@ -12,7 +12,6 @@ namespace Alchemy\Phrasea\Controller\Prod; use Alchemy\Phrasea\Border; -use MediaVorus\MediaVorus; use Silex\Application; use Silex\ControllerProviderInterface; use Silex\ControllerCollection; @@ -177,7 +176,7 @@ class Upload implements ControllerProviderInterface } try { - $media = MediaVorus::guess($file); + $media = $app['Core']['mediavorus']->guess($file); $collection = \collection::get_from_base_id($base_id); $lazaretSession = new \Entities\LazaretSession(); diff --git a/lib/Alchemy/Phrasea/Core.php b/lib/Alchemy/Phrasea/Core.php index 097e0d7798..758b7bc77e 100644 --- a/lib/Alchemy/Phrasea/Core.php +++ b/lib/Alchemy/Phrasea/Core.php @@ -145,6 +145,12 @@ class Core extends \Pimple return new Serializer\Serializer(array(), $encoders); }); + + $this['mediavorus'] = $this->share(function() { + + return new \MediaVorus\MediaVorus(); + }); + $this['monolog'] = $this->share(function () use ($core) { $logger = new \Monolog\Logger('Logger'); diff --git a/lib/Alchemy/Phrasea/Helper/Record/Edit.php b/lib/Alchemy/Phrasea/Helper/Record/Edit.php index 966e32e697..a7642495d9 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Edit.php @@ -450,7 +450,7 @@ class Edit extends RecordHelper throw new \Exception('A reg image must come from image data'); foreach ($newsubdef_reg->get_subdefs() as $name => $value) { - $media = MediaVorus::guess(new \SplFileInfo($value->get_pathfile())); + $media = $this->core['mediavorus']->guess(new \SplFileInfo($value->get_pathfile())); $reg_record->substitute_subdef($name, $media); } } catch (\Exception $e) { diff --git a/lib/classes/API/V1/adapter.class.php b/lib/classes/API/V1/adapter.class.php index 14e8d3e09c..da63227a2e 100644 --- a/lib/classes/API/V1/adapter.class.php +++ b/lib/classes/API/V1/adapter.class.php @@ -644,7 +644,7 @@ class API_V1_adapter extends API_V1_Abstract throw new API_V1_exception_forbidden(sprintf('You do not have access to collection %s', $collection->get_name())); } - $media = \MediaVorus\MediaVorus::guess($file); + $media = $app['Core']['mediavorus']->guess($file); $Package = new Alchemy\Phrasea\Border\File($media, $collection, $file->getClientOriginalName()); diff --git a/lib/classes/media/subdef.class.php b/lib/classes/media/subdef.class.php index ee0c205dfd..ea59475b83 100644 --- a/lib/classes/media/subdef.class.php +++ b/lib/classes/media/subdef.class.php @@ -438,7 +438,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface */ public function get_size() { - return filesize($this->get_pathfile()); + return @filesize($this->get_pathfile()); } /** @@ -563,7 +563,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface return $this; } - $media = MediaVorus::guess(new SplFileInfo($this->get_pathfile())); + $media = $Core['mediavorus']->guess(new SplFileInfo($this->get_pathfile())); $sql = "UPDATE subdef SET height = :height , width = :width, updated_on = NOW() @@ -601,8 +601,9 @@ class media_subdef extends media_abstract implements cache_cacheableInterface if ( ! $this->is_physically_present()) { return array(); } - - $media = MediaVorus::guess(new \SplFileInfo($this->get_pathfile())); + + $Core = \bootstrap::getCore(); + $media = $Core['mediavorus']->guess(new \SplFileInfo($this->get_pathfile())); $datas = array(); diff --git a/lib/classes/p4file.class.php b/lib/classes/p4file.class.php index f636eb1243..804ec9cfe7 100644 --- a/lib/classes/p4file.class.php +++ b/lib/classes/p4file.class.php @@ -132,6 +132,7 @@ class p4file { throw new Exception('This method is deprecated'); + $core = \bootstrap::getCore(); $checks = array(); $system_file = new system_file($filename); @@ -151,7 +152,7 @@ class p4file $errors = array(); - $media = \MediaVorus\MediaVorus::guess($filename); + $media = $core['mediavorus']->guess($filename); $width = $height = 0; $colorSpace = null; diff --git a/lib/classes/patch/370a7.class.php b/lib/classes/patch/370a7.class.php index 414ffbacda..9ff999a83a 100644 --- a/lib/classes/patch/370a7.class.php +++ b/lib/classes/patch/370a7.class.php @@ -84,7 +84,7 @@ class patch_370a7 implements patchInterface $filePath = __DIR__ . '/../../../tmp/lazaret/' . $row['filepath']; if (file_exists($filePath)) { - $media = \MediaVorus\MediaVorus::guess(new \SplFileInfo($filePath)); + $media = $Core['mediavorus']->guess(new \SplFileInfo($filePath)); $collection = \collection::get_from_base_id($row['base_id']); diff --git a/lib/classes/record/adapter.class.php b/lib/classes/record/adapter.class.php index 72d48a75ac..1139dd3471 100644 --- a/lib/classes/record/adapter.class.php +++ b/lib/classes/record/adapter.class.php @@ -1002,7 +1002,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface } $core['file-system']->chmod($subdefFile->getRealPath(), 0760); - $media = \MediaVorus\MediaVorus::guess($subdefFile); + $media = $core['mediavorus']->guess($subdefFile); media_subdef::create($this, $name, $media); @@ -1348,7 +1348,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface $core['file-system']->copy($file->getFile()->getRealPath(), $pathhd . $newname, true); - $media = MediaVorus\MediaVorus::guess(new \SplFileInfo($pathhd . $newname)); + $media = $core['mediavorus']->guess(new \SplFileInfo($pathhd . $newname)); $subdef = media_subdef::create($record, 'document', $media); $record->delete_data_from_cache(record_adapter::CACHE_SUBDEFS); @@ -1652,6 +1652,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface return; } + + $core = \bootstrap::getCore(); foreach ($subdefs as $subdef) { $subdefname = $subdef->get_name(); @@ -1676,7 +1678,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface $this->generate_subdef($subdef, $pathdest, $logger); if (file_exists($pathdest)) { - $media = \MediaVorus\MediaVorus::guess(new \SplFileInfo($pathdest)); + $media = $core['mediavorus']->guess(new \SplFileInfo($pathdest)); media_subdef::create($this, $subdef->get_name(), $media); } diff --git a/lib/classes/task/period/archive.class.php b/lib/classes/task/period/archive.class.php index cedd788d81..85e58cf710 100755 --- a/lib/classes/task/period/archive.class.php +++ b/lib/classes/task/period/archive.class.php @@ -1531,7 +1531,8 @@ class task_period_archive extends task_abstract $stat1 = '0'; } - $media = MediaVorus::guess(new \SplFileInfo($pathfile)); + $core = \bootstrap::getCore(); + $media = $core['mediavorus']->guess(new \SplFileInfo($pathfile)); $databox = $collection->get_databox(); $metadatasStructure = $databox->get_meta_structure(); @@ -1597,7 +1598,7 @@ class task_period_archive extends task_abstract $core = \bootstrap::getCore(); $status = databox_status::operation_or($stat0, $stat1); - $media = MediaVorus::guess(new \SplFileInfo($pathfile)); + $media = $core['mediavorus']->guess(new \SplFileInfo($pathfile)); $databox = $collection->get_databox(); $metadatasStructure = $databox->get_meta_structure(); diff --git a/lib/classes/task/period/upgradetov31.class.php b/lib/classes/task/period/upgradetov31.class.php index d9af34222b..d6e8d45bfa 100644 --- a/lib/classes/task/period/upgradetov31.class.php +++ b/lib/classes/task/period/upgradetov31.class.php @@ -42,7 +42,8 @@ class task_period_upgradetov31 extends task_abstract { printf("taskid %s starting." . PHP_EOL, $this->getID()); // task can't be stopped here - $appbox = appbox::get_instance(\bootstrap::getCore()); + $core = \bootstrap::getCore(); + $appbox = appbox::get_instance($core); $conn = $appbox->get_connection(); $running = true; @@ -75,7 +76,7 @@ class task_period_upgradetov31 extends task_abstract $uuid = uuid::generate_v4(); try { - $media = \MediaVorus\MediaVorus::guess(new \SplFileInfo($pathfile)); + $media = $core->guess(new \SplFileInfo($pathfile)); $collection = \collection::get_from_coll_id($databox, $row['coll_id']); $file = new \Alchemy\Phrasea\Border\File($media, $collection); diff --git a/tests/Alchemy/Phrasea/Application/ApiAbstract.inc b/tests/Alchemy/Phrasea/Application/ApiAbstract.inc index 2e31da7aca..3467c29380 100644 --- a/tests/Alchemy/Phrasea/Application/ApiAbstract.inc +++ b/tests/Alchemy/Phrasea/Application/ApiAbstract.inc @@ -942,7 +942,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract { $this->setToken(self::$token); - $file = new \Alchemy\Phrasea\Border\File(\MediaVorus\MediaVorus::guess(new \SplFileInfo(__DIR__ . '/../../../testfiles/test001.CR2')), self::$collection); + $file = new \Alchemy\Phrasea\Border\File(self::$core['mediavorus']->guess(new \SplFileInfo(__DIR__ . '/../../../testfiles/test001.CR2')), self::$collection); $record = \record_adapter::createFromFile($file); $route = '/records/' . $record->get_sbas_id() . '/' . $record->get_record_id() . '/setmetadatas/'; @@ -1064,7 +1064,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract */ public function testMoveRecordToCollection() { - $file = new \Alchemy\Phrasea\Border\File(\MediaVorus\MediaVorus::guess(new \SplFileInfo(__DIR__ . '/../../../testfiles/test001.CR2')), self::$collection); + $file = new \Alchemy\Phrasea\Border\File(self::$core['mediavorus']->guess(new \SplFileInfo(__DIR__ . '/../../../testfiles/test001.CR2')), self::$collection); $record = \record_adapter::createFromFile($file); $this->setToken(self::$token); @@ -1327,9 +1327,10 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract $this->evaluateResponse200($this->client->getResponse()); $this->evaluateMeta200($content); - /** - * check that there is a record or lazaret - */ + $datas = $content['response']; + + $this->assertArrayHasKey('entity', $datas); + $this->assertArrayHasKey('url', $datas); } /** diff --git a/tests/Alchemy/Phrasea/Application/OverviewTest.php b/tests/Alchemy/Phrasea/Application/OverviewTest.php index 9e49675e3c..3dbf69ea30 100644 --- a/tests/Alchemy/Phrasea/Application/OverviewTest.php +++ b/tests/Alchemy/Phrasea/Application/OverviewTest.php @@ -48,7 +48,7 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract $tmp = tempnam(sys_get_temp_dir(), 'testEtag'); copy(__DIR__ . '/../../../testfiles/cestlafete.jpg', $tmp); - $media = \MediaVorus\MediaVorus::guess(new \SplFileInfo($tmp)); + $media = self::$core['mediavorus']->guess(new \SplFileInfo($tmp)); $file = new Alchemy\Phrasea\Border\File($media, self::$collection); $record = record_adapter::createFromFile($file); diff --git a/tests/Alchemy/Phrasea/Border/Checker/FilenameTest.php b/tests/Alchemy/Phrasea/Border/Checker/FilenameTest.php index 3da39bdc12..49503a6358 100644 --- a/tests/Alchemy/Phrasea/Border/Checker/FilenameTest.php +++ b/tests/Alchemy/Phrasea/Border/Checker/FilenameTest.php @@ -25,7 +25,7 @@ class FilenameTest extends \PhraseanetPHPUnitAbstract $this->object = new Filename; $this->filename = __DIR__ . '/../../../../../tmp/test001.CR2'; copy(__DIR__ . '/../../../../testfiles/test001.CR2', $this->filename); - $this->media = \MediaVorus\MediaVorus::guess(new \SplFileInfo($this->filename)); + $this->media = self::$core['mediavorus']->guess(new \SplFileInfo($this->filename)); } public function tearDown() diff --git a/tests/Alchemy/Phrasea/Border/Checker/MediaTypeTest.php b/tests/Alchemy/Phrasea/Border/Checker/MediaTypeTest.php index 3093935e55..e5ab29b7ce 100644 --- a/tests/Alchemy/Phrasea/Border/Checker/MediaTypeTest.php +++ b/tests/Alchemy/Phrasea/Border/Checker/MediaTypeTest.php @@ -26,7 +26,7 @@ class MediaTypeTest extends \PhraseanetPHPUnitAbstract */ public function testCheck() { - $media = \MediaVorus\MediaVorus::guess(new \SplFileInfo(__DIR__ . '/../../../../testfiles/test001.CR2')); + $media = self::$core['mediavorus']->guess(new \SplFileInfo(__DIR__ . '/../../../../testfiles/test001.CR2')); $file = new \Alchemy\Phrasea\Border\File($media, self::$collection); $response = $this->object->check(self::$core['EM'], $file); @@ -34,7 +34,7 @@ class MediaTypeTest extends \PhraseanetPHPUnitAbstract $object = new MediaType(array('mediatypes' => array(MediaType::TYPE_VIDEO, MediaType::TYPE_AUDIO))); - $media = \MediaVorus\MediaVorus::guess(new \SplFileInfo(__DIR__ . '/../../../../testfiles/test001.CR2')); + $media = self::$core['mediavorus']->guess(new \SplFileInfo(__DIR__ . '/../../../../testfiles/test001.CR2')); $file = new \Alchemy\Phrasea\Border\File($media, self::$collection); $response = $object->check(self::$core['EM'], $file); diff --git a/tests/Alchemy/Phrasea/Border/Checker/Sha256Test.php b/tests/Alchemy/Phrasea/Border/Checker/Sha256Test.php index 4c212e169d..3b3cea8be2 100644 --- a/tests/Alchemy/Phrasea/Border/Checker/Sha256Test.php +++ b/tests/Alchemy/Phrasea/Border/Checker/Sha256Test.php @@ -21,7 +21,7 @@ class Sha256Test extends \PhraseanetPHPUnitAbstract $this->object = new Sha256; $this->filename = __DIR__ . '/../../../../../tmp/test001.CR2'; copy(__DIR__ . '/../../../../testfiles/test001.CR2', $this->filename); - $this->media = \MediaVorus\MediaVorus::guess(new \SplFileInfo($this->filename)); + $this->media = self::$core['mediavorus']->guess(new \SplFileInfo($this->filename)); } public function tearDown() diff --git a/tests/Alchemy/Phrasea/Border/Checker/UUIDTest.php b/tests/Alchemy/Phrasea/Border/Checker/UUIDTest.php index a419f6b5d2..0d568af436 100644 --- a/tests/Alchemy/Phrasea/Border/Checker/UUIDTest.php +++ b/tests/Alchemy/Phrasea/Border/Checker/UUIDTest.php @@ -21,7 +21,7 @@ class UUIDTest extends \PhraseanetPHPUnitAbstract $this->object = new UUID; $this->filename = __DIR__ . '/../../../../../tmp/test001.CR2'; copy(__DIR__ . '/../../../../testfiles/test001.CR2', $this->filename); - $this->media = \MediaVorus\MediaVorus::guess(new \SplFileInfo($this->filename)); + $this->media = self::$core['mediavorus']->guess(new \SplFileInfo($this->filename)); } public function tearDown() diff --git a/tests/Alchemy/Phrasea/Border/FileTest.php b/tests/Alchemy/Phrasea/Border/FileTest.php index 7f49969d6a..f0a7a31c84 100644 --- a/tests/Alchemy/Phrasea/Border/FileTest.php +++ b/tests/Alchemy/Phrasea/Border/FileTest.php @@ -22,7 +22,7 @@ class FileTest extends \PhraseanetPHPUnitAbstract $this->filename = __DIR__ . '/../../../../tmp/iphone_pic.jpg'; copy(__DIR__ . '/../../../testfiles/iphone_pic.jpg', $this->filename); - $this->media = \MediaVorus\MediaVorus::guess(new \SplFileInfo($this->filename)); + $this->media = self::$core['mediavorus']->guess(new \SplFileInfo($this->filename)); $this->object = new File($this->media, self::$collection, 'originalName.txt'); } @@ -60,20 +60,20 @@ class FileTest extends \PhraseanetPHPUnitAbstract copy(__DIR__ . '/../../../testfiles/p4logo.jpg', $file); - $borderFile = new File(\MediaVorus\MediaVorus::guess(new \SplFileInfo($file)), self::$collection); + $borderFile = new File(self::$core['mediavorus']->guess(new \SplFileInfo($file)), self::$collection); $uuid = $borderFile->getUUID(true, false); $this->assertTrue(\uuid::is_valid($uuid)); $this->assertEquals($uuid, $borderFile->getUUID()); - $borderFile = new File(\MediaVorus\MediaVorus::guess(new \SplFileInfo($file)), self::$collection); + $borderFile = new File(self::$core['mediavorus']->guess(new \SplFileInfo($file)), self::$collection); $newuuid = $borderFile->getUUID(true, true); $this->assertTrue(\uuid::is_valid($newuuid)); $this->assertNotEquals($uuid, $newuuid); $this->assertEquals($newuuid, $borderFile->getUUID()); - $borderFile = new File(\MediaVorus\MediaVorus::guess(new \SplFileInfo($file)), self::$collection); + $borderFile = new File(self::$core['mediavorus']->guess(new \SplFileInfo($file)), self::$collection); $uuid = $borderFile->getUUID(); $this->assertTrue(\uuid::is_valid($uuid)); @@ -139,7 +139,7 @@ class FileTest extends \PhraseanetPHPUnitAbstract */ public function testOriginalNameAuto() { - $object = new File(\MediaVorus\MediaVorus::guess(new \SplFileInfo($this->filename)), self::$collection); + $object = new File(self::$core['mediavorus']->guess(new \SplFileInfo($this->filename)), self::$collection); $this->assertSame('iphone_pic.jpg', $object->getOriginalName()); } @@ -180,7 +180,7 @@ class FileTest extends \PhraseanetPHPUnitAbstract */ public function testBuildFromPathfile() { - $media = \MediaVorus\MediaVorus::guess(new \SplFileInfo($this->filename)); + $media = self::$core['mediavorus']->guess(new \SplFileInfo($this->filename)); $file1 = new File($media, self::$collection); $file2 = File::buildFromPathfile($this->filename, self::$collection); @@ -188,7 +188,7 @@ class FileTest extends \PhraseanetPHPUnitAbstract $this->assertEquals($file1, $file2); - $media = \MediaVorus\MediaVorus::guess(new \SplFileInfo($this->filename)); + $media = self::$core['mediavorus']->guess(new \SplFileInfo($this->filename)); $file3 = new File($media, self::$collection, 'coco lapin'); $file4 = File::buildFromPathfile($this->filename, self::$collection, 'coco lapin'); diff --git a/tests/PhraseanetPHPUnitAbstract.class.inc b/tests/PhraseanetPHPUnitAbstract.class.inc index 6a7660e324..8320efee43 100644 --- a/tests/PhraseanetPHPUnitAbstract.class.inc +++ b/tests/PhraseanetPHPUnitAbstract.class.inc @@ -731,13 +731,15 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase throw new Exception(sprintf('File %d not found', $i)); }; + + $core = self::$core; foreach (range(1, 24) as $i) { - static::$records['record_' . $i] = static::$records->share(function() use ($logger, $collection, $resolvePathfile, $i) { + static::$records['record_' . $i] = static::$records->share(function() use ($logger, $collection, $resolvePathfile, $i, $core) { PhraseanetPHPUnitAbstract::$recordsInitialized[] = $i; - $file = new Alchemy\Phrasea\Border\File(\MediaVorus\MediaVorus::guess($resolvePathfile($i)), $collection); + $file = new Alchemy\Phrasea\Border\File($core['mediavorus']->guess($resolvePathfile($i)), $collection); $record = record_adapter::createFromFile($file); @@ -757,11 +759,11 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase $collection_no_access = self::$collection_no_access; - static::$records['record_no_access'] = static::$records->share(function()use($collection_no_access) { + static::$records['record_no_access'] = static::$records->share(function()use($collection_no_access, $core) { PhraseanetPHPUnitAbstract::$recordsInitialized[] = 'no_access'; - $file = new Alchemy\Phrasea\Border\File(MediaVorus\MediaVorus::guess(new \SplFileInfo(__DIR__ . '/testfiles/test001.CR2')), $collection_no_access); + $file = new Alchemy\Phrasea\Border\File($core['mediavorus']->guess(new \SplFileInfo(__DIR__ . '/testfiles/test001.CR2')), $collection_no_access); return record_adapter::createFromFile($file); }); diff --git a/tests/collectionTest.php b/tests/collectionTest.php index 165ebb2378..0a0dcd8f71 100644 --- a/tests/collectionTest.php +++ b/tests/collectionTest.php @@ -82,7 +82,7 @@ class collectionTest extends PhraseanetPHPUnitAuthenticatedAbstract public function testGet_record_amount() { self::$object->empty_collection(); - $file = new Alchemy\Phrasea\Border\File(\MediaVorus\MediaVorus::guess(new \SplFileInfo(__DIR__ . '/testfiles/cestlafete.jpg')), self::$object); + $file = new Alchemy\Phrasea\Border\File(self::$core['mediavorus']->guess(new \SplFileInfo(__DIR__ . '/testfiles/cestlafete.jpg')), self::$object); record_adapter::createFromFile($file); $this->assertTrue(self::$object->get_record_amount() === 1); self::$object->empty_collection(); @@ -129,7 +129,7 @@ class collectionTest extends PhraseanetPHPUnitAuthenticatedAbstract public function testGet_record_details() { - $file = new Alchemy\Phrasea\Border\File(\MediaVorus\MediaVorus::guess(new \SplFileInfo(__DIR__ . '/testfiles/cestlafete.jpg')), self::$object); + $file = new Alchemy\Phrasea\Border\File(self::$core['mediavorus']->guess(new \SplFileInfo(__DIR__ . '/testfiles/cestlafete.jpg')), self::$object); $record = record_adapter::createFromFile($file); $details = self::$object->get_record_details(); diff --git a/tests/media/media_subdefTest.php b/tests/media/media_subdefTest.php index 0b244e5497..44e843ce21 100644 --- a/tests/media/media_subdefTest.php +++ b/tests/media/media_subdefTest.php @@ -27,7 +27,8 @@ class media_subdefTest extends \PhraseanetPHPUnitAbstract { parent::setUpBeforeClass(); - $file = new Alchemy\Phrasea\Border\File(\MediaVorus\MediaVorus::guess(new \SplFileInfo(__DIR__ . "/../testfiles/iphone_pic.jpg")), self::$collection); + $mediavorus = new \MediaVorus\MediaVorus(); + $file = new Alchemy\Phrasea\Border\File($mediavorus->guess(new \SplFileInfo(__DIR__ . "/../testfiles/iphone_pic.jpg")), self::$collection); $logger = new \Monolog\Logger('test'); $logger->pushHandler(new \Monolog\Handler\NullHandler()); diff --git a/tests/task/period/task_period_archiveTest.php b/tests/task/period/task_period_archiveTest.php index 8bc80b43e6..6cf9caacf1 100644 --- a/tests/task/period/task_period_archiveTest.php +++ b/tests/task/period/task_period_archiveTest.php @@ -417,7 +417,7 @@ class task_period_archiveTest extends \PhraseanetPHPUnitAbstract public function testGetIndexByFieldName() { $meta_struct = self::$collection->get_databox()->get_meta_structure(); - $media = \MediaVorus\MediaVorus::guess(new \SplFileInfo(__DIR__ . '/../../testfiles/test001.CR2')); + $media = self::$core['mediavorus']->guess(new \SplFileInfo(__DIR__ . '/../../testfiles/test001.CR2')); $bagByName = self::$object->getIndexByFieldNameTester($meta_struct, $media->getEntity()->getMetadatas());