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


PHP PHPUnit_Framework_MockObject_MockObject::render方法代码示例

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


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

示例1: renderReturnsUnmodifiedChildNodesIfNoValueIsSpecified

 /**
  * @test
  */
 public function renderReturnsUnmodifiedChildNodesIfNoValueIsSpecified()
 {
     $childNodes = 'input value " & äöüß@';
     $this->subject->expects($this->once())->method('renderChildren')->will($this->returnValue($childNodes));
     $actualResult = $this->subject->render();
     $this->assertEquals($childNodes, $actualResult);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:10,代码来源:RawViewHelperTest.php

示例2: testWitoutOptions

 public function testWitoutOptions()
 {
     $otpions = array('test', 'has', 'processed');
     $this->column->setOptions($otpions);
     $this->assertSame($otpions, $this->column->getOptions());
     $this->column->removeOptions();
     $this->assertEquals('test', $this->column->render('test', array()));
 }
开发者ID:drahak,项目名称:tables,代码行数:8,代码来源:OptionColumnTest.php

示例3: testRenderWithRenderer

 public function testRenderWithRenderer()
 {
     $test = $this;
     $this->column->setRenderer(function ($value, $rowData, $cell) use($test) {
         $test->assertTrue(is_string($value));
         $test->assertInstanceOf('stdClass', $rowData);
         $test->assertInstanceOf('Nette\\Utils\\Html', $cell);
         return \Nette\Utils\Strings::upper($value);
     });
     $result = $this->column->render(array('testing', 'is', 'awesome'), array());
     $this->assertEquals('TESTING, IS, AWESOME', $result);
 }
开发者ID:drahak,项目名称:tables,代码行数:12,代码来源:ColumnTest.php

示例4: callingRenderAssignsVariablesCorrectlyToUriBuilder

 /**
  * @test
  */
 public function callingRenderAssignsVariablesCorrectlyToUriBuilder()
 {
     $this->uriBuilder->expects($this->once())->method('setSection')->with('section')->will($this->returnSelf());
     $this->uriBuilder->expects($this->once())->method('setArguments')->with(array('additionalParams'))->will($this->returnSelf());
     $this->uriBuilder->expects($this->once())->method('setArgumentsToBeExcludedFromQueryString')->with(array('argumentsToBeExcludedFromQueryString'))->will($this->returnSelf());
     $this->uriBuilder->expects($this->once())->method('setFormat')->with('format')->will($this->returnSelf());
     $expectedModifiedArguments = array('module' => 'the/path', 'moduleArguments' => array('arguments', '@action' => 'action'));
     $this->uriBuilder->expects($this->once())->method('uriFor')->with('index', $expectedModifiedArguments);
     // fallback for the method chaining of the URI builder
     $this->uriBuilder->expects($this->any())->method($this->anything())->will($this->returnValue($this->uriBuilder));
     $this->viewHelper->render('the/path', 'action', array('arguments'), 'section', 'format', array('additionalParams'), true, array('argumentsToBeExcludedFromQueryString'));
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:15,代码来源:ModuleViewHelperTest.php

示例5: testRenderCompress

 /**
  * @return void
  */
 public function testRenderCompress()
 {
     $this->PartialCacheView = $this->getMockBuilder(PartialCacheView::class)->setMethods(['_getViewFileName', '_render'])->setConstructorArgs([null, null, null, ['compress' => true]])->getMock();
     $this->PartialCacheView->expects($this->once())->method('_getViewFileName')->willReturn('view');
     $this->PartialCacheView->expects($this->once())->method('_render')->willReturn(file_get_contents($this->testCacheFile));
     $this->PartialCacheView->autoLayout(false);
     $content = file_get_contents($this->testCacheFile);
     $content = str_replace('cachetime:0', 'cachetime:' . (time() - HOUR), $content);
     file_put_contents($this->tmpDir . 'view', $content);
     $result = $this->PartialCacheView->render();
     $this->assertSame('<h1>Test</h1> <p>Some paragraph.</p>', $result);
     $this->assertSame('<!--cachetime:0--><h1>Test</h1> <p>Some paragraph.</p>', file_get_contents($this->tmpDir . 'view'));
 }
开发者ID:dereuromark,项目名称:cakephp-cache,代码行数:16,代码来源:PartialCacheViewTest.php

示例6: renderReturnsFilesForFolders

 /**
  * @test
  * @dataProvider renderReturnsFilesForFoldersDataProvider
  */
 public function renderReturnsFilesForFolders($configuration, $expected)
 {
     $folderMap = array();
     $fileCount = 1;
     for ($i = 1; $i < 4; $i++) {
         $fileArray = array();
         for ($j = 1; $j < 4; $j++) {
             $file = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(), '', FALSE);
             $file->expects($this->any())->method('getName')->will($this->returnValue('File ' . $fileCount));
             $file->expects($this->any())->method('hasProperty')->with('name')->will($this->returnValue(TRUE));
             $file->expects($this->any())->method('getProperty')->with('name')->will($this->returnValue('File ' . $fileCount));
             $fileArray[] = $file;
             $fileCount++;
         }
         $folder = $this->getMock(\TYPO3\CMS\Core\Resource\Folder::class, array(), array(), '', FALSE);
         $folder->expects($this->any())->method('getFiles')->will($this->returnValue($fileArray));
         $folderMap[] = array($i . ':myfolder/', $folder);
     }
     $resourceFactory = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
     $resourceFactory->expects($this->any())->method('getFolderObjectFromCombinedIdentifier')->will($this->returnValueMap($folderMap));
     $fileCollector = $this->getMock(FileCollector::class, array('getResourceFactory'));
     $fileCollector->expects($this->any())->method('getResourceFactory')->will($this->returnValue($resourceFactory));
     $this->subject->expects($this->any())->method('getFileCollector')->will($this->returnValue($fileCollector));
     $this->assertSame($expected, $this->subject->render($configuration));
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:29,代码来源:FilesContentObjectTest.php

示例7: renderCallsStandardWrapOnResultStringIfGivenInConfiguration

 /**
  * @test
  */
 public function renderCallsStandardWrapOnResultStringIfGivenInConfiguration()
 {
     $this->addMockViewToSubject();
     $configuration = array('stdWrap.' => array('foo' => 'bar'));
     $this->standaloneView->expects($this->any())->method('render')->will($this->returnValue('baz'));
     $this->contentObjectRenderer->expects($this->once())->method('stdWrap')->with('baz', array('foo' => 'bar'));
     $this->subject->render($configuration);
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:11,代码来源:FluidTemplateContentObjectTest.php

示例8: testWithDataAndSourceCollection

 /**
  * @return void
  */
 public function testWithDataAndSourceCollection()
 {
     $this->file->expects($this->at(1))->method('process')->will($this->returnValue($this->processedFiles[1]));
     $this->file->expects($this->at(2))->method('process')->will($this->returnValue($this->processedFiles[2]));
     $this->file->expects($this->at(3))->method('process')->will($this->returnValue($this->processedFiles[0]));
     $this->imageRendererConfiguration->expects($this->once())->method('getSourceCollection')->will($this->returnValue([10 => ['width' => '360m', 'dataKey' => 'small'], 20 => ['width' => '720m', 'dataKey' => 'small-retina']]));
     $this->imageRendererConfiguration->expects($this->once())->method('getLayoutKey')->will($this->returnValue('data'));
     $this->assertEquals('<img src="image.jpg" alt="alt" title="title" data-small="image360.jpg" data-small-retina="image720.jpg" />', $this->imageRenderer->render($this->file, '1000', '1000', []));
 }
开发者ID:alexanderschnitzler,项目名称:fluid-styled-responsive-images,代码行数:12,代码来源:ImageRenderingTest.php

示例9: renderDoesNotModifySourceIfItIsAnObjectThatCantBeConvertedToAString

 /**
  * @test
  */
 public function renderDoesNotModifySourceIfItIsAnObjectThatCantBeConvertedToAString()
 {
     $user = new UserWithoutToString('Xaver <b>Cross-Site</b>');
     $this->viewHelper->expects($this->once())->method('buildRenderChildrenClosure')->willReturn(function () {
         throw new \Exception('rendderChildrenClosure was invoked but should not have been');
     });
     $this->viewHelper->setArguments(['value' => $user]);
     $actualResult = $this->viewHelper->render();
     $this->assertSame($user, $actualResult);
 }
开发者ID:neos,项目名称:flow-development-collection,代码行数:13,代码来源:StripTagsViewHelperTest.php

示例10: dateViewHelperFormatsDateLocalized

 /**
  * @dataProvider dateViewHelperFormatsDateLocalizedDataProvider
  *
  * @test
  */
 public function dateViewHelperFormatsDateLocalized($locale, $expected)
 {
     $format = '%d. %B %Y';
     // 2013-02-03 11:40 UTC
     $timestamp = '@1359891658';
     if (!setlocale(LC_COLLATE, $locale)) {
         $this->markTestSkipped('Locale ' . $locale . ' is not available.');
     }
     $this->setCustomLocale($locale);
     $this->assertEquals($expected, $this->subject->render($timestamp, $format));
 }
开发者ID:vip3out,项目名称:TYPO3.CMS,代码行数:16,代码来源:DateViewHelperTest.php

示例11: viewHelperUsesSpecifiedAccountForCheck

 /**
  * @test
  */
 public function viewHelperUsesSpecifiedAccountForCheck()
 {
     $mockAccount = $this->createMock(\Neos\Flow\Security\Account::class);
     $mockAccount->expects($this->any())->method('hasRole')->will($this->returnCallback(function (Role $role) {
         switch ($role->getIdentifier()) {
             case 'Neos.FluidAdaptor:Administrator':
                 return true;
         }
     }));
     $this->mockViewHelper->expects($this->any())->method('renderThenChild')->will($this->returnValue('true'));
     $this->mockViewHelper->expects($this->any())->method('renderElseChild')->will($this->returnValue('false'));
     $arguments = ['role' => new Role('Neos.FluidAdaptor:Administrator'), 'packageKey' => null, 'account' => $mockAccount];
     $this->mockViewHelper->setArguments($arguments);
     $actualResult = $this->mockViewHelper->render();
     $this->assertEquals('true', $actualResult, 'Full role identifier in role argument is accepted');
 }
开发者ID:neos,项目名称:flow-development-collection,代码行数:19,代码来源:IfHasRoleViewHelperTest.php

示例12: renderReturnsFilesForFolders

 /**
  * @test
  * @dataProvider renderReturnsFilesForFoldersDataProvider
  */
 public function renderReturnsFilesForFolders($configuration, $expected, $recursive = false)
 {
     $folderMap = array();
     $folders = array();
     $fileCount = 1;
     $filesArrayForFolder = [];
     for ($i = 1; $i < 4; $i++) {
         $filesArrayForFolder[$i] = [];
         for ($j = 1; $j < 4; $j++) {
             $file = $this->getMock(File::class, [], [], '', false);
             $file->expects($this->any())->method('getName')->will($this->returnValue('File ' . $fileCount));
             $file->expects($this->any())->method('hasProperty')->with('name')->will($this->returnValue(true));
             $file->expects($this->any())->method('getProperty')->with('name')->will($this->returnValue('File ' . $fileCount));
             $filesArrayForFolder[$i][] = $file;
             $fileCount++;
         }
         $folder = $this->getMock(Folder::class, array(), array(), '', false);
         if ($recursive) {
             if ($i < 3) {
                 $folders[$i] = $folder;
                 $folderMap[$i] = array('1:myfolder/mysubfolder-' . $i . '/', $folder);
             } else {
                 $folder->expects($this->any())->method('getSubfolders')->will($this->returnValue($folders));
                 $folderMap[$i] = array('1:myfolder/', $folder);
             }
         } else {
             $folderMap[$i] = array($i . ':myfolder/', $folder);
         }
     }
     foreach ($folderMap as $i => $folderMapInfo) {
         if ($i < 3 || !$recursive) {
             $folderMapInfo[1]->expects($this->any())->method('getFiles')->will($this->returnValue($filesArrayForFolder[$i]));
         } else {
             $recursiveFiles = array_merge($filesArrayForFolder[3], $filesArrayForFolder[1], $filesArrayForFolder[2]);
             $folderMapInfo[1]->expects($this->any())->method('getFiles')->will($this->returnValue($recursiveFiles));
         }
     }
     $resourceFactory = $this->getMock(ResourceFactory::class);
     $resourceFactory->expects($this->any())->method('getFolderObjectFromCombinedIdentifier')->will($this->returnValueMap($folderMap));
     $fileCollector = $this->getMock(FileCollector::class, array('getResourceFactory'));
     $fileCollector->expects($this->any())->method('getResourceFactory')->will($this->returnValue($resourceFactory));
     $this->subject->expects($this->any())->method('getFileCollector')->will($this->returnValue($fileCollector));
     $this->assertSame($expected, $this->subject->render($configuration));
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:48,代码来源:FilesContentObjectTest.php

示例13: viewHelperConvertsCorrectly

 /**
  * @test
  * @dataProvider conversionTestingDataProvider
  */
 public function viewHelperConvertsCorrectly($input, $mode, $expected)
 {
     $this->assertSame($expected, $this->subject->render($input, $mode), sprintf('The conversion with mode "%s" did not perform as expected.', $mode));
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:8,代码来源:CaseViewHelperTest.php

示例14: renderRendersChildren

 /**
  * @test
  */
 public function renderRendersChildren()
 {
     $this->subject->expects($this->once())->method('renderChildren')->will($this->returnValue('foo'));
     $actualResult = $this->subject->render();
     $this->assertEquals('foo', $actualResult);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:9,代码来源:ElseViewHelperTest.php

示例15: renderReturnsContentFromDefaultObjectIfKeyDoesNotExist

 /**
  * @test
  */
 public function renderReturnsContentFromDefaultObjectIfKeyDoesNotExist()
 {
     $conf = array('key' => 'not existing', 'default' => 'TEXT', 'default.' => array('value' => 'expected value'));
     $this->assertSame('expected value', $this->subject->render($conf));
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:8,代码来源:CaseContentObjectTest.php


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