Skip to content

Commit 7ab3c48

Browse files
author
Serhiy Shkolyarenko
committed
MAGETWO-39117: Updating qty that exceeds the qty in stock for registered customer by API should return error
removed unused code added unit test
1 parent 6c9de3f commit 7ab3c48

File tree

3 files changed

+56
-44
lines changed

3 files changed

+56
-44
lines changed

lib/internal/Magento/Framework/Exception/CouldNotSaveMultiMessageException.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

lib/internal/Magento/Framework/Message/PhraseFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace Magento\Framework\Message;
77

88
use Magento\Framework\Phrase;
9-
use Magento\Framework\Message\MessageInterface;
109

1110
/**
1211
* Factory to combine several messages into one
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Framework\Test\Unit\Message;
7+
8+
use Magento\Framework\Message\PhraseFactory;
9+
use Magento\Framework\Message\Error;
10+
11+
class PhraseFactoryTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/**
14+
* @var PhraseFactory
15+
*/
16+
private $factory;
17+
18+
protected function setUp()
19+
{
20+
$this->factory = new PhraseFactory();
21+
}
22+
23+
/**
24+
* @dataProvider dataProvider
25+
* @param string $mainMessage
26+
* @param array $subMessages
27+
* @param string $separator
28+
* @param string $expectedResult
29+
*/
30+
public function testCreate($mainMessage, $subMessages, $separator, $expectedResult)
31+
{
32+
$result = (string)$this->factory->create($mainMessage, $subMessages, $separator);
33+
$this->assertEquals($expectedResult, $result);
34+
}
35+
36+
public function dataProvider()
37+
{
38+
$subMessage1 = new Error('go jogging');
39+
$subMessage2 = new Error('paint the wall');
40+
return [
41+
'positive case' => [
42+
'We will %1',
43+
[$subMessage1, $subMessage2],
44+
' and ',
45+
'We will go jogging and paint the wall',
46+
],
47+
'broken messages' => [
48+
'We will %1',
49+
[$subMessage1, 'paint the wall'],
50+
' and ',
51+
'We will go jogging and Cannot render error message!',
52+
],
53+
];
54+
}
55+
56+
}

0 commit comments

Comments
 (0)