本文整理汇总了PHP中PHPUnit_Framework_MockObject_MockObject::process方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_MockObject_MockObject::process方法的具体用法?PHP PHPUnit_Framework_MockObject_MockObject::process怎么用?PHP PHPUnit_Framework_MockObject_MockObject::process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_MockObject_MockObject
的用法示例。
在下文中一共展示了PHPUnit_Framework_MockObject_MockObject::process方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface
/**
* @test
*/
public function processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface()
{
$typoScript = array(10 => $this->getUniqueId('postprocess'), 20 => \TYPO3\CMS\Form\Tests\Unit\Fixtures\PostProcessorWithoutInterfaceFixture::class);
$this->subject->typoScript = $typoScript;
$this->subject->expects($this->once())->method('sortTypoScriptKeyList')->will($this->returnValue(array(10, 20)));
$returnValue = $this->subject->process();
$this->assertEquals('', $returnValue);
}
示例2: processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface
/**
* @test
*/
public function processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface()
{
$classNameWithoutInterface = uniqid('postprocess');
eval('namespace TYPO3\\CMS\\Form\\PostProcess;' . 'class ' . $classNameWithoutInterface . 'PostProcessor {' . ' public function __construct(\\TYPO3\\CMS\\Form\\Domain\\Model\\Form $form, array $typoScript) {' . ' }' . ' public function process() {' . ' return \'withoutInterface\';' . ' }' . '}');
$typoScript = array(10 => uniqid('postprocess'), 20 => $classNameWithoutInterface);
$this->fixture->typoScript = $typoScript;
$this->fixture->expects($this->once())->method('sortTypoScriptKeyList')->will($this->returnValue(array(10, 20)));
$returnValue = $this->fixture->process();
$this->assertEquals('', $returnValue);
}
示例3: processWrapsCurrentViewHelperInEscapeNode
/**
* @test
*/
public function processWrapsCurrentViewHelperInEscapeNode()
{
$interceptorPosition = InterceptorInterface::INTERCEPT_OBJECTACCESSOR;
$mockNode = $this->getMock(ObjectAccessorNode::class, [], [], '', false);
$actualResult = $this->escapeInterceptor->process($mockNode, $interceptorPosition, $this->mockParsingState);
$this->assertInstanceOf(EscapingNode::class, $actualResult);
}
示例4: testProcess
/**
* @covers ::process
* @covers ::processCallback
*/
public function testProcess()
{
$cache_contexts = Cache::mergeContexts(['baz', 'qux']);
$cache_tags = Cache::mergeTags(['foo', 'bar']);
$currency_code_from = 'EUR';
$currency_code_to = 'NLG';
$rate = '2.20371';
$exchange_rate_provider_id = 'foo_bar';
$exchange_rate = new ExchangeRate($currency_code_from, $currency_code_to, $rate, $exchange_rate_provider_id);
$exchange_rate->addCacheContexts($cache_contexts);
$exchange_rate->addCacheTags($cache_tags);
$this->input->expects($this->any())->method('parseAmount')->will($this->returnArgument(0));
$this->exchangeRateProvider->expects($this->any())->method('load')->with($currency_code_from, $currency_code_to)->willReturn($exchange_rate);
$langcode = $this->randomMachineName(2);
$tokens_valid = ['[currency:EUR:NLG]' => '2.20371', '[currency:EUR:NLG:1]' => '2.20371', '[currency:EUR:NLG:2]' => '4.40742'];
$tokens_invalid = ['[currency]', '[currency:]', '[currency::]', '[currency:EUR]', '[currency:EUR:123]', '[currency:123:EUR]', '[currency:123]'];
foreach ($tokens_valid as $token => $replacement) {
$result = $this->sut->process($token, $langcode);
$this->assertInstanceOf(FilterProcessResult::class, $result);
$this->assertSame($replacement, $result->getProcessedText());
$this->assertSame($cache_contexts, $result->getCacheContexts());
$this->assertSame($cache_tags, $result->getCacheTags());
}
foreach ($tokens_invalid as $token) {
$result = $this->sut->process($token, $langcode);
$this->assertInstanceOf(FilterProcessResult::class, $result);
$this->assertSame($token, $result->getProcessedText());
$this->assertEmpty($result->getCacheContexts());
$this->assertEmpty($result->getCacheTags());
}
}
示例5: processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface
/**
* @test
*/
public function processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface()
{
$typoScript = array(10 => uniqid('postprocess'), 20 => $this->classNameWithoutInterface);
$this->postprocessor->typoScript = $typoScript;
$this->postprocessor->expects($this->once())->method('sortTypoScriptKeyList')->will($this->returnValue(array(10, 20)));
$returnValue = $this->postprocessor->process();
$this->assertEquals('', $returnValue);
}
示例6: processWrapsCurrentViewHelperInHtmlspecialcharsViewHelperOnObjectAccessor
/**
* @test
*/
public function processWrapsCurrentViewHelperInHtmlspecialcharsViewHelperOnObjectAccessor()
{
$interceptorPosition = InterceptorInterface::INTERCEPT_OBJECTACCESSOR;
$mockNode = $this->getMock('NamelessCoder\\Fluid\\Core\\Parser\\SyntaxTree\\ObjectAccessorNode', array(), array(), '', FALSE);
$mockEscapeViewHelper = $this->getMock('NamelessCoder\\Fluid\\ViewHelpers\\Format\\HtmlspecialcharsViewHelper');
$actualResult = $this->escapeInterceptor->process($mockNode, $interceptorPosition, $this->mockParsingState);
$this->assertInstanceOf('NamelessCoder\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode', $actualResult);
}
示例7: testProcess
public function testProcess()
{
$item = $this->getMock('Mage_Sales_Model_Quote_Item', array('getAddress'), array(), '', false);
$item->expects($this->once())->method('getAddress')->will($this->returnValue(true));
$item->setDiscountCalculationPrice(-1);
$item->setCalculationPrice(1);
$quote = $this->getMock('Mage_Sales_Model_Quote', null, array(), '', false);
$item->setQuote($quote);
$this->assertInstanceOf('Mage_SalesRule_Model_Validator', $this->_model->process($item));
return true;
}
示例8: processWrapsCurrentViewHelperInHtmlspecialcharsViewHelperOnObjectAccessor
/**
* @test
*/
public function processWrapsCurrentViewHelperInHtmlspecialcharsViewHelperOnObjectAccessor()
{
$interceptorPosition = InterceptorInterface::INTERCEPT_OBJECTACCESSOR;
$mockNode = $this->getMock(\TYPO3\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode::class, array(), array(), '', false);
$mockEscapeViewHelper = $this->getMock(\TYPO3\Fluid\ViewHelpers\Format\HtmlspecialcharsViewHelper::class);
$mockObjectManager = $this->getMock(\TYPO3\Flow\Object\ObjectManagerInterface::class);
$mockObjectManager->expects($this->at(0))->method('get')->with(\TYPO3\Fluid\ViewHelpers\Format\HtmlspecialcharsViewHelper::class)->will($this->returnValue($mockEscapeViewHelper));
$mockObjectManager->expects($this->at(1))->method('get')->with(\TYPO3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode::class, $mockEscapeViewHelper, array('value' => $mockNode))->will($this->returnValue($this->mockNode));
$this->escapeInterceptor->injectObjectManager($mockObjectManager);
$actualResult = $this->escapeInterceptor->process($mockNode, $interceptorPosition, $this->mockParsingState);
$this->assertSame($this->mockNode, $actualResult);
}
示例9: testVerifyProcessingSkipped
/**
* Verifies that we can skip processing.
*
* @covers ::dispatchSkippedProcessing
* @covers ::process
*
* @depends testVerifyFileContentsProcessedAndEventsDispatched
*/
public function testVerifyProcessingSkipped()
{
// register an event dispatcher
$dispatcher = new EventDispatcher();
$this->processor->setDispatcher($dispatcher);
// require that processing be skipped
$dispatcher->addListener(Events::PRE_PROCESSING, function (PreProcessingEvent $event) {
$event->skip();
});
// verify that the skip event is dispatched
$skipped = false;
$dispatcher->addListener(Events::SKIPPED_PROCESSING, function (SkippedProcessingEvent $event) use(&$skipped) {
$skipped = true;
});
// make sure the processing method is never called
$this->processor->expects(self::never())->method('doProcessing');
// make sure the contents were are returned unchanged
self::assertEquals('<?php echo "Hello, world!\\n";', $this->processor->process('test.php', '<?php echo "Hello, world!\\n";'));
// make sure the skip event was dispatched
self::assertTrue($skipped);
}
示例10: testWritePermissionErrors
/**
* @expectedException \Exception
* @expectedExceptionMessage Missing write permissions to the following paths:
*/
public function testWritePermissionErrors()
{
$this->filePermissions->expects($this->once())->method('getMissingWritablePathsForInstallation')->willReturn(['/a/ro/dir', '/media']);
$this->configModel->process([]);
}
示例11: testProcessWithException
/**
* @param array $structureElements
*
* @dataProvider processWithExceptionDataProvider
* @expectedException \Magento\Framework\Exception\LocalizedException
*/
public function testProcessWithException($structureElements)
{
$this->scheduledStructureMock->expects($this->once())->method('getElements')->willReturn($structureElements);
$this->structureMock->expects($this->once())->method('setAttribute')->willReturnSelf();
$this->container->process($this->readerContextMock, $this->generatorContextMock);
}
示例12: testProcess
/**
* @param FieldConfigModel $field
* @param bool $isExist
* @param FieldConfigModel|null $expected
*
* @dataProvider processProvider
*/
public function testProcess($field, $isExist, $expected)
{
$this->databaseHelper->expects(static::any())->method('findOneBy')->willReturn($isExist ? $field : null);
static::assertEquals($expected, $this->strategy->process($field));
}
示例13: testProcessWithInvalidElementConfiguration
/**
* @covers ::process
*
* @expectedException \InvalidArgumentException
*
* @dataProvider providerTestProcess
*/
public function testProcessWithInvalidElementConfiguration(array $element)
{
$form_state = $this->getMock(FormStateInterface::class);
$form = [];
$this->sut->process($element, $form_state, $form);
}