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


PHP PHPUnit_Framework_MockObject_MockObject::initialize方法代码示例

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


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

示例1: testInitializeCopyConnection

 /**
  * Test that initialize() copies the connection property over.
  *
  * @return void
  */
 public function testInitializeCopyConnection()
 {
     $this->assertEquals('', $this->Task->connection);
     $this->Task->params = ['connection' => 'test'];
     $this->Task->initialize();
     $this->assertEquals('test', $this->Task->connection);
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:12,代码来源:FixtureTaskTest.php

示例2: testCurrentCallsDataSourceCurrentOnceWithBuffer

 /**
  * @covers Zend\Db\ResultSet\AbstractResultSet::current
  */
 public function testCurrentCallsDataSourceCurrentOnceWithBuffer()
 {
     $result = $this->getMock('Zend\\Db\\Adapter\\Driver\\ResultInterface');
     $this->resultSet->buffer();
     $this->resultSet->initialize($result);
     $result->expects($this->once())->method('current')->will($this->returnValue(array('foo' => 'bar')));
     $value1 = $this->resultSet->current();
     $value2 = $this->resultSet->current();
     $this->resultSet->current();
     $this->assertEquals($value1, $value2);
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:14,代码来源:AbstractResultSetIntegrationTest.php

示例3: setUp

 /**
  * Setup Defaults
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->out = new ConsoleOutput();
     $this->err = new ConsoleOutput();
     $io = new ConsoleIo($this->out, $this->err);
     $this->QueueShell = $this->getMockBuilder(QueueShell::class)->setMethods(['in', 'err', '_stop'])->setConstructorArgs([$io])->getMock();
     $this->QueueShell->initialize();
     $this->QueueShell->loadTasks();
     Configure::write('Queue', ['sleeptime' => 2, 'gcprob' => 10, 'defaultworkertimeout' => 3, 'defaultworkerretries' => 1, 'workermaxruntime' => 5, 'cleanuptimeout' => 10, 'exitwhennothingtodo' => false, 'pidfilepath' => TMP . 'queue' . DS, 'log' => false]);
 }
开发者ID:dereuromark,项目名称:cakephp-queue,代码行数:16,代码来源:QueueShellTest.php

示例4: createFakeExtension

 /**
  * Creates a fake extension with a given table definition.
  *
  * @param string $tableDefinition SQL script to create the extension's tables
  * @throws \RuntimeException
  * @return void
  */
 protected function createFakeExtension($tableDefinition)
 {
     // Prepare a fake extension configuration
     $ext_tables = GeneralUtility::tempnam('ext_tables');
     if (!GeneralUtility::writeFile($ext_tables, $tableDefinition)) {
         throw new \RuntimeException('Can\'t write temporary ext_tables file.');
     }
     $this->temporaryFiles[] = $ext_tables;
     $GLOBALS['TYPO3_LOADED_EXT'] = array('test_dbal' => array('ext_tables.sql' => $ext_tables));
     // Append our test table to the list of existing tables
     $this->subject->initialize();
 }
开发者ID:KarlDennisMatthaei1923,项目名称:PierraaDesign,代码行数:19,代码来源:DatabaseConnectionTest.php

示例5: testAddError

 public function testAddError()
 {
     $context = ['foo' => 'fooValue', 'bar' => 'barValue'];
     $options = ['left' => 'foo', 'right' => 'bar'];
     $this->condition->initialize($options);
     $message = 'Error message.';
     $this->condition->setMessage($message);
     $this->condition->expects($this->once())->method('isConditionAllowed')->with($context)->will($this->returnValue(false));
     $errors = new ArrayCollection();
     $this->assertFalse($this->condition->evaluate($context, $errors));
     $this->assertCount(1, $errors);
     $this->assertEquals(['message' => $message, 'parameters' => []], $errors->get(0));
 }
开发者ID:ramunasd,项目名称:platform,代码行数:13,代码来源:AbstractConditionTest.php

示例6: standardTagAttributesAreRegistered

 /**
  * @test
  */
 public function standardTagAttributesAreRegistered()
 {
     $mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('addAttribute'), array(), '', FALSE);
     $mockTagBuilder->expects($this->at(0))->method('addAttribute')->with('class', 'classAttribute');
     $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('dir', 'dirAttribute');
     $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('id', 'idAttribute');
     $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('lang', 'langAttribute');
     $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('style', 'styleAttribute');
     $mockTagBuilder->expects($this->at(5))->method('addAttribute')->with('title', 'titleAttribute');
     $mockTagBuilder->expects($this->at(6))->method('addAttribute')->with('accesskey', 'accesskeyAttribute');
     $mockTagBuilder->expects($this->at(7))->method('addAttribute')->with('tabindex', 'tabindexAttribute');
     $this->viewHelper->_set('tag', $mockTagBuilder);
     $arguments = array('class' => 'classAttribute', 'dir' => 'dirAttribute', 'id' => 'idAttribute', 'lang' => 'langAttribute', 'style' => 'styleAttribute', 'title' => 'titleAttribute', 'accesskey' => 'accesskeyAttribute', 'tabindex' => 'tabindexAttribute');
     $this->viewHelper->_call('registerUniversalTagAttributes');
     $this->viewHelper->setArguments($arguments);
     $this->viewHelper->initializeArguments();
     $this->viewHelper->initialize();
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:21,代码来源:AbstractTagBasedViewHelperTest.php

示例7: testAddError

 public function testAddError()
 {
     $context = array('foo' => 'fooValue', 'bar' => 'barValue');
     $options = array('left' => 'foo', 'right' => 'bar');
     $left = $options['left'];
     $right = $options['right'];
     $this->condition->initialize($options);
     $message = 'Compare {{ left }} with {{ right }}.';
     $this->condition->setMessage($message);
     $this->contextAccessor->expects($this->at(0))->method('getValue')->with($context, $left)->will($this->returnValue($context[$left]));
     $this->contextAccessor->expects($this->at(1))->method('getValue')->with($context, $right)->will($this->returnValue($context[$right]));
     $this->condition->expects($this->once())->method('doCompare')->with($context[$left], $context[$right])->will($this->returnValue(false));
     $this->contextAccessor->expects($this->at(2))->method('getValue')->with($context, $left)->will($this->returnValue($context[$left]));
     $this->contextAccessor->expects($this->at(3))->method('getValue')->with($context, $right)->will($this->returnValue($context[$right]));
     $errors = new ArrayCollection();
     $this->assertFalse($this->condition->isAllowed($context, $errors));
     $this->assertEquals(1, $errors->count());
     $this->assertEquals(array('message' => $message, 'parameters' => array('{{ left }}' => $context[$left], '{{ right }}' => $context[$right])), $errors->get(0));
 }
开发者ID:xamin123,项目名称:platform,代码行数:19,代码来源:AbstractComparisonTest.php

示例8: testAddError

 public function testAddError()
 {
     $context = ['foo' => 'fooValue', 'bar' => 'barValue'];
     $options = ['left' => new PropertyPath('foo'), 'right' => new PropertyPath('bar')];
     $left = $options['left'];
     $right = $options['right'];
     $keys = array_keys($context);
     $rightKey = end($keys);
     $leftKey = reset($keys);
     $this->condition->initialize($options);
     $message = 'Compare {{ left }} with {{ right }}.';
     $this->condition->setMessage($message);
     $this->contextAccessor->expects($this->at(0))->method('getValue')->with($context, $left)->will($this->returnValue($context[$leftKey]));
     $this->contextAccessor->expects($this->at(1))->method('getValue')->with($context, $right)->will($this->returnValue($context[$rightKey]));
     $this->condition->expects($this->once())->method('doCompare')->with($context[$leftKey], $context[$rightKey])->will($this->returnValue(false));
     $this->contextAccessor->expects($this->at(2))->method('getValue')->with($context, $left)->will($this->returnValue($context[$leftKey]));
     $this->contextAccessor->expects($this->at(3))->method('getValue')->with($context, $right)->will($this->returnValue($context[$rightKey]));
     $errors = new ArrayCollection();
     $this->assertFalse($this->condition->evaluate($context, $errors));
     $this->assertCount(1, $errors);
     $this->assertEquals(['message' => $message, 'parameters' => ['{{ left }}' => $context[$leftKey], '{{ right }}' => $context[$rightKey]]], $errors->get(0));
 }
开发者ID:ramunasd,项目名称:platform,代码行数:22,代码来源:AbstractComparisonTest.php

示例9: renderSetsCheckedAttributeForListOfObjects

 /**
  * @test
  */
 public function renderSetsCheckedAttributeForListOfObjects()
 {
     $mockTagBuilder = $this->getMock(TagBuilder::class, array('setTagName', 'addAttribute'));
     $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('type', 'checkbox');
     $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo[]');
     $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 2);
     $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('checked', 'checked');
     $object1 = new \stdClass();
     $object2 = new \stdClass();
     $object3 = new \stdClass();
     $this->viewHelper->expects($this->any())->method('getName')->willReturn('foo');
     $this->viewHelper->expects($this->any())->method('getValueAttribute')->willReturn(2);
     $this->viewHelper->expects($this->any())->method('isObjectAccessorMode')->willReturn(true);
     $this->viewHelper->expects($this->any())->method('getPropertyValue')->willReturn(array($object1, $object2, $object3));
     $this->viewHelper->_set('tag', $mockTagBuilder);
     $mockPersistenceManager = $this->getMock(PersistenceManagerInterface::class);
     $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValueMap(array(array($object1, 1), array($object2, 2), array($object3, 3))));
     $this->viewHelper->_set('persistenceManager', $mockPersistenceManager);
     $this->viewHelper->initialize();
     $this->viewHelper->render();
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:24,代码来源:CheckboxViewHelperTest.php


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