本文整理汇总了PHP中Game::setDatabaseId方法的典型用法代码示例。如果您正苦于以下问题:PHP Game::setDatabaseId方法的具体用法?PHP Game::setDatabaseId怎么用?PHP Game::setDatabaseId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game::setDatabaseId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shouldBeAbleToCreateGame
/**
* @test
*/
public function shouldBeAbleToCreateGame()
{
// given
$game = new Game();
$game->setDatabaseId(1);
$game->commit();
$game->setMetadata($this->getMetadataValues());
$id = $game->getId();
// when
$newGame = new Game($id);
// then
$this->assertNotNull($id);
$this->assertEquals(1, $newGame->getDatabaseId());
}
示例2: shouldBeAbleToCreateMetadataForAGame
/**
* @test
*/
public function shouldBeAbleToCreateMetadataForAGame()
{
// given
$m = new MetadataValue();
$game = new Game();
$game->setDatabaseId(1);
$game->commit();
// when
$m->setGameId(1);
$m->setMetadataKey('Black');
$m->setMetadataValue('Magnus Carlsen');
$m->commit();
$id = $m->getId();
$m = new MetadataValue(1, 'Black');
// then
$this->assertEquals($id, $m->getId());
}
示例3: array
* User: Alf Magne
* Date: 23.01.13
* Time: 14:52
* To change this template use File | Settings | File Templates.
*/
ini_set('display_errors', 'on');
date_default_timezone_set("Europe/Berlin");
require_once __DIR__ . "/../autoload.php";
LudoDB::setHost('127.0.0.1');
LudoDB::setUser('root');
LudoDB::setPassword('administrator');
LudoDB::setDb('PHPUnit');
// Construct database tables
$tables = array('Move', 'Game', 'Fen', 'Metadata', 'MetadataValue');
foreach ($tables as $table) {
$inst = new $table();
$inst->drop()->yesImSure();
$inst->createTable();
}
$profiling = new XHPProfiling('PGN to parser to DB');
$parser = new PgnParser("../../pgn/profiling.pgn");
$games = $parser->getGames();
foreach ($games as $gameData) {
$game = new Game();
$game->setDatabaseId(100);
$game->setFen($gameData['metadata']['fen']);
$game->setMetadata($gameData['metadata']);
$game->setMoves($gameData['moves']);
$game->commit();
}
echo $profiling->end();