Example #1
0
 public function getServiceConfig()
 {
     return ['aliases' => ['dms.service' => \Dms\Service\DmsService::class, 'dms.manager' => \Dms\Document\Manager::class, 'Base64Coding' => 'BaseCoding', 'UrlCoding' => \Dms\Coding\Url\Url::class, 'Resize' => \Dms\Resize\Resize::class, 'Storage' => \Dms\Storage\Storage::class], 'invokables' => ['BaseCoding' => \Dms\Coding\Base\Base::class, 'GzipCoding' => \Dms\Coding\Gzip\Gzip::class, 'ZlibCoding' => \Dms\Coding\Zlib\Zlib::class], 'abstract_factories' => [\Dms\ServiceFactory\CodingFactory::class], 'factories' => [\Dms\Coding\Url\Url::class => function ($container) {
         $config = $container->get('Config');
         $url = new Url();
         $url->setAdapter($config[$config['dms-conf']['adapter']]);
         return $url;
     }, \Dms\Resize\Resize::class => function ($container) {
         $config = $container->get('config')['dms-conf'];
         return new Resize(['allow' => $config['size_allowed'], 'active' => $config['check_size_allowed']]);
     }, \Dms\Storage\Storage::class => function ($container) {
         $config = $container->get('config')['dms-conf'];
         return new Storage(['path' => $config['default_path'], 'storage' => $config['storage']]);
     }, \Dms\Document\Manager::class => function ($container) {
         $config = $container->get('config')['dms-conf'];
         return new Manager($config, $container);
     }, \Dms\Service\DmsService::class => function ($container) {
         $config = $container->get('config')['dms-conf'];
         return new DmsService($container->get(\Dms\Document\Manager::class), $config);
     }]];
 }
Example #2
0
 public function testCanGetNameCoding()
 {
     $coding = new Url();
     $name = $coding->getCoding();
     $this->assertEquals($name, Url::CODING_URL_STR);
 }