当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_MockObject_MockObject::load方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_MockObject_MockObject::load方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_MockObject_MockObject::load方法的具体用法?PHP PHPUnit_Framework_MockObject_MockObject::load怎么用?PHP PHPUnit_Framework_MockObject_MockObject::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_MockObject_MockObject的用法示例。


在下文中一共展示了PHPUnit_Framework_MockObject_MockObject::load方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testLoadNotFound

 /**
  * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException
  */
 public function testLoadNotFound()
 {
     $statement = $this->createDbalStatementMock();
     $statement->expects($this->once())->method('rowCount')->will($this->returnValue(0));
     $this->dbalMock->expects($this->once())->method('prepare')->with($this->anything())->will($this->returnValue($statement));
     $this->handler->load('prefix/my/file.png');
 }
开发者ID:blankse,项目名称:ezpublish-kernel-1,代码行数:10,代码来源:LegacyDFSClusterTest.php

示例2: testLoadWithoutExchangeRateProviders

 /**
  * @covers ::load
  */
 public function testLoadWithoutExchangeRateProviders()
 {
     $sourceCurrencyCode = 'foo';
     $destinationCurrencyCode = 'bar';
     $this->sut->expects($this->atLeastOnce())->method('getExchangeRateProviders')->willReturn([]);
     $this->assertnull($this->sut->load($sourceCurrencyCode, $destinationCurrencyCode));
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:10,代码来源:AbstractStackedExchangeRateProviderTest.php

示例3: testLoad

 public function testLoad()
 {
     $translator = $this->getMockBuilder('Symfony\\Component\\Translation\\TranslatorInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerInterface')->disableOriginalConstructor()->setMethods(array('get'))->getMockForAbstractClass();
     $container->expects($this->once())->method('get')->with('translator')->will($this->returnValue($translator));
     $objectManager = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ObjectManager')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->fixture->expects($this->once())->method('loadEntities')->with($objectManager);
     $this->fixture->setContainer($container);
     $this->fixture->load($objectManager);
     $this->assertAttributeEquals($translator, 'translator', $this->fixture);
 }
开发者ID:Maksold,项目名称:platform,代码行数:11,代码来源:AbstractTranslatableEntityFixtureTest.php

示例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
  * @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);
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:41,代码来源:TemplateTest.php

示例5: testGetCurrentUrl

 public function testGetCurrentUrl()
 {
     $this->model->load('admin');
     $this->model->expects($this->any())->method('getUrl')->will($this->returnValue('http://localhost/index.php'));
     $this->assertStringEndsWith('default', $this->model->getCurrentUrl());
     $this->assertStringEndsNotWith('default', $this->model->getCurrentUrl(false));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:StoreTest.php

示例6: testIsCanDelete

 public function testIsCanDelete()
 {
     $this->assertFalse($this->_model->isCanDelete());
     $this->_model->load(1);
     $this->assertFalse($this->_model->isCanDelete());
     $this->_model->setId(100);
     $this->assertTrue($this->_model->isCanDelete());
 }
开发者ID:relue,项目名称:magento2,代码行数:8,代码来源:StoreTest.php

示例7: 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);
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:34,代码来源:TemplateTest.php

示例8: loadIndexer

 /**
  * @param $indexId
  */
 protected function loadIndexer($indexId)
 {
     $this->configMock->expects($this->once())->method('getIndexer')->with($indexId)->will($this->returnValue($this->getIndexerData()));
     $this->model->load($indexId);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:8,代码来源:IndexerTest.php

示例9: testLoadNotFound

 /**
  * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException
  */
 public function testLoadNotFound()
 {
     $this->filesystem->expects($this->once())->method('getMetadata')->with('prefix/my/file.png')->will($this->throwException(new FileNotFoundException('prefix/my/file.png')));
     $this->handler->load('prefix/my/file.png');
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:8,代码来源:FlysystemTest.php

示例10: testLoadWithInvalidPrimaryKey

 /**
  * Test if the load() method returns the NULL for an invalid primary key.
  *
  * @return null
  */
 public function testLoadWithInvalidPrimaryKey()
 {
     $this->assertNull($this->service->load('invalidPrimaryKey'));
 }
开发者ID:jinchunguang,项目名称:appserver,代码行数:9,代码来源:DatasourceServiceTest.php


注:本文中的PHPUnit_Framework_MockObject_MockObject::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。