Skip to content

Commit

Permalink
MAGETWO-66480: [GITHUB] URL key for specified store already exists #6671
Browse files Browse the repository at this point in the history


- refactoring
  • Loading branch information
cpartica committed Jun 21, 2017
1 parent df19fed commit 4531b09
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
Expand Up @@ -16,8 +16,6 @@ class UrlRewriteExceptionMessageFactory implements ExceptionMessageFactoryInterf
{
const URL_DUPLICATE_MESSAGE = 'urlDuplicateMessage';

const EXCEPTION_CLASS = UrlAlreadyExistsException::class;

/** @var Factory */
private $messageFactory;

Expand Down
Expand Up @@ -33,7 +33,7 @@ public function __construct(
* @param \Exception $exception
* @return ExceptionMessageFactoryInterface|null
*/
public function getMessageGenerator(\Exception $exception)
public function getMessageFactory(\Exception $exception)
{
if (isset($this->exceptionMessageFactoryMap[get_class($exception)])) {
return $this->exceptionMessageFactoryMap[get_class($exception)];
Expand Down
Expand Up @@ -26,7 +26,7 @@ public function __construct(ExceptionMessageFactoryPool $exceptionMessageFactory
*/
public function createMessage(\Exception $exception, $type = MessageInterface::TYPE_ERROR)
{
$messageGenerator = $this->exceptionMessageFactoryPool->getMessageGenerator($exception);
$messageGenerator = $this->exceptionMessageFactoryPool->getMessageFactory($exception);
return $messageGenerator->createMessage($exception, $type);
}
}
Expand Up @@ -50,7 +50,7 @@ public function testSuccessfulDefaultCreateMessage()
$exception = new \Exception('message');
$this->assertEquals(
$this->defaultExceptionMessageFactoryMock,
$this->exceptionMessageFactoryPool->getMessageGenerator($exception)
$this->exceptionMessageFactoryPool->getMessageFactory($exception)
);
}

Expand All @@ -59,7 +59,7 @@ public function testSuccessfulSpecificCreateMessage()
$localizedException = new LocalizedException(__('message'));
$this->assertEquals(
$this->specificExceptionMessageFactoryPoolMock,
$this->exceptionMessageFactoryPool->getMessageGenerator($localizedException)
$this->exceptionMessageFactoryPool->getMessageFactory($localizedException)
);
}
}
Expand Up @@ -29,7 +29,7 @@ protected function setUp()
{
$this->exceptionMessageFactoryPool = $this->getMock(
\Magento\Framework\Message\ExceptionMessageFactoryPool::class,
['getMessageGenerator'],
['getMessageFactory'],
[],
'',
false
Expand Down Expand Up @@ -58,7 +58,7 @@ public function test()
$this->exceptionMessageFactoryPool->expects(
$this->once()
)->method(
'getMessageGenerator'
'getMessageFactory'
)->with(
$exception
)->will(
Expand Down

0 comments on commit 4531b09

Please sign in to comment.