forked from ezsystems/ezpublish-kernel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ezsystems#1141 from blankse/EZP-23518-fix_alias_cl…
…eaner Fix EZP-23518: Clearing image aliases with Symfony console with --purge ...
- Loading branch information
Showing
4 changed files
with
56 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
eZ/Publish/Core/MVC/Legacy/Tests/Image/AliasCleanerTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* File containing the AliasCleanerTest class. | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
* @version //autogentag// | ||
*/ | ||
namespace eZ\Publish\Core\MVC\Legacy\Tests\Image; | ||
|
||
use eZ\Publish\Core\MVC\Legacy\Image\AliasCleaner; | ||
use PHPUnit_Framework_TestCase; | ||
|
||
class AliasCleanerTest extends PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \eZ\Publish\Core\MVC\Legacy\Image\AliasCleaner | ||
*/ | ||
private $aliasCleaner; | ||
|
||
/** | ||
* @var \eZ\Publish\Core\FieldType\Image\AliasCleanerInterface|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $innerAliasCleaner; | ||
|
||
/** | ||
* @var \eZ\Publish\Core\IO\UrlRedecoratorInterface|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $urlRedecorator; | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->innerAliasCleaner = $this->getMock( 'eZ\Publish\Core\FieldType\Image\AliasCleanerInterface' ); | ||
$this->urlRedecorator = $this->getMock( 'eZ\Publish\Core\IO\UrlRedecoratorInterface' ); | ||
$this->aliasCleaner = new AliasCleaner( $this->innerAliasCleaner, $this->urlRedecorator ); | ||
} | ||
|
||
public function testRemoveAliases() | ||
{ | ||
$originalPath = 'foo/bar/test.jpg'; | ||
|
||
$this->urlRedecorator | ||
->expects( $this->once() ) | ||
->method( 'redecorateFromTarget' ) | ||
->with( $originalPath ); | ||
|
||
$this->innerAliasCleaner | ||
->expects( $this->once() ) | ||
->method( 'removeAliases' ); | ||
|
||
$this->aliasCleaner->removeAliases( $originalPath ); | ||
} | ||
} |