public function testGetTreeWithNullArguments()
 {
     $rootCategoryId = null;
     $depth = null;
     $category = null;
     $this->categoryRepositoryMock->expects($this->never())->method('get');
     $this->categoryTreeMock->expects($this->once())->method('getRootNode')->with($category)->willReturn(null);
     $this->categoryTreeMock->expects($this->exactly(2))->method('getTree')->with($category, $depth);
     $this->assertEquals($this->model->getTree($rootCategoryId, $depth), $this->categoryTreeMock->getTree(null, null));
 }
 /**
  * Check is possible to get all categories for all store starting from top level root category
  */
 public function testGetTreeForAllScope()
 {
     $rootCategoryId = null;
     $depth = null;
     $category = null;
     $categoriesMock = $this->getMock('\\Magento\\Catalog\\Model\\ResourceModel\\Category\\Collection', [], [], '', false);
     $categoryMock = $this->getMock('\\Magento\\Catalog\\Model\\Category', [], [], 'categoryMock', false);
     $categoriesMock->expects($this->once())->method('getFirstItem')->willReturn($categoryMock);
     $categoriesMock->expects($this->once())->method('addFilter')->with('level', ['eq' => 0])->willReturnSelf();
     $this->categoriesFactoryMock->expects($this->once())->method('create')->willReturn($categoriesMock);
     $nodeMock = $this->getMock('\\Magento\\Framework\\Data\\Tree\\Node', [], [], '', false);
     $this->categoryTreeMock->expects($this->once())->method('getTree')->with($nodeMock, $depth);
     $this->categoryRepositoryMock->expects($this->never())->method('get');
     $this->categoryTreeMock->expects($this->once())->method('getRootNode')->with($categoryMock)->willReturn($nodeMock);
     $this->scopeResolverMock->expects($this->once())->method('getScope')->willReturn($this->scopeMock);
     $this->scopeMock->expects($this->once())->method('getCode')->willReturn(\Magento\Store\Model\Store::ADMIN_CODE);
     $this->model->getTree();
 }