本文整理汇总了PHP中Phake::times方法的典型用法代码示例。如果您正苦于以下问题:PHP Phake::times方法的具体用法?PHP Phake::times怎么用?PHP Phake::times使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phake
的用法示例。
在下文中一共展示了Phake::times方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSkipsDictionariesWithoutCustomSuffixInFilenameCustom
public function testSkipsDictionariesWithoutCustomSuffixInFilenameCustom()
{
$this->createLoader('testlangcode');
$dictionariesDir = $this->resourcesDir . '/no-dictionaries';
$this->dictionaryLoader->addFromDir($dictionariesDir);
Phake::verify($this->templateMock, Phake::times(0))->includeInlineTranslation(Phake::anyParameters());
}
示例2: parseNormal
/**
* @test
*/
public function parseNormal()
{
\Phake::when($this->parser)->parse(\Phake::anyParameters())->thenReturn(null);
$path = __DIR__ . '/../fixtures/1';
$this->projectParser->parse($path);
\Phake::verify($this->parser, \Phake::times(3))->parse(\Phake::anyParameters());
}
示例3: testStorageDestruct
public function testStorageDestruct()
{
$this->Web->queries($this->queries);
$this->Web->crawl();
// assertion maximus
\Phake::verify($this->Storage, \Phake::times(1))->destruct();
}
示例4: testBuild
public function testBuild()
{
$builder = \Phake::mock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
$bundle = new ModeraMJRSecurityIntegrationBundle();
$bundle->build($builder);
\Phake::verify($builder, \Phake::times(1))->addCompilerPass($this->isInstanceOf('Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface'));
}
示例5: clearsThePrecedingOutputHandlers
/**
* @test
*
* @link http://redmine.piece-framework.com/issues/323
*/
public function clearsThePrecedingOutputHandlers()
{
$legacyProxy = \Phake::mock('Stagehand\\TestRunner\\Util\\LegacyProxy');
\Phake::when($legacyProxy)->ob_get_level()->thenReturn(2)->thenReturn(1)->thenReturn(0);
\Phake::when($legacyProxy)->ob_end_clean()->thenReturn(true);
$this->setComponent('legacy_proxy', $legacyProxy);
$this->createComponent('output_buffering')->clearOutputHandlers();
\Phake::verify($legacyProxy, \Phake::times(3))->ob_get_level();
\Phake::verify($legacyProxy, \Phake::times(2))->ob_end_clean();
}
示例6: testValidPostStore
public function testValidPostStore()
{
$rawpost = new Model\RawPost();
$rawpost->setMethod('GET');
$rawpost->setUrl('http://google.com');
$rawpost->setData([1, 2]);
$this->poststore->setRawPost($rawpost);
$this->assertTrue($this->poststore->storePosts());
\Phake::verify($this->storage, \Phake::times(1))->pipeline(\Phake::anyParameters());
}
示例7: testExecuteWorksAndChainAppendedAndProcessed
public function testExecuteWorksAndChainAppendedAndProcessed()
{
$this->chain->addProcessor($this->processorAppend);
$this->chain->addProcessor($this->processorFalse);
$result = $this->chain->execute($this->command);
Phake::verify($this->processorFalse, Phake::times(2))->execute($this->command);
Phake::verify($this->processorAppend)->execute($this->command);
Phake::verify($this->processorTrue)->execute($this->command);
$this->assertSame(TRUE, $result);
}
示例8: should_use_segment_populator_for_content
/** @test */
public function should_use_segment_populator_for_content()
{
$loader = new MappingLoader(realpath(__DIR__ . '/../../src/EDI/Mapping'));
$segmentPopulator = $this->givenSegmentPopulator();
$populator = $this->givenPopulator($segmentPopulator, $loader);
$fixtureDir = realpath(__DIR__ . '/../fixtures');
$parser = new Parser();
$data = $parser->parse($fixtureDir . '/invoic_message_standalone.edi');
$populator->populate($data);
\Phake::verify($segmentPopulator, \Phake::times(37))->populate(\Phake::anyParameters());
}
示例9: testCount
public function testCount()
{
$this->validAction = 'count';
$expectedUrl = $this->getExpectedUrl($this->validBaseUrl, '');
$this->hasMockHttpClient($expectedUrl);
$this->spamReports->setHttpClient($this->mockHttpClient);
$actualResponse = $this->spamReports->count();
\Phake::verify($this->mockHttpClient, \Phake::times(2))->get($expectedUrl);
$this->assertInstanceOf('\\Guzzle\\Http\\Message\\Response', $actualResponse);
$this->assertEquals(200, $actualResponse->getStatusCode());
}
示例10: testSpecificSqlFile
public function testSpecificSqlFile()
{
$application = \Phake::partialMock('Dbup\\Application');
/** want not to run, so change up method to mock */
\Phake::when($application)->up(\Phake::anyParameters())->thenReturn(null);
$application->add(new UpCommand());
$command = $application->find('up');
$commandTester = new CommandTester($command);
$commandTester->execute(['command' => $command->getName(), '--ini' => __DIR__ . '/../.dbup/properties.ini.test', 'file' => 'V12__sample12_select.sql']);
\Phake::verify($application, \Phake::times(1))->up(\Phake::anyParameters());
}
示例11: testCallApiFunctionwithDefaultFromatAndMultipleParametersSomeNull
public function testCallApiFunctionwithDefaultFromatAndMultipleParametersSomeNull()
{
$expectedUrl = $this->getExpectedUrl($this->validBaseUrl, '&date=1');
$this->hasMockHttpClient($expectedUrl);
$this->hasSendGridWebApi();
$this->sendGridWebApiAbstract->addParameter('date', 1);
$this->sendGridWebApiAbstract->addParameter('foo', 'bar');
$this->sendGridWebApiAbstract->addParameter('foo', null);
$actualResponse = $this->sendGridWebApiAbstract->callApiFunction();
\Phake::verify($this->mockHttpClient, \Phake::times(2))->get($expectedUrl);
$this->assertEquals($this->validHttpResponse, $actualResponse);
}
示例12: testOnKernelException
public function testOnKernelException()
{
$event = $this->createMockEvent(true, '/mega-backend', new AccessDeniedException());
$lnr = new AjaxAuthenticationValidatingListener('/mega-backend');
$lnr->onKernelException($event);
\Phake::verify($event, \Phake::times(2))->getRequest();
\Phake::verify($event)->getException();
\Phake::verify($event)->setResponse(\Phake::capture($response));
\Phake::verifyNoOtherInteractions($event);
/* @var JsonResponse $response */
$this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\JsonResponse', $response);
$content = json_decode($response->getContent(), true);
$this->assertTrue(is_array($content));
$this->assertArrayHasKey('success', $content);
$this->assertFalse($content['success']);
$this->assertArrayHasKey('message', $content);
$this->assertTrue('' != $content['message']);
}
示例13: testWork
public function testWork()
{
$worker = \Phake::partialMock('\\Brook\\Worker');
$fanOut = \Phake::partialMock('\\Brook\\FanOut');
$task = \Phake::mock('\\Brook\\TaskInterface');
$server = \Phake::mock('ZMQSocket');
$controller = \Phake::mock('ZMQSocket');
$sink = \Phake::mock('ZMQSocket');
$fanOut->setServer($server);
$fanOut->setController($controller);
$fanOut->setSink($sink);
\Phake::when($fanOut)->sendOffWorker($task)->thenReturn($worker);
\Phake::when($fanOut)->initialize()->thenReturn(true);
$fanOut->distributeWork(3, $task);
$this->assertEquals(3, count($fanOut->getWorkers()));
\Phake::verify($fanOut, \Phake::times(3))->sendOffWorker($task);
\Phake::verify($fanOut)->initialize();
}
示例14: testEventReceivedDuringReplay
public function testEventReceivedDuringReplay()
{
$concurrentMessage = new GenericEventMessage(new Payload("Concurrent MSG"));
$self = $this;
\Phake::when($this->mockEventStore)->visitEvents(\Phake::anyParameters())->thenGetReturnByLambda(function ($visitor, $criteria) use($concurrentMessage, $self) {
$self->assertTrue($self->testSubject->isInReplayMode());
$self->testSubject->publish(array($concurrentMessage));
foreach ($self->messages as $message) {
$visitor->doWithEvent($message);
}
});
$listener = \Phake::mock(ReplayAwareListenerInterface::class);
$this->testSubject->getEventListenerRegistry()->subscribe($listener);
$this->testSubject->startReplay();
\Phake::inOrder(\Phake::verify($this->mockMessageHandler)->prepareForReplay(\Phake::anyParameters()), \Phake::verify($listener)->beforeReplay(), \Phake::verify($this->mockEventStore)->visitEvents(\Phake::anyParameters()), \Phake::verify($this->mockMessageHandler)->onIncomingMessages(\Phake::anyParameters()), \Phake::verify($this->delegate, \Phake::times(10))->publish(\Phake::anyParameters()), \Phake::verify($listener)->afterReplay(), \Phake::verify($this->mockMessageHandler)->processBacklog(\Phake::anyParameters()));
\Phake::verify($this->delegate, \Phake::never())->publish($concurrentMessage);
// \Phake::verify($this->delegate)->subscribe($listener);
}
示例15: testSagaEventsDoNotOvertakeRegularEvents
public function testSagaEventsDoNotOvertakeRegularEvents()
{
$this->testSubject->start();
$self = $this;
\Phake::when($this->listener1)->handle($this->event1)->thenGetReturnByLambda(function ($event) use($self) {
$uow = new DefaultUnitOfWork();
$uow->start();
$uow->registerAggregate($self->mockAggregateRoot, $self->mockEventBus, $self->callback2);
$uow->commit();
return null;
});
$this->testSubject->registerAggregate($this->mockAggregateRoot, $this->mockEventBus, $this->callback1);
$this->testSubject->commit();
\Phake::inOrder(\Phake::verify($this->listener1, \Phake::times(1))->handle($this->event1), \Phake::verify($this->listener2, \Phake::times(1))->handle($this->event1), \Phake::verify($this->listener1, \Phake::times(1))->handle($this->event2), \Phake::verify($this->listener2, \Phake::times(1))->handle($this->event2));
}