public function testGzShouldBePreferredOverZipEvenWhenRepeated() { $files = [new File('test.zip', new Format\FormatChain([new Format\Simple\Zip()])), new File('test.tgz', new Format\FormatChain([new Format\Composed\TarGz()])), new File('test.tar.gz', new Format\FormatChain([new Format\Composed\TarGz()]))]; $preferredFiles = $this->strategy->getPreferredFilesOrdered($files, []); $this->assertInstanceOf('\\Distill\\Format\\Composed\\TarGz', $preferredFiles[0]->getFormatChain()->getChainFormats()[0]); array_reverse($files); $preferredFiles = $this->strategy->getPreferredFilesOrdered($files, []); $this->assertInstanceOf('\\Distill\\Format\\Composed\\TarGz', $preferredFiles[0]->getFormatChain()->getChainFormats()[0]); }
protected function registerStrategies(Container $container) { $container['distill.strategy.' . Strategy\MinimumSize::getName()] = $container->factory(function ($c) { return new Strategy\MinimumSize(); }); $container['distill.strategy.' . Strategy\UncompressionSpeed::getName()] = $container->factory(function ($c) { return new Strategy\UncompressionSpeed(); }); $container['distill.strategy.' . Strategy\Random::getName()] = $container->factory(function ($c) { return new Strategy\Random(); }); }