本文整理匯總了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());
}