Exemple #1
0
 public function testExecuteNoPopup()
 {
     $attributesData = ['frontend_label' => ''];
     $this->request->expects($this->any())->method('getParam')->willReturnMap([['attribute_id', null, null], ['attribute', null, $attributesData], ['popup', null, false]]);
     $this->objectManagerMock->expects($this->any())->method('create')->with('Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute')->willReturn($this->eavAttribute);
     $this->objectManagerMock->expects($this->any())->method('get')->with('Magento\\Backend\\Model\\Session')->willReturn($this->session);
     $this->eavAttribute->expects($this->once())->method('setEntityTypeId')->willReturnSelf();
     $this->eavAttribute->expects($this->once())->method('addData')->with($attributesData)->willReturnSelf();
     $this->registry->expects($this->any())->method('register')->with('entity_attribute', $this->eavAttribute);
     $this->resultPage->expects($this->any())->method('addBreadcrumb')->willReturnSelf();
     $this->resultPage->expects($this->once())->method('setActiveMenu')->with('Magento_Catalog::catalog_attributes_attributes')->willReturnSelf();
     $this->resultPage->expects($this->any())->method('getConfig')->willReturn($this->pageConfig);
     $this->resultPage->expects($this->once())->method('getLayout')->willReturn($this->layout);
     $this->resultPageFactory->expects($this->atLeastOnce())->method('create')->willReturn($this->resultPage);
     $this->pageConfig->expects($this->any())->method('getTitle')->willReturn($this->pageTitle);
     $this->pageTitle->expects($this->any())->method('prepend')->willReturnSelf();
     $this->eavAttribute->expects($this->any())->method('getName')->willReturn(null);
     $this->layout->expects($this->once())->method('getBlock')->willReturn($this->blockTemplate);
     $this->blockTemplate->expects($this->any())->method('setIsPopup')->willReturnSelf();
     $this->assertSame($this->resultPage, $this->editController->executeInternal());
 }