protected function getPlayer($id, $name) { $player = new Player(); $player->setId($id); $player->setName($name); return $player; }
public function setUp() { $this->player1 = new Player(); $this->player1->setName('Foo'); $this->player2 = new Player(); $this->player2->setName('Bar'); $this->team = new Team($this->player1, $this->player2); }
/** * @param Player $player * * @return PointLog[] */ public function getForPlayer(Player $player) { $sql = "\n SELECT\n *\n FROM\n pointlog pl\n LEFT JOIN\n match m ON m.id = pl.match_id\n WHERE\n m.player1_id = :id\n OR\n m.player2_id = :id\n OR\n m.team1attack = :id\n OR\n m.team1defence = :id\n OR\n m.team2attack = :id\n OR\n m.team2defence = :id\n ORDER BY\n m.date DESC"; $rsm = new ResultSetMappingBuilder($this->_em); $rsm->addRootEntityFromClassMetadata('Application\\Model\\Entity\\PointLog', 'pl'); $query = $this->_em->createNativeQuery($sql, $rsm); $query->setParameter('id', $player->getId()); $logs = $query->getResult(); return $logs; }
public function testExchangeArrayWithEmptyArray() { $this->player->exchangeArray(array()); $this->assertThat($this->player, new PlayerConstraint(null, null)); }