本文整理汇总了PHP中PHPUnit_Framework_MockObject_MockObject::loadDefault方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_MockObject_MockObject::loadDefault方法的具体用法?PHP PHPUnit_Framework_MockObject_MockObject::loadDefault怎么用?PHP PHPUnit_Framework_MockObject_MockObject::loadDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_MockObject_MockObject
的用法示例。
在下文中一共展示了PHPUnit_Framework_MockObject_MockObject::loadDefault方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLoadDefault
public function testLoadDefault()
{
$this->_model->loadDefault('customer_create_account_email_template');
$this->assertNotEmpty($this->_model->getTemplateText());
$this->assertNotEmpty($this->_model->getTemplateSubject());
$this->assertNotEmpty($this->_model->getOrigTemplateVariables());
$this->assertInternalType('array', \Zend_Json::decode($this->_model->getOrigTemplateVariables()));
$this->assertNotEmpty($this->_model->getTemplateStyles());
}
示例2: testLoadDefault
/**
* @magentoAppIsolation enabled
*/
public function testLoadDefault()
{
Mage::app()->getConfig()->getOptions()->setLocaleDir(dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'locale');
$this->_model->loadDefault('customer_create_account_email_template');
$this->assertNotEmpty($this->_model->getTemplateText());
$this->assertNotEmpty($this->_model->getTemplateSubject());
$this->assertNotEmpty($this->_model->getOrigTemplateVariables());
$this->assertInternalType('array', Zend_Json::decode($this->_model->getOrigTemplateVariables()));
$this->assertNotEmpty($this->_model->getTemplateStyles());
}
示例3: testTemplateStylesVariable
/**
* Ensure that the template_styles variable contains styles from either <!--@styles @--> or the "Template Styles"
* textarea in backend, depending on whether template was loaded from filesystem or DB.
*
* @magentoDataFixture Magento/Store/_files/core_fixturestore.php
* @magentoComponentsDir Magento/Email/Model/_files/design
* @magentoAppIsolation enabled
* @magentoDbIsolation enabled
* @dataProvider templateStylesVariableDataProvider
*
* @param string $area
* @param string $expectedOutput
* @param array $unexpectedOutputs
* @param array $templateForDatabase
*/
public function testTemplateStylesVariable($area, $expectedOutput, $unexpectedOutputs, $templateForDatabase = [])
{
if (count($templateForDatabase)) {
$this->mockModel();
$this->setUpThemeFallback($area);
$template = $this->objectManager->create('Magento\\Email\\Model\\Template');
$template->setData($templateForDatabase);
$template->save();
$templateId = $template->getId();
$this->model->load($templateId);
} else {
// <!--@styles @--> parsing only via the loadDefault method. Since email template files won't contain
// @styles comments by default, it is necessary to mock an object to return testable contents
$themeDirectory = $this->getMockBuilder('Magento\\Framework\\Filesystem\\Directory\\ReadInterface')->disableOriginalConstructor()->setMethods(['readFile'])->getMockForAbstractClass();
$themeDirectory->expects($this->once())->method('readFile')->will($this->returnValue('<!--@styles p { color: #111; } @--> {{var template_styles}}'));
$filesystem = $this->getMockBuilder('\\Magento\\Framework\\Filesystem')->disableOriginalConstructor()->setMethods(['getDirectoryRead'])->getMock();
$filesystem->expects($this->once())->method('getDirectoryRead')->with(DirectoryList::ROOT)->will($this->returnValue($themeDirectory));
$this->mockModel($filesystem);
$this->model->loadDefault('design_email_header_template');
}
$processedTemplate = $this->model->getProcessedTemplate();
foreach ($unexpectedOutputs as $unexpectedOutput) {
$this->assertNotContains($unexpectedOutput, $processedTemplate);
}
$this->assertContains($expectedOutput, $processedTemplate);
}
示例4: testTemplateStylesVariable
/**
* Ensure that the template_styles variable contains styles from either <!--@styles @--> or the "Template Styles"
* textarea in backend, depending on whether template was loaded from filesystem or DB.
*
* @magentoDataFixture Magento/Store/_files/core_fixturestore.php
* @magentoDataFixture Magento/Email/Model/_files/design/themes.php
* @magentoAppIsolation enabled
* @dataProvider templateStylesVariableDataProvider
*
* @param string $area
* @param string $expectedOutput
* @param array $unexpectedOutputs
* @param array $templateForDatabase
*/
public function testTemplateStylesVariable($area, $expectedOutput, $unexpectedOutputs, $templateForDatabase = [])
{
$this->_mockModel($this->_getMockedFilesystem());
$this->setUpThemeFallback($area);
if (count($templateForDatabase)) {
$template = $this->_objectManager->create('Magento\\Email\\Model\\Template');
$template->setData($templateForDatabase);
$template->save();
$templateId = $template->getId();
$this->_model->load($templateId);
} else {
// <!--@styles @--> parsing only happens when template is loaded from filesystem
$this->_model->loadDefault('design_email_header_template');
}
$processedTemplate = $this->_model->getProcessedTemplate();
foreach ($unexpectedOutputs as $unexpectedOutput) {
$this->assertNotContains($unexpectedOutput, $processedTemplate);
}
$this->assertContains($expectedOutput, $processedTemplate);
}
示例5: testGetPreparedTemplateText
public function testGetPreparedTemplateText()
{
$this->_model->loadDefault('customer_create_account_email_template');
$this->assertContains('<body style', $this->_model->getPreparedTemplateText());
}