Skip to content

Commit 08daad8

Browse files
committed
MAGETWO-99111: Payment Method Not Showing Admin Sales Grid only check method showing
1 parent 08ecfe1 commit 08daad8

File tree

1 file changed

+38
-45
lines changed

1 file changed

+38
-45
lines changed

app/code/Magento/Payment/Test/Unit/Helper/DataTest.php

Lines changed: 38 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
namespace Magento\Payment\Test\Unit\Helper;
88

9-
use \Magento\Payment\Helper\Data;
10-
119
use Magento\Framework\TestFramework\Unit\Matcher\MethodInvokedAtIndex;
10+
use Magento\Payment\Helper\Data;
11+
use Magento\Store\Model\ScopeInterface;
1212

1313
class DataTest extends \PHPUnit\Framework\TestCase
1414
{
@@ -37,6 +37,9 @@ class DataTest extends \PHPUnit\Framework\TestCase
3737
*/
3838
private $appEmulation;
3939

40+
/**
41+
* @inheritDoc
42+
*/
4043
protected function setUp()
4144
{
4245
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
@@ -57,6 +60,9 @@ protected function setUp()
5760
$this->helper = $objectManagerHelper->getObject($className, $arguments);
5861
}
5962

63+
/**
64+
* @return void
65+
*/
6066
public function testGetMethodInstance()
6167
{
6268
list($code, $class, $methodInstance) = ['method_code', 'method_class', 'method_instance'];
@@ -170,6 +176,9 @@ public function testSortMethods(array $methodA, array $methodB)
170176
);
171177
}
172178

179+
/**
180+
* @return void
181+
*/
173182
public function testGetMethodFormBlock()
174183
{
175184
list($blockType, $methodCode) = ['method_block_type', 'method_code'];
@@ -195,6 +204,9 @@ public function testGetMethodFormBlock()
195204
$this->assertSame($blockMock, $this->helper->getMethodFormBlock($methodMock, $layoutMock));
196205
}
197206

207+
/**
208+
* @return void`
209+
*/
198210
public function testGetInfoBlock()
199211
{
200212
$blockType = 'method_block_type';
@@ -220,6 +232,9 @@ public function testGetInfoBlock()
220232
$this->assertSame($blockMock, $this->helper->getInfoBlock($infoMock));
221233
}
222234

235+
/**
236+
* @return void
237+
*/
223238
public function testGetInfoBlockHtml()
224239
{
225240
list($storeId, $blockHtml, $secureMode, $blockType) = [1, 'HTML MARKUP', true, 'method_block_type'];
@@ -257,6 +272,23 @@ public function testGetInfoBlockHtml()
257272
$this->assertEquals($blockHtml, $this->helper->getInfoBlockHtml($infoMock, $storeId));
258273
}
259274

275+
/**
276+
* @return array
277+
*/
278+
public function getSortMethodsDataProvider()
279+
{
280+
return [
281+
[
282+
['code' => 'methodA', 'data' => ['sort_order' => 0]],
283+
['code' => 'methodB', 'data' => ['sort_order' => 1]]
284+
],
285+
[
286+
['code' => 'methodA', 'data' => ['sort_order' => 2]],
287+
['code' => 'methodB', 'data' => ['sort_order' => 1]],
288+
]
289+
];
290+
}
291+
260292
/**
261293
* @param bool $sorted
262294
* @param bool $asLabelValue
@@ -288,17 +320,10 @@ public function testGetPaymentMethodList(
288320
]
289321
);
290322

323+
$titlePath = sprintf('%s/%s/title', Data::XML_PATH_PAYMENT_METHODS, $paymentMethod['code']);
291324
$this->scopeConfig->method('getValue')
292-
->with(sprintf('%s/%s/model', Data::XML_PATH_PAYMENT_METHODS, $paymentMethod['code']))
293-
->willReturn(\Magento\Payment\Model\Method\AbstractMethod::class);
294-
295-
$methodInstanceMock = $this->getMockBuilder(\Magento\Payment\Model\MethodInterface::class)
296-
->getMockForAbstractClass();
297-
$methodInstanceMock->method('getConfigData')
298-
->with('title', null)
325+
->with($titlePath, ScopeInterface::SCOPE_STORE, null)
299326
->willReturn($configTitle);
300-
$this->methodFactory->method('create')
301-
->willReturn($methodInstanceMock);
302327

303328
$this->paymentConfig->method('getGroups')
304329
->willReturn($groups);
@@ -307,23 +332,6 @@ public function testGetPaymentMethodList(
307332
$this->assertEquals($expectedPaymentMethodList, $paymentMethodList);
308333
}
309334

310-
/**
311-
* @return array
312-
*/
313-
public function getSortMethodsDataProvider()
314-
{
315-
return [
316-
[
317-
['code' => 'methodA', 'data' => ['sort_order' => 0]],
318-
['code' => 'methodB', 'data' => ['sort_order' => 1]]
319-
],
320-
[
321-
['code' => 'methodA', 'data' => ['sort_order' => 2]],
322-
['code' => 'methodB', 'data' => ['sort_order' => 1]],
323-
]
324-
];
325-
}
326-
327335
/**
328336
* @return array
329337
*/
@@ -345,27 +353,12 @@ public function paymentMethodListDataProvider(): array
345353
],
346354
['payment_method' => 'Config Payment Title'],
347355
],
348-
'Payment method with default title' =>
349-
[
350-
true,
351-
false,
352-
false,
353-
null,
354-
[
355-
'code' => 'payment_method',
356-
'data' => [
357-
'active' => 1,
358-
'title' => 'Payment Title',
359-
],
360-
],
361-
['payment_method' => 'Payment Title'],
362-
],
363356
'Payment method as value => label' =>
364357
[
365358
true,
366359
true,
367360
false,
368-
null,
361+
'Payment Title',
369362
[
370363
'code' => 'payment_method',
371364
'data' => [
@@ -385,7 +378,7 @@ public function paymentMethodListDataProvider(): array
385378
true,
386379
true,
387380
true,
388-
null,
381+
'Payment Title',
389382
[
390383
'code' => 'payment_method',
391384
'data' => [

0 commit comments

Comments
 (0)