Skip to content

Commit ccb2122

Browse files
ENGCOM-3478: [Backport] Add missing unit test for WishlistSettings plugin #19240
2 parents dce1b71 + 645f4f3 commit ccb2122

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Wishlist\Test\Unit\Plugin\Ui\DataProvider;
9+
10+
use Magento\Catalog\Ui\DataProvider\Product\Listing\DataProvider;
11+
use Magento\Wishlist\Helper\Data;
12+
use Magento\Wishlist\Plugin\Ui\DataProvider\WishlistSettings;
13+
14+
/**
15+
* Covers \Magento\Wishlist\Plugin\Ui\DataProvider\WishlistSettings
16+
*/
17+
class WishlistSettingsTest extends \PHPUnit\Framework\TestCase
18+
{
19+
/**
20+
* Testable Object
21+
*
22+
* @var WishlistSettings
23+
*/
24+
private $wishlistSettings;
25+
26+
/**
27+
* @var Data|\PHPUnit_Framework_MockObject_MockObject
28+
*/
29+
private $helperMock;
30+
31+
/**
32+
* Set Up
33+
*
34+
* @return void
35+
*/
36+
protected function setUp()
37+
{
38+
$this->helperMock = $this->createMock(Data::class);
39+
$this->wishlistSettings = new WishlistSettings($this->helperMock);
40+
}
41+
42+
/**
43+
* Test afterGetData method
44+
*
45+
* @return void
46+
*/
47+
public function testAfterGetData()
48+
{
49+
/** @var DataProvider|\PHPUnit_Framework_MockObject_MockObject $subjectMock */
50+
$subjectMock = $this->createMock(DataProvider::class);
51+
$result = [];
52+
$isAllow = true;
53+
$this->helperMock->expects($this->once())->method('isAllow')->willReturn(true);
54+
55+
$expected = ['allowWishlist' => $isAllow];
56+
$actual = $this->wishlistSettings->afterGetData($subjectMock, $result);
57+
self::assertEquals($expected, $actual);
58+
}
59+
}

0 commit comments

Comments
 (0)