'/local', // Database endpoint 'endpoint' => 'localhost:2136', // Auto discovery (dedicated server only) 'discovery' => false, // IAM config 'iam_config' => [ 'insecure' => true, ], 'credentials' => new AnonymousAuthentication() ]; $ydb = new Ydb($config, new SimpleStdLogger(SimpleStdLogger::DEBUG)); $table = $ydb->table(); $session = $table->createSession(); $testsQuery = [ ['mode' => 'stale_read_only', 'result' => ['stale_read_only' => new StaleModeSettings], 'interactive' => false], ['mode' => 'stale', 'result' => ['stale_read_only' => new StaleModeSettings], 'interactive' => false], ['mode' => 'online_read_only', 'result' => ['online_read_only' => new OnlineModeSettings([ 'allow_inconsistent_reads' => false, ])], 'interactive' => false], ['mode' => 'online', 'result' => ['online_read_only' => new OnlineModeSettings([ 'allow_inconsistent_reads' => false, ])], 'interactive' => false], ['mode' => 'inconsistent_reads', 'result' => ['online_read_only' => new OnlineModeSettings([ 'allow_inconsistent_reads' => true, ])], 'interactive' => false], ['mode' => 'online_inconsistent', 'result' => ['online_read_only' => new OnlineModeSettings([ 'allow_inconsistent_reads' => true, ])], 'interactive' => false], ['mode' => 'online_inconsistent_reads', 'result' => ['online_read_only' => new OnlineModeSettings([ 'allow_inconsistent_reads' => true, ])], 'interactive' => false], ['mode' => 'snapshot', 'result' => ['snapshot_read_only' => new SnapshotModeSettings], 'interactive' => true], ['mode' => 'snapshot_read_only', 'result' => ['snapshot_read_only' => new SnapshotModeSettings], 'interactive' => true], ['mode' => 'serializable', 'result' => ['serializable_read_write' => new SerializableModeSettings], 'interactive' => true], ['mode' => 'serializable_read_write', 'result' => ['serializable_read_write' => new SerializableModeSettings], 'interactive' => true], ]; foreach ($testsQuery as $i => $test){ self::assertEquals($test["result"], parseTxMode($test["mode"])); $query= $session->newQuery("SELECT 1;") ->beginTx($test['mode']); $query->execute(); if ($test['interactive']){ $table->transaction(function (){}, $test['mode']); } } } }