예제 #1
0
 /**
  * @test
  * @return void
  */
 public function testAfterDelete()
 {
     $expectId = 101;
     $theme = $this->getMockBuilder('Magento\\Framework\\View\\Design\\ThemeInterface')->setMethods(['delete', 'getId'])->getMockForAbstractClass();
     $theme->expects($this->once())->method('getId')->willReturn($expectId);
     $theme->expects($this->once())->method('delete')->willReturnSelf();
     $this->_model->setId(1);
     $this->resourceCollection->expects($this->at(0))->method('addFieldToFilter')->with('parent_id', 1)->willReturnSelf();
     $this->resourceCollection->expects($this->at(1))->method('addFieldToFilter')->with('type', Theme::TYPE_STAGING)->willReturnSelf();
     $this->resourceCollection->expects($this->once())->method('getFirstItem')->willReturn($theme);
     $this->resourceCollection->expects($this->once())->method('updateChildRelations')->with($this->_model);
     $this->assertInstanceOf(get_class($this->_model), $this->_model->afterDelete());
 }