Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AccountsTest.php
Go to the documentation of this file.
1 <?php
8 
12 
14 {
18  protected $accounts;
19 
23  protected function setUp()
24  {
25  parent::setUp();
26 
27  $this->accounts = new Accounts(
28  $this->contextMock,
29  $this->fileFactoryMock
30  );
31  }
32 
36  public function testExecute()
37  {
38  $titleMock = $this->getMockBuilder(\Magento\Framework\View\Page\Title::class)
39  ->disableOriginalConstructor()
40  ->getMock();
41  $titleMock
42  ->expects($this->once())
43  ->method('prepend')
44  ->with(new Phrase('New Accounts Report'));
45 
46  $this->viewMock
47  ->expects($this->any())
48  ->method('getPage')
49  ->willReturn(
50  new DataObject(
51  ['config' => new DataObject(
52  ['title' => $titleMock]
53  )]
54  )
55  );
56 
57  $this->menuBlockMock
58  ->expects($this->once())
59  ->method('setActive')
60  ->with('Magento_Reports::report_customers_accounts');
61  $this->breadcrumbsBlockMock
62  ->expects($this->at(0))
63  ->method('addLink')
64  ->with(new Phrase('Reports'), new Phrase('Reports'));
65  $this->breadcrumbsBlockMock
66  ->expects($this->at(1))
67  ->method('addLink')
68  ->with(new Phrase('Customers'), new Phrase('Customers'));
69  $this->breadcrumbsBlockMock
70  ->expects($this->at(2))
71  ->method('addLink')
72  ->with(new Phrase('New Accounts'), new Phrase('New Accounts'));
73  $this->accounts->execute();
74  }
75 }