Example #1
0
 protected function setUp()
 {
     $this->categoryMock = $this->getMockBuilder(CategoryModel::class)->disableOriginalConstructor()->getMock();
     $this->categoryResourceMock = $this->getMockBuilder(CategoryResourceModel::class)->disableOriginalConstructor()->getMock();
     $connection = $this->getMockBuilder(AdapterInterface::class)->disableOriginalConstructor()->getMockForAbstractClass();
     $this->categoryResourceMock->method('getConnection')->willReturn($connection);
     $this->indexerMock = $this->getMockBuilder(IndexerInterface::class)->disableOriginalConstructor()->setMethods(['getId', 'getState', '__wakeup'])->getMockForAbstractClass();
     $this->indexerRegistryMock = $this->getMockBuilder(IndexerRegistry::class)->disableOriginalConstructor()->setMethods(['get'])->getMock();
     $this->proceed = function () {
         return $this->categoryResourceMock;
     };
     $this->model = (new ObjectManager($this))->getObject(CategoryPlugin::class, ['indexerRegistry' => $this->indexerRegistryMock]);
 }