本文整理汇总了PHP中Mage::clearRegistry方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::clearRegistry方法的具体用法?PHP Mage::clearRegistry怎么用?PHP Mage::clearRegistry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::clearRegistry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetFirstStoreId
/**
* Test getting first store in ordered stores
*
* @return void
*/
public function testGetFirstStoreId()
{
$data = $this->_getFixtureData();
foreach ($data['stores'] as &$item) {
$dataItem = $item;
$item = $this->getMock('Varien_Object', array('initConfigCache'));
$item->setData($dataItem);
$item->expects($this->any())->method('initConfigCache')->will($this->returnValue($item));
}
unset($item);
$list = array('websites' => 'core/website', 'groups' => 'core/store_group', 'stores' => 'core/store');
$callback = array('websites' => 'getWebsiteById', 'groups' => 'getStoreGroupById', 'stores' => 'getStoreById');
foreach ($list as $key => $model) {
$collection = $this->mockCollection($model, $data[$key], array('initCache', 'count', 'load', 'getItemById'));
$collection->expects($this->any())->method('initCache')->will($this->returnValue($collection));
$collection->expects($this->any())->method('count')->will($this->returnValue(count($data[$key])));
$collection->expects($this->any())->method('load')->will($this->returnValue($collection));
$collection->expects($this->any())->method('getItemById')->will($this->returnCallback(array($this, $callback[$key])));
$this->_collections[$key] = $collection;
}
Mage::app()->reinitStores();
$result = 100;
$this->assertEquals($result, $this->_object->getFirstStoreId());
//TODO remove reinit store and DB usage
Mage::clearRegistry();
Mage::app()->reinitStores();
}
示例2: tearDown
/**
* Clear registry on end test
*
* @return void
*/
public function tearDown()
{
/**
* Clear all registry with mock data
*/
Mage::clearRegistry();
parent::tearDown();
}
示例3: testGetChannel
public function testGetChannel()
{
Mage::clearRegistry();
$this->assertNull($this->_object->getChannel());
Mage::register('current_channel', new Varien_Object());
$result = $this->_object->getChannel();
$this->assertNotEmpty($result);
$this->assertInstanceOf('Varien_Object', $result);
Mage::clearRegistry();
}
示例4: testGetValidatedAtText
public function testGetValidatedAtText()
{
$validatedAt = date('Y-m-d');
Mage::clearRegistry();
Mage::register('current_account', new Varien_Object(array('validated_at' => $validatedAt)));
$result = $this->_object->getValidatedAtText();
$this->assertEquals("Valid Authorization Token.<br/>Valid until {$validatedAt}", $result);
Mage::clearRegistry();
Mage::register('current_account', new Varien_Object(array('validation_expired' => 1)));
$result = $this->_object->getValidatedAtText();
$this->assertEquals('<span class="error">Expired</span>', $result);
}
示例5: testGetChannelType
public function testGetChannelType()
{
Mage::clearRegistry();
Mage::register('current_channel', new Varien_Object(array('channeltype_code' => 'test_channeltype_code')));
$result = $this->object->getChannelType();
$this->assertInstanceOf('Varien_Object', $result);
$this->assertFalse($result->hasData());
$channel = Mage::getModel('xcom_ebay/channel');
$channel->setId(1);
$channel->setName('Ebay US');
$channel->setChanneltypeCode('ebay');
Mage::clearRegistry();
Mage::register('current_channel', $channel);
$result = $this->object->getChannelType();
$this->assertInstanceOf('Varien_Object', $result);
$this->assertTrue($result->hasData());
$this->assertEquals('ebay', $result->getCode());
}
示例6: testGetChannel
public function testGetChannel()
{
$objectMock = $this->getMock('Xcom_Ebay_Block_Adminhtml_Channel_Edit_Tab_Policy', array('_construct'));
$objectMock->expects($this->any())->method('_construct');
Mage::clearRegistry();
$this->assertNull($objectMock->getChannel());
Mage::register('current_channel', new Varien_Object());
$result = $objectMock->getChannel();
$this->assertNotEmpty($result);
$this->assertInstanceOf('Varien_Object', $result);
Mage::clearRegistry();
}