43 if ( !$this->db->tableExists(
'testrun', __METHOD__ )
44 || !$this->db->tableExists(
'testitem', __METHOD__ )
46 print
"WARNING> `testrun` table not found in database.\n";
47 $this->prevRun =
false;
50 $this->prevRun = $this->db->selectField(
'testrun',
'MAX(tr_id)' );
57 $this->results[$test[
'desc']] =
$result->isSuccess() ? 1 : 0;
61 if ( $this->prevRun ) {
65 'fp' =>
'previously failing test(s) now PASSING! :)',
66 'pn' =>
'previously PASSING test(s) removed o_O',
67 'np' =>
'new PASSING test(s) :)',
69 'pf' =>
'previously passing test(s) now FAILING! :(',
70 'fn' =>
'previously FAILING test(s) removed O_o',
71 'nf' =>
'new FAILING test(s) :(',
72 'ff' =>
'still FAILING test(s) :(',
77 $res = $this->db->select(
'testitem', [
'ti_name',
'ti_success' ],
78 [
'ti_run' => $this->prevRun ], __METHOD__ );
83 $prevResults[$row->ti_name] = $row->ti_success;
87 $combined = array_keys( $this->results + $prevResults );
89 # Determine breakdown by change type
91 foreach ( $combined
as $test ) {
92 if ( !isset( $prevResults[$test] ) ) {
94 } elseif ( $prevResults[$test] == 1 ) {
100 if ( !isset( $this->results[$test] ) ) {
102 } elseif ( $this->results[$test] == 1 ) {
108 $code = $before . $after;
110 if ( isset( $table[
$code] ) ) {
116 foreach ( $table
as $code => $label ) {
117 if ( !empty( $breakdown[
$code] ) ) {
119 printf(
"\n%4d %s\n", $count, $label );
121 foreach ( $breakdown[
$code]
as $differing_test_name => $statusInfo ) {
122 print
" * $differing_test_name [$statusInfo]\n";
127 print
"No previous test runs to compare against.\n";
143 if ( $after ==
'n' ) {
144 $changedRun = $this->db->selectField(
'testitem',
146 [
'ti_name' => $testname ],
148 $appear = $this->db->selectRow(
'testrun',
149 [
'tr_date',
'tr_mw_version' ],
150 [
'tr_id' => $changedRun ],
153 return "First recorded appearance: "
154 . date(
"d-M-Y H:i:s", strtotime( $appear->tr_date ) )
155 .
", " . $appear->tr_mw_version;
161 'ti_name' => $testname,
162 'ti_success' => ( $after ==
'f' ?
"1" :
"0" ) ];
164 if ( $this->curRun ) {
165 $conds[] =
"ti_run != " . $this->db->addQuotes( $this->curRun );
168 $changedRun = $this->db->selectField(
'testitem',
'MAX(ti_run)', $conds, __METHOD__ );
171 if ( is_null( $changedRun ) ) {
172 if ( $after ==
"f" ) {
173 return "Has never passed";
175 return "Has never failed";
182 $pre = $this->db->selectRow(
'testrun',
183 [
'tr_date',
'tr_mw_version' ],
184 [
'tr_id' => $changedRun ],
186 $post = $this->db->selectRow(
'testrun',
187 [
'tr_date',
'tr_mw_version' ],
188 [
"tr_id > " . $this->db->addQuotes( $changedRun ) ],
190 [
"LIMIT" => 1,
"ORDER BY" =>
'tr_id' ]
194 $postDate = date(
"d-M-Y H:i:s", strtotime( $post->tr_date ) ) .
", {$post->tr_mw_version}";
199 return ( $after ==
"f" ?
"Introduced" :
"Fixed" ) .
" between "
200 . date(
"d-M-Y H:i:s", strtotime(
$pre->tr_date ) ) .
", " .
$pre->tr_mw_version