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


PHP PHPUnit_Framework_MockObject_MockObject::__construct方法代码示例

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


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

示例1: testNotSettingApiKeyGivesException

 /**
  * @expectedException Mollie_API_Exception
  * @expectedExceptionMessage You have not set an API key. Please use setApiKey() to set the API key.
  */
 public function testNotSettingApiKeyGivesException()
 {
     $this->api = $this->getMock("Mollie_API_Client", array('getCompatibilityChecker'), array(), '', FALSE);
     $this->api->expects($this->any())->method("getCompatibilityChecker")->will($this->returnValue($this->compatibilityChecker));
     $this->api->__construct();
     $this->api->payments->all();
 }
开发者ID:jesperveldhuizen,项目名称:mollie-api-php,代码行数:11,代码来源:apiUnitTest.php

示例2: constructorRemovesExpiredLockFiles

 /**
  * @test
  */
 public function constructorRemovesExpiredLockFiles()
 {
     $this->mockLockFlagFile->lastModified(time() - (LockManager::LOCKFILE_MAXIMUM_AGE + 1));
     $this->assertFileExists($this->mockLockFile->url());
     $this->assertFileExists($this->mockLockFlagFile->url());
     $this->lockManager->__construct();
     $this->assertFileNotExists($this->mockLockFile->url());
     $this->assertFileNotExists($this->mockLockFlagFile->url());
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:12,代码来源:LockManagerTest.php

示例3: getCacheIdentifierReturnsValidIdentifierWithCommasInMountPointParameter

 /**
  * @test
  */
 public function getCacheIdentifierReturnsValidIdentifierWithCommasInMountPointParameter()
 {
     /** @var \TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend $cacheFrontendMock */
     $cacheFrontendMock = $this->getMockForAbstractClass(\TYPO3\CMS\Core\Cache\Frontend\AbstractFrontend::class, array(), '', false);
     $this->pageContextMock->sys_language_uid = 8;
     $this->pageContextMock->versioningWorkspaceId = 15;
     $this->pageContextMock->versioningPreview = true;
     $this->subject->__construct(42, '47-11,48-12', $this->pageContextMock);
     $this->assertTrue($cacheFrontendMock->isValidEntryIdentifier($this->subject->getCacheIdentifier()));
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:13,代码来源:RootlineUtilityTest.php

示例4: _injectApplicationMock

 /**
  * @param array $fixtureSettings
  * @return \Magento\TestFramework\Application|PHPUnit_Framework_MockObject_MockObject
  */
 protected function _injectApplicationMock(array $fixtureSettings = array())
 {
     $fixtureSettings += $this->_requiredSettings;
     $application = $this->getMock('Magento\\TestFramework\\Application', array('cleanup', 'isInstalled', 'initialize', 'install'), array(), '', false);
     $settings = new \Magento\TestFramework\Bootstrap\Settings($this->_integrationTestsDir, $fixtureSettings);
     // prevent calling the constructor because of mocking the method it invokes
     $this->_object = $this->getMock('Magento\\TestFramework\\Bootstrap', array('_createApplication', '_createMemoryBootstrap'), array(), '', false);
     $this->_object->expects($this->any())->method('_createApplication')->will($this->returnValue($application));
     // invoke the constructor explicitly
     $this->_object->__construct($settings, $this->_envBootstrap, $this->_docBlockBootstrap, $this->_profilerBootstrap, $this->_shell, __DIR__);
     $this->_object->expects($this->any())->method('_createMemoryBootstrap')->will($this->returnValue($this->_memoryBootstrap));
     return $application;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:BootstrapTest.php

示例5: accessChecksWorksAsExpected

 /**
  * @dataProvider accessCheckDataProvider
  * @param $checkArray
  * @test
  */
 public function accessChecksWorksAsExpected($checkArray)
 {
     $this->fixture->expects($this->any())->method('getExtensionConfiguration')->will($this->returnValue(array('enableGroupCheck' => '1', 'groupCheckDirs' => $checkArray['groupCheckDirs'], 'excludeGroups' => $checkArray['excludedGroups'])));
     $fakeUser = new \stdClass();
     $fakeUser->groupData['uid'] = $checkArray['actualGroups'];
     $fakeUser->user['uid'] = $checkArray['actualUser'];
     $this->fixture->_set('feUserObj', $fakeUser);
     $this->fixture->_set('file', $checkArray['file']);
     $this->fixture->_set('userGroups', $checkArray['transmittedGroups']);
     $this->fixture->_set('userId', $checkArray['transmittedUser']);
     $_GET['g'] = $checkArray['transmittedGroups'];
     $_GET['u'] = $checkArray['transmittedUser'];
     $this->fixture->expects($this->once())->method('exitScript')->with('Access denied for User!');
     $this->fixture->__construct();
 }
开发者ID:IngoMueller,项目名称:naw_securedl,代码行数:20,代码来源:FileDeliveryTest.php

示例6: _callBootstrapConstructor

 /**
  * Explicitly call the constructor method of the underlying bootstrap object
  *
  * @param string|null $localXmlFile
  * @param string $cleanupAction
  */
 protected function _callBootstrapConstructor($localXmlFile = null, $cleanupAction = Magento_Test_Bootstrap::CLEANUP_NONE)
 {
     $this->_bootstrap->__construct(self::$_magentoDir, $localXmlFile ? $localXmlFile : self::$_localXmlFile, self::$_globalEtcFiles, self::$_moduleEtcFiles, '', self::$_tmpDir, $cleanupAction);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:10,代码来源:BootstrapTest.php

示例7: setUp

 /**
  * Set Up
  */
 protected function setUp()
 {
     $this->localeDate = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\Timezone', [], [], '', false);
     $this->config = $this->getMock('Magento\\Eav\\Model\\Config', ['getEntityType'], [], '', false);
     $type = $this->getMock('\\Magento\\Eav\\Model\\Entity\\Type', [], [], '', false);
     $this->config->expects($this->once())->method('getEntityType')->willReturn($type);
     $this->resource = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->storeManager = $this->getMock('Magento\\Store\\Model\\StoreManager', [], [], '', false);
     $this->logger = $this->getMock('Magento\\Framework\\Logger\\Monolog', [], [], '', false);
     $this->collection = $this->getMock('\\Magento\\Catalog\\Model\\Resource\\Product\\CollectionFactory', [], [], '', false);
     $this->abstractCollection = $this->getMockForAbstractClass('\\Magento\\Eav\\Model\\Entity\\Collection\\AbstractCollection', [], '', false, true, true, ['count', 'setOrder', 'setStoreId', 'getCurPage', 'getLastPageNumber']);
     $this->exportConfig = $this->getMock('Magento\\ImportExport\\Model\\Export\\Config', [], [], '', false);
     $this->productFactory = $this->getMock('Magento\\Catalog\\Model\\Resource\\ProductFactory', ['create', 'getTypeId'], [], '', false);
     $this->attrSetColFactory = $this->getMock('Magento\\Eav\\Model\\Resource\\Entity\\Attribute\\Set\\CollectionFactory', ['create', 'setEntityTypeFilter'], [], '', false);
     $this->categoryColFactory = $this->getMock('Magento\\Catalog\\Model\\Resource\\Category\\CollectionFactory', ['create', 'addNameToResult'], [], '', false);
     $this->itemFactory = $this->getMock('Magento\\CatalogInventory\\Model\\Resource\\Stock\\ItemFactory', [], [], '', false);
     $this->optionColFactory = $this->getMock('Magento\\Catalog\\Model\\Resource\\Product\\Option\\CollectionFactory', [], [], '', false);
     $this->attributeColFactory = $this->getMock('Magento\\Catalog\\Model\\Resource\\Product\\Attribute\\CollectionFactory', [], [], '', false);
     $this->typeFactory = $this->getMock('Magento\\CatalogImportExport\\Model\\Export\\Product\\Type\\Factory', [], [], '', false);
     $this->linkTypeProvider = $this->getMock('Magento\\Catalog\\Model\\Product\\LinkTypeProvider', [], [], '', false);
     $this->rowCustomizer = $this->getMock('Magento\\CatalogImportExport\\Model\\Export\\RowCustomizer\\Composite', [], [], '', false);
     $this->storeResolver = $this->getMock('\\Magento\\CatalogImportExport\\Model\\Import\\Product\\StoreResolver', [], [], '', false);
     $this->groupRepository = $this->getMock('\\Magento\\Customer\\Api\\GroupRepositoryInterface', [], [], '', false);
     $this->writer = $this->getMock('Magento\\ImportExport\\Model\\Export\\Adapter\\AbstractAdapter', ['setHeaderCols', 'writeRow', 'getContents'], [], '', false);
     $constructorMethods = ['initTypeModels', 'initAttributes', '_initStores', 'initAttributeSets', 'initWebsites', 'initCategories'];
     $mockMethods = array_merge($constructorMethods, ['_customHeadersMapping', '_prepareEntityCollection', '_getEntityCollection', 'getWriter', 'getExportData', '_headerColumns', '_customFieldsMapping', 'getItemsPerPage', 'paginateCollection', '_getHeaderColumns']);
     $this->advancedPricing = $this->getMock('Magento\\AdvancedPricingImportExport\\Model\\Export\\AdvancedPricing', $mockMethods, [], '', false);
     foreach ($constructorMethods as $method) {
         $this->advancedPricing->expects($this->once())->method($method)->will($this->returnSelf());
     }
     $this->advancedPricing->__construct($this->localeDate, $this->config, $this->resource, $this->storeManager, $this->logger, $this->collection, $this->exportConfig, $this->productFactory, $this->attrSetColFactory, $this->categoryColFactory, $this->itemFactory, $this->optionColFactory, $this->attributeColFactory, $this->typeFactory, $this->linkTypeProvider, $this->rowCustomizer, $this->storeResolver, $this->groupRepository);
 }
开发者ID:nja78,项目名称:magento2,代码行数:35,代码来源:AdvancedPricingTest.php

示例8: testGetTimers

 /**
  * @dataProvider getTimersDataProvider
  */
 public function testGetTimers($filter, $expectedTimers)
 {
     $this->_object->__construct($filter);
     $actualTimers = $this->_timersGetter->invoke($this->_object);
     $this->assertEquals($expectedTimers, $actualTimers);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:9,代码来源:OutputAbstractTest.php

示例9: setTimeout

 /**
  * @test override getTimeout set default option value
  */
 public function setTimeout()
 {
     $this->command->expects($this->any())->method('getDefaultTimeout')->will($this->returnValue(10));
     $this->command->__construct('dispatch');
     $this->assertEquals(10, $this->command->getDefinition()->getOption('timeout')->getDefault());
 }
开发者ID:event-band,项目名称:band-symfony-adapter,代码行数:9,代码来源:AbstractDispatchCommandTest.php

示例10: testConstructorException

 /**
  * Test that only valid resource instance can be passed to the constructor
  *
  * @expectedException InvalidArgumentException
  */
 public function testConstructorException()
 {
     $this->_model->__construct(array('resource' => new stdClass()));
 }
开发者ID:nemphys,项目名称:magento2,代码行数:9,代码来源:AbstractTest.php

示例11: testConstructor

 public function testConstructor()
 {
     $this->_shell->expects($this->once())->method('execute')->with('php --version');
     $this->_object->__construct($this->_shell);
 }
开发者ID:nayanchamp,项目名称:magento2,代码行数:5,代码来源:PhpTest.php

示例12: _callBootstrapConstructor

 /**
  * Explicitly call the constructor method of the underlying bootstrap object
  *
  * @param string|null $localXmlFile
  * @param bool $isCleanupEnabled
  */
 protected function _callBootstrapConstructor($localXmlFile = null, $isCleanupEnabled = false)
 {
     $this->_bootstrap->__construct(self::$_magentoDir, self::$_testsDir, $localXmlFile ? $localXmlFile : self::$_localXmlFile, self::$_globalEtcFiles, self::$_moduleEtcFiles, '', self::$_tmpDir, $this->_shell, $isCleanupEnabled);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:10,代码来源:BootstrapTest.php


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