Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
WebsiteManagementTest.php
Go to the documentation of this file.
1 <?php
7 
8 class WebsiteManagementTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $model;
14 
19 
20  protected function setUp()
21  {
22  $this->websitesFactoryMock = $this->createPartialMock(
23  \Magento\Store\Model\ResourceModel\Website\CollectionFactory::class,
24  ['create']
25  );
26  $this->model = new \Magento\Store\Model\WebsiteManagement(
27  $this->websitesFactoryMock
28  );
29  }
30 
31  public function testGetCount()
32  {
33  $websitesMock = $this->createMock(\Magento\Store\Model\ResourceModel\Website\Collection::class);
34 
35  $this->websitesFactoryMock
36  ->expects($this->once())
37  ->method('create')
38  ->willReturn($websitesMock);
39  $websitesMock
40  ->expects($this->once())
41  ->method('getSize')
42  ->willReturn('expected');
43 
44  $this->assertEquals(
45  'expected',
46  $this->model->getCount()
47  );
48  }
49 }