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


PHP ObjectProphecy::findForGameByTypeAndPlayer方法代码示例

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


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

示例1: testValidateWhenEventNotCreatedYet

 public function testValidateWhenEventNotCreatedYet()
 {
     $constraint = $this->prophesize('AppBundle\\Validator\\Constraints\\UniqueEvent');
     $event = $this->prophesize('AppBundle\\Entity\\Event');
     $game = $this->prophesize('AppBundle\\Entity\\Game');
     $collection = $this->prophesize('Doctrine\\Common\\Collections\\Collection');
     $constraint->uniqueEvents = ['unique event1', 'unique event2'];
     $this->context->getRoot()->willReturn($event);
     $event->getGame()->willReturn($game);
     $game->getPlayerNumber()->willReturn(1);
     $this->eventRepository->findForGameByTypeAndPlayer($game, 'non-unique event', 1)->willReturn($collection);
     $collection->isEmpty()->willReturn(true);
     $this->validator->validate('non-unique event', $constraint->reveal());
 }
开发者ID:jlekowski,项目名称:battleships-api,代码行数:14,代码来源:UniqueEventValidatorTest.php

示例2: testGetShotResultSunk

 public function testGetShotResultSunk()
 {
     $shotEvent = $this->prophesize('AppBundle\\Entity\\Event');
     $event = $this->prophesize('AppBundle\\Entity\\Event');
     $game = $this->prophesize('AppBundle\\Entity\\Game');
     $shotEvent->getValue()->willReturn('D2');
     $event->getType()->willReturn(Event::TYPE_SHOT);
     $event->getGame()->willReturn($game);
     $event->getValue()->willReturn('C2');
     $event->getPlayer()->willReturn(1);
     $game->getOtherShips()->willReturn(['C2', 'D2']);
     $attackerShots = [$shotEvent];
     $this->eventRepository->findForGameByTypeAndPlayer($game, Event::TYPE_SHOT, 1)->willReturn($attackerShots);
     $this->assertEquals(BattleManager::SHOT_RESULT_SUNK, $this->battleManager->getShotResult($event->reveal()));
 }
开发者ID:jlekowski,项目名称:battleships-api,代码行数:15,代码来源:BattleManagerTest.php

示例3: testValidatePlayerTurnBecauseFirstShot

 public function testValidatePlayerTurnBecauseFirstShot()
 {
     $constraint = $this->prophesize('AppBundle\\Validator\\Constraints\\IsAllowedToShoot');
     $event = $this->prophesize('AppBundle\\Entity\\Event');
     $game = $this->prophesize('AppBundle\\Entity\\Game');
     $collection = $this->prophesize('Doctrine\\Common\\Collections\\Collection');
     $lastShotEvent = false;
     $event->getType()->willReturn(Event::TYPE_SHOT);
     $event->getGame()->willReturn($game);
     $game->getOtherNumber()->willReturn(2);
     $game->getPlayerNumber()->willReturn(1);
     $collection->isEmpty()->willReturn(false);
     $this->eventRepository->findForGameByTypeAndPlayer($game, Event::TYPE_START_GAME, 2)->willReturn($collection);
     $this->eventRepository->findLastForGameByType($game, Event::TYPE_SHOT)->willReturn($lastShotEvent);
     $this->validator->validate($event->reveal(), $constraint->reveal());
 }
开发者ID:jlekowski,项目名称:battleships-api,代码行数:16,代码来源:IsAllowedToShootValidatorTest.php


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