本文整理汇总了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();
}
示例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());
}
示例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()));
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例8: testGetTimers
/**
* @dataProvider getTimersDataProvider
*/
public function testGetTimers($filter, $expectedTimers)
{
$this->_object->__construct($filter);
$actualTimers = $this->_timersGetter->invoke($this->_object);
$this->assertEquals($expectedTimers, $actualTimers);
}
示例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());
}
示例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()));
}
示例11: testConstructor
public function testConstructor()
{
$this->_shell->expects($this->once())->method('execute')->with('php --version');
$this->_object->__construct($this->_shell);
}
示例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);
}