/** * @param bool $isObjectNew * @param int $invalidateCounter * @return void * @dataProvider aroundSaveDataProvider */ public function testAroundSave($isObjectNew, $invalidateCounter) { $viewMock = $this->getMock('Magento\\Store\\Model\\Store', ['dataHasChangedFor', 'isObjectNew', '__wakeup'], [], '', false); $viewMock->expects($this->once())->method('isObjectNew')->will($this->returnValue($isObjectNew)); $closureMock = function (\Magento\Store\Model\Store $object) use($viewMock) { $this->assertEquals($object, $viewMock); return $this->subjectMock; }; $this->indexerMock->expects($this->exactly($invalidateCounter))->method('getId')->will($this->returnValue(1)); $this->indexerMock->expects($this->exactly($invalidateCounter))->method('invalidate'); $this->assertEquals($this->subjectMock, $this->model->aroundSave($this->subjectMock, $closureMock, $viewMock)); }