Skip to content

Commit

Permalink
BB-19066: Duplicate files for File attribute\field after imports (#28…
Browse files Browse the repository at this point in the history
…217)

* BB-19385: File URL is invalid because of empty request context in url generator
- added consumption extension to set correct context parameters from the system configuration

* BB-19408: Pre-validation of types of data filled in entity properties (#28102)
- added TypeValidationLoader with tests

* BB-19066: Duplicate files for File attribute\field after imports (#27981)
 - fixed ::cloneFileEntity() does not clear parentEntity* fields
 - fixed product images import is broken
 - fixed cannot reuse digital assets
 - added uuid, uri for file export
 - added headers and file strategy listeners
 - added digital assets aware file strategy listener
 - fixed error in ProductStrategy
 - fixed to-many case in ConfigurableAddOrReplaceStrategy
 - added handling of new entities in FileDigitalAssetChangedListener
 - added migrations
 - added validation rule for UUID

* BB-19592: Field name in email displayed with hash in suffix
 - updated import/export helper to render valid labels for the fields

Co-authored-by: Mykhailo Sulyma <[email protected]>
  • Loading branch information
webevt and Mykhailo Sulyma authored Jul 31, 2020
1 parent eae2d4b commit cb90849
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ public function process(ContainerBuilder $container)

$cacheResolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.default');
$cacheResolverDefinition->replaceArgument(1, new Reference('oro_website.asset.request_context'));

$consumptionExtension = $container->getDefinition('oro_ui.consumption_extension.request_context');
$consumptionExtension->replaceArgument(0, new Reference('oro_website.asset.request_context'));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

namespace Oro\Bundle\WebsiteBundle\Tests\Unit\DependencyInjection\CompilerPass;

use Oro\Bundle\WebsiteBundle\DependencyInjection\CompilerPass\AssetsRouterPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class AssetsRouterPassTest extends \PHPUnit\Framework\TestCase
{
/** @var ContainerBuilder|\PHPUnit\Framework\MockObject\MockObject */
private $containerBuilder;

/** @var AssetsRouterPass */
private $compilerPass;

protected function setUp(): void
{
$this->containerBuilder = $this->createMock(ContainerBuilder::class);

$this->compilerPass = new AssetsRouterPass();
}

public function testProcess(): void
{
$routerDefinition = $this->createMock(Definition::class);
$routerDefinition->expects($this->once())
->method('replaceArgument')
->with(3, new Reference('oro_website.asset.request_context'));

$generatorDefinition = $this->createMock(Definition::class);
$generatorDefinition->expects($this->once())
->method('replaceArgument')
->with(0, new Reference('oro_website.asset.router'));

$cacheManagerDefinition = $this->createMock(Definition::class);
$cacheManagerDefinition->expects($this->once())
->method('replaceArgument')
->with(1, new Reference('oro_website.asset.router'));

$cacheResolverDefinition = $this->createMock(Definition::class);
$cacheResolverDefinition->expects($this->once())
->method('replaceArgument')
->with(1, new Reference('oro_website.asset.request_context'));

$consumptionExtension = $this->createMock(Definition::class);
$consumptionExtension->expects($this->once())
->method('replaceArgument')
->with(0, new Reference('oro_website.asset.request_context'));

$this->containerBuilder->expects($this->any())
->method('getDefinition')
->willReturnMap(
[
['oro_website.asset.router', $routerDefinition],
['oro_attachment.url_generator', $generatorDefinition],
['liip_imagine.cache.manager', $cacheManagerDefinition],
['liip_imagine.cache.resolver.default', $cacheResolverDefinition],
['oro_ui.consumption_extension.request_context', $consumptionExtension],
]
);

$this->compilerPass->process($this->containerBuilder);
}
}

0 comments on commit cb90849

Please sign in to comment.