本文整理匯總了PHP中Magento\TestFramework\ObjectManager::removeSharedInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectManager::removeSharedInstance方法的具體用法?PHP ObjectManager::removeSharedInstance怎麽用?PHP ObjectManager::removeSharedInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\TestFramework\ObjectManager
的用法示例。
在下文中一共展示了ObjectManager::removeSharedInstance方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
/**
* Bootstrap application before any test
*/
protected function setUp()
{
$this->_assertSessionErrors = false;
$this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->_objectManager->removeSharedInstance('Magento\\Framework\\App\\ResponseInterface');
$this->_objectManager->removeSharedInstance('Magento\\Framework\\App\\RequestInterface');
}
示例2: testTransDirective
/**
* @param $directive
* @param $translations
* @param $expectedResult
* @internal param $translatorData
* @dataProvider transDirectiveDataProvider
*/
public function testTransDirective($directive, $translations, $expectedResult)
{
$renderer = Phrase::getRenderer();
$translator = $this->getMockBuilder('\\Magento\\Framework\\Translate')->disableOriginalConstructor()->setMethods(['getData'])->getMock();
$translator->expects($this->atLeastOnce())->method('getData')->will($this->returnValue($translations));
$this->_objectManager->addSharedInstance($translator, 'Magento\\Framework\\Translate');
$this->_objectManager->removeSharedInstance('Magento\\Framework\\Phrase\\Renderer\\Translate');
Phrase::setRenderer($this->_objectManager->create('Magento\\Framework\\Phrase\\RendererInterface'));
$this->assertEquals($expectedResult, $this->_model->filter($directive));
Phrase::setRenderer($renderer);
}
示例3: tearDown
protected function tearDown()
{
$this->_objectManager->removeSharedInstance($this->_getReaderClassName());
}
示例4: tearDown
protected function tearDown()
{
$this->_objectManager->removeSharedInstance('Magento\\Framework\\Session\\Config');
}