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


PHP PHPUnit_Framework_MockObject_MockObject::add方法代码示例

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


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

示例1: testAdd

 public function testAdd()
 {
     $this->varReaderWriter->expects($this->once())->method('isExist')->willReturn(false);
     $this->varReaderWriter->expects($this->once())->method('writeFile');
     $this->logger->expects($this->once())->method('log')->with(\Psr\Log\LogLevel::ERROR, 'test1');
     $this->status->add('test1', \Psr\Log\LogLevel::ERROR);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:StatusTest.php

示例2: getCommandTester

 protected function getCommandTester()
 {
     $this->application->add($this->command);
     $command = $this->application->find('phpci:create-build');
     $commandTester = new CommandTester($command);
     return $commandTester;
 }
开发者ID:nelsonyang0710,项目名称:PHPCI,代码行数:7,代码来源:CreateBuildCommandTest.php

示例3: testAdd

 /**
  * Test add log message
  */
 public function testAdd()
 {
     $configMock = $this->getMock(\Magelight\Config::class, [], [], '', false);
     \Magelight\Config::forgeMock($configMock);
     $configMock->expects($this->any())->method('getConfig')->with('global/log/file', \Magelight\Log::DEFAUL_LOG_FILE)->will($this->returnValue('application.log'));
     $this->log->expects($this->once())->method('writeMessage')->with($this->matchesRegularExpression("/[\\-\\:\\d]+\\s\\-\\serror/i"));
     $this->log->add('error');
 }
开发者ID:rganin,项目名称:magelight,代码行数:11,代码来源:LogTest.php

示例4: getCommandTester

 /**
  * @return CommandTester
  */
 protected function getCommandTester()
 {
     $this->application->getHelperSet()->set($this->dialog, 'dialog');
     $this->application->add($this->command);
     $command = $this->application->find('phpci:create-admin');
     $commandTester = new CommandTester($command);
     return $commandTester;
 }
开发者ID:stefanius,项目名称:phpci-box,代码行数:11,代码来源:CreateAdminCommandTest.php

示例5: testAdd

 public function testAdd()
 {
     $id = 'test_id';
     $parentId = 'test_parent_id';
     $blockType = 'test_block_type';
     $options = ['test' => 'val'];
     $siblingId = 'test_sibling_id';
     $prepend = true;
     $this->layoutManipulator->expects($this->once())->method('add')->with($id, $parentId, $blockType, $options, $siblingId, $prepend);
     $result = $this->layoutBuilder->add($id, $parentId, $blockType, $options, $siblingId, $prepend);
     $this->assertSame($this->layoutBuilder, $result);
 }
开发者ID:Maksold,项目名称:platform,代码行数:12,代码来源:LayoutBuilderTest.php

示例6: testInstance

 public function testInstance()
 {
     $this->generateInstance();
     $this->testInstance->expects($this->any())->method('getType')->will($this->returnValue(self::class));
     $this->testInstance->add(0, $this);
     $this->testInstance->offsetSet(0, $this);
     $this->testInstance->push($this);
     $this->testInstance->unshift($this);
     try {
         $this->testInstance->offsetSet(0, $this->testInstance);
     } catch (Exception $e) {
         $this->assertTrue($e instanceof InvalidArgumentException);
     }
 }
开发者ID:laravel-commode,项目名称:utils,代码行数:14,代码来源:TypeStackTest.php

示例7: testFilterWorksProperly

 /**
  * @covers Basics\Collection\TypedList::filter
  */
 public function testFilterWorksProperly()
 {
     $at0NotMatching = $this->expectItem();
     $at1Matching = $this->expectItem();
     $at2NotMatching = $this->expectItem();
     $at3NotMatching = $this->expectItem();
     $at4Matching = $this->expectItem();
     $at5NotMatching = $this->expectItem();
     $this->expectSuccessiveCallsOnIsExpectedType(6, true);
     $this->typedList->add($at0NotMatching);
     $this->typedList->add($at1Matching);
     $this->typedList->add($at2NotMatching);
     $this->typedList->add($at3NotMatching);
     $this->typedList->add($at4Matching);
     $this->typedList->add($at5NotMatching);
     $matcher = function (Item $item) use($at1Matching, $at4Matching) {
         if ($at1Matching === $item || $at4Matching === $item) {
             return true;
         }
         return false;
     };
     $result = $this->invokeUnreachableMethod($this->typedList, 'filter', array($matcher));
     $this->assertCount(2, $result);
     $this->assertSame(array($at1Matching, $at4Matching), $result);
 }
开发者ID:makii42,项目名称:basic-utils,代码行数:28,代码来源:TypedListTest.php

示例8: testRetry

 /**
  * QueueShellTest::testRetry()
  *
  * @return void
  */
 public function testRetry()
 {
     $this->QueueShell->args[] = 'RetryExample';
     $this->QueueShell->add();
     $expected = 'This is a very simple example of a QueueTask and how retries work';
     $this->assertContains($expected, $this->out->output());
     $this->QueueShell->runworker();
     $this->assertContains('Job did not finish, requeued.', $this->out->output());
 }
开发者ID:dereuromark,项目名称:cakephp-queue,代码行数:14,代码来源:QueueShellTest.php

示例9: testUploadFailNoClass

 public function testUploadFailNoClass()
 {
     $filePath = dirname(__DIR__) . '/sample/Italy.png';
     $this->service->expects($this->once())->method('createMediaInstance')->with($filePath, $this->classUri, 'EN_en', 'Italy1.png')->willReturn('http://www.tao.lu/Ontologies/TAO.rdf#MyLink');
     //mock the fileInfo method
     $fileInfo = array('name' => 'myName', 'mime' => 'mime/type', 'size' => 1024);
     $this->mediaManagerManagement->expects($this->once())->method('getFileInfo')->with('http://www.tao.lu/Ontologies/TAO.rdf#MyLink')->willReturn($fileInfo);
     $success = $this->mediaManagerManagement->add($filePath, 'Italy1.png', $this->classUri);
     $this->assertInternalType('array', $success, 'Should be a file info array');
     $this->assertArrayNotHasKey('error', $success, 'upload doesn\'t succeed');
     $this->assertEquals($fileInfo, $success, 'Doesn\'t return the getFileInfo value');
 }
开发者ID:nagyist,项目名称:extension-tao-mediamanager,代码行数:12,代码来源:MediaManagerManagementTest.php

示例10: findByParentAndNodeTypeIncludesAddedNodeInRepositoryAndRespectsWorkspaceAndDimensions

 /**
  * @test
  */
 public function findByParentAndNodeTypeIncludesAddedNodeInRepositoryAndRespectsWorkspaceAndDimensions()
 {
     $liveWorkspace = new Workspace('live');
     $nodeData = $this->getMockBuilder(NodeData::class)->disableOriginalConstructor()->getMock();
     $nodeData->expects($this->any())->method('getIdentifier')->will($this->returnValue('abcd-efgh-ijkl-mnop'));
     $nodeData->expects($this->any())->method('getPath')->will($this->returnValue('/foo/bar'));
     $nodeData->expects($this->any())->method('getDepth')->will($this->returnValue(2));
     $this->nodeDataRepository->add($nodeData);
     $dimensions = array('persona' => array('everybody'), 'language' => array('de_DE', 'mul_ZZ'));
     $nodeData->expects($this->atLeastOnce())->method('matchesWorkspaceAndDimensions')->with($liveWorkspace, $dimensions)->will($this->returnValue(true));
     $this->nodeDataRepository->expects($this->any())->method('getNodeDataForParentAndNodeType')->will($this->returnValue(array()));
     $this->nodeDataRepository->expects($this->once())->method('getNodeTypeFilterConstraintsForDql')->will($this->returnValue(array('excludeNodeTypes' => array(), 'includeNodeTypes' => array())));
     $result = $this->nodeDataRepository->findByParentAndNodeType('/foo', null, $liveWorkspace, $dimensions);
     $this->assertCount(1, $result);
     $fetchedNodeData = reset($result);
     $this->assertSame($nodeData, $fetchedNodeData);
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:20,代码来源:NodeDataRepositoryTest.php

示例11: addChecksObjectType

 /**
  * @test
  * @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
  */
 public function addChecksObjectType()
 {
     $this->repository->_set('objectType', 'ExpectedObjectType');
     $this->repository->add(new \stdClass());
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:9,代码来源:RepositoryTest.php

示例12: addThrowsException

 /**
  * @test
  *
  * @expectedException \BadMethodCallException
  */
 public function addThrowsException()
 {
     $this->subject->add(new AbstractEntity());
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:9,代码来源:AbstractEntityRepositoryTest.php


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