MediaWiki REL1_33
DbTestRecorder.php
Go to the documentation of this file.
1<?php
23
25 public $version;
27 private $db;
28
30 $this->db = $db;
31 }
32
37 function start() {
38 $this->db->begin( __METHOD__ );
39
40 if ( !$this->db->tableExists( 'testrun' )
41 || !$this->db->tableExists( 'testitem' )
42 ) {
43 print "WARNING> `testrun` table not found in database. Trying to create table.\n";
45 $this->db->sourceFile( $updater->patchPath( $this->db, 'patch-testrun.sql' ) );
46 echo "OK, resuming.\n";
47 }
48
49 $this->db->insert( 'testrun',
50 [
51 'tr_date' => $this->db->timestamp(),
52 'tr_mw_version' => $this->version,
53 'tr_php_version' => PHP_VERSION,
54 'tr_db_version' => $this->db->getServerVersion(),
55 'tr_uname' => php_uname()
56 ],
57 __METHOD__ );
58 if ( $this->db->getType() === 'postgres' ) {
59 $this->curRun = $this->db->currentSequenceValue( 'testrun_id_seq' );
60 } else {
61 $this->curRun = $this->db->insertId();
62 }
63 }
64
71 function record( $test, ParserTestResult $result ) {
72 $this->db->insert( 'testitem',
73 [
74 'ti_run' => $this->curRun,
75 'ti_name' => $test['desc'],
76 'ti_success' => $result->isSuccess() ? 1 : 0,
77 ],
78 __METHOD__ );
79 }
80
84 function end() {
85 $this->db->commit( __METHOD__ );
86 }
87}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
static newForDB(IMaintainableDatabase $db, $shared=false, Maintenance $maintenance=null)
__construct(IMaintainableDatabase $db)
record( $test, ParserTestResult $result)
Record an individual test item's success or failure to the db.
start()
Set up result recording; insert a record for the run with the date and all that fun stuff.
end()
Commit transaction and clean up for result recording.
Represent the result of a parser test.
Interface to record parser test results.
while(( $__line=Maintenance::readconsole()) !==false) print
Definition eval.php:64
Advanced database interface for IDatabase handles that include maintenance methods.
$page->newPageUpdater($user) $updater