本文整理汇总了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);
}
示例2: getCommandTester
protected function getCommandTester()
{
$this->application->add($this->command);
$command = $this->application->find('phpci:create-build');
$commandTester = new CommandTester($command);
return $commandTester;
}
示例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');
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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());
}
示例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');
}
示例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);
}
示例11: addChecksObjectType
/**
* @test
* @expectedException \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
*/
public function addChecksObjectType()
{
$this->repository->_set('objectType', 'ExpectedObjectType');
$this->repository->add(new \stdClass());
}
示例12: addThrowsException
/**
* @test
*
* @expectedException \BadMethodCallException
*/
public function addThrowsException()
{
$this->subject->add(new AbstractEntity());
}