php Magento-TestFramework-Helper-ObjectManager类(方法)实例源码

下面列出了php Magento-TestFramework-Helper-ObjectManager 类(方法)源码代码实例,从而了解它的用法。

作者:ViniciusAugust    项目:magento   
public function setUp()
 {
     $this->customerFactory = $this->getMockBuilder('Magento\\Customer\\Model\\CustomerFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $objectManager = new ObjectManager($this);
     $this->customerRegistry = $objectManager->getObject('Magento\\Customer\\Model\\CustomerRegistry', ['customerFactory' => $this->customerFactory]);
     $this->customer = $this->getMockBuilder('Magento\\Customer\\Model\\Customer')->disableOriginalConstructor()->setMethods(['load', 'getId', 'getEmail', 'getWebsiteId', '__wakeup', 'setEmail', 'setWebsiteId', 'loadByEmail'])->getMock();
 }

作者:buskamuz    项目:magento2-skeleto   
protected function setUp()
 {
     $helper = new ObjectManager($this);
     $this->documentFactory = $this->getMockBuilder('Magento\\Framework\\Search\\Adapter\\Mysql\\DocumentFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->objectManager = $this->getMockBuilder('\\Magento\\Framework\\ObjectManager')->setMethods(['create'])->disableOriginalConstructor()->getMockForAbstractClass();
     $this->factory = $helper->getObject('Magento\\Framework\\Search\\Adapter\\Mysql\\ResponseFactory', ['documentFactory' => $this->documentFactory, 'objectManager' => $this->objectManager]);
 }


问题


面经


文章

微信
公众号

扫码关注公众号