Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ResolutionRulesTest.php
Go to the documentation of this file.
1 <?php
7 
12 
18 class ResolutionRulesTest extends \PHPUnit\Framework\TestCase
19 {
23  protected $resolutionRules;
24 
26  protected $context;
27 
31  protected $readerMock;
32 
38  protected function setUp()
39  {
40  $objectManager = new ObjectManager($this);
41 
42  $this->context = $objectManager->getObject(Context::class);
43 
44  $this->readerMock = $this->getMockBuilder(Reader::class)
45  ->disableOriginalConstructor()
46  ->getMock();
47 
48  $this->resolutionRules = new ResolutionRules(
49  $this->context,
50  $this->readerMock
51  );
52  }
53 
61  public function testGetJson($incoming, $outgoing)
62  {
63  $this->readerMock->expects($this->once())
64  ->method('read')
65  ->willReturn($incoming);
66 
67  $this->assertEquals(
68  $outgoing,
69  $this->resolutionRules->getJson()
70  );
71  }
72 
76  public function getJsonDataProvider()
77  {
78  return [
79  [['test' => 'test-value'], '{"test":"test-value"}'],
80  [[], '{}']
81  ];
82  }
83 }
$objectManager
Definition: bootstrap.php:17