Пример #1
0
 private function connect()
 {
     LudoDB::setHost('127.0.0.1');
     LudoDB::setUser('root');
     LudoDB::setPassword('administrator');
     LudoDB::setDb('PHPUnit');
     $this->connected = true;
 }
Пример #2
0
 public function setUp()
 {
     if (!self::$connected) {
         date_default_timezone_set('Europe/Berlin');
         LudoDB::setHost('localhost');
         LudoDB::setUser('root');
         LudoDB::setPassword('administrator');
         LudoDB::setDb('PHPUnit');
         self::$connected = true;
         LudoDBRegistry::set('FILE_UPLOAD_PATH', '/tmp/');
     }
     if (!self::$logCleared) {
         self::$logCleared = true;
         $this->clearLog();
     }
     $classes = array('Game', 'Move', 'Database', 'Folder', 'Metadata', 'MetadataValue', 'Session', 'Seek', 'Chat', 'ChatMessage', 'ChatMessages', 'Fen', 'Player', 'TimeControl', 'ChessFileUpload', 'Elo', 'PasswordLookup');
     $util = new LudoDBUtility();
     $util->dropAndCreate($classes);
     $this->createAdminUserAndSignIn();
 }
Пример #3
0
<?php

/**
 * Created by JetBrains PhpStorm.
 * 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']);
Пример #4
0
<?php

/**
 * Your database connection details
 * User: Alf Magne Kalleland
 * Date: 23.02.13
 * Time: 06:07
 */
LudoDB::setUser('consultl_user');
LudoDB::setPassword('passwords123');
LudoDB::setHost('localhost');
LudoDB::setDb('consultl_dhtmlchess');
Пример #5
0
<?php

/**
 * Demo of nested collections. DemoCountries merges DemoStates
 * and DemoStates merges DemoCities.
 * User: Alf Magne Kalleland
 * Date: 09.02.13
 * Time: 16:34
 */
require_once __DIR__ . "/autoload.php";
ini_set('display_errors', 'on');
date_default_timezone_set("Europe/Berlin");
LudoDB::setDb("PHPUnit");
LudoDB::setUser("root");
LudoDB::setPassword("administrator");
LudoDB::setHost("127.0.0.1");
$c = new DemoCountry();
if (!$c->exists()) {
    $util = new LudoDBUtility();
    $util->dropAndCreate(array("DemoState", "DemoCity", "DemoCountry"));
}
LudoDB::enableLogging();
// get number of queries and server time in response
$handler = new LudoDBRequestHandler();
echo $handler->handle("DemoCountries/read");
<?php

/**
 * Your database connection details
 * User: Alf Magne Kalleland
 * Date: 23.02.13
 * Time: 06:07
 */
LudoDB::setUser('root');
LudoDB::setPassword('administrator');
LudoDB::setHost('127.0.0.1');
LudoDB::setDb('dhtml_chess');
Пример #7
0
 private function setConnectionDetails($dbDetails)
 {
     LudoDB::setDb($dbDetails['db']);
     LudoDB::setUser($dbDetails['username']);
     LudoDB::setPassword($dbDetails['password']);
     LudoDB::setHost($dbDetails['host']);
 }