本文整理汇总了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());
}
示例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()));
}
示例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());
}