4 use Psr\Log\LoggerInterface;
11 use MediaWikiCoversValidator;
15 $logger->expects( $this->exactly( 3 ) )->method(
'warning' );
18 $tp->setLogger( $logger );
19 $tp->setExpectation(
'maxAffected', 100, __METHOD__ );
21 $tp->transactionWritingIn(
'srv1',
'db1',
'123' );
22 $tp->recordQueryCompletion(
"SQL 1", microtime(
true ) - 3,
true, 200 );
23 $tp->recordQueryCompletion(
"SQL 2", microtime(
true ) - 3,
true, 200 );
24 $tp->transactionWritingOut(
'srv1',
'db1',
'123', 1, 400 );
30 $logger->expects( $this->exactly( 2 ) )->method(
'warning' );
33 $tp->setLogger( $logger );
34 $tp->setExpectation(
'readQueryTime', 5, __METHOD__ );
36 $tp->transactionWritingIn(
'srv1',
'db1',
'123' );
37 $tp->recordQueryCompletion(
"SQL 1", microtime(
true ) - 10,
false, 1 );
38 $tp->recordQueryCompletion(
"SQL 2", microtime(
true ) - 10,
false, 1 );
39 $tp->transactionWritingOut(
'srv1',
'db1',
'123', 0, 0 );
45 $logger->expects( $this->exactly( 4 ) )->method(
'warning' );
48 $tp->setLogger( $logger );
49 $tp->setExpectation(
'writeQueryTime', 5, __METHOD__ );
51 $tp->transactionWritingIn(
'srv1',
'db1',
'123' );
52 $tp->recordQueryCompletion(
"SQL 1", microtime(
true ) - 10,
true, 1 );
53 $tp->recordQueryCompletion(
"SQL 2", microtime(
true ) - 10,
true, 1 );
54 $tp->transactionWritingOut(
'srv1',
'db1',
'123', 20, 1 );
59 $logger->expects( $this->exactly( 1 ) )->method(
'warning' );
62 $tp->setLogger( $logger );
63 $tp->setExpectation(
'maxAffected', 100, __METHOD__ );
65 $tp->transactionWritingIn(
'srv1',
'db1',
'123' );
66 $tp->transactionWritingOut(
'srv1',
'db1',
'123', 1, 200 );
72 $logger->expects( $this->exactly( 2 ) )->method(
'warning' );
75 $tp->setLogger( $logger );
76 $tp->setExpectation(
'writeQueryTime', 5, __METHOD__ );
78 $tp->transactionWritingIn(
'srv1',
'db1',
'123' );
79 $tp->transactionWritingOut(
'srv1',
'db1',
'123', 10, 1 );
84 $logger->expects( $this->exactly( 2 ) )->method(
'warning' );
87 $tp->setLogger( $logger );
88 $tp->setExpectation(
'conns', 2, __METHOD__ );
90 $tp->recordConnection(
'srv1',
'db1',
false );
91 $tp->recordConnection(
'srv1',
'db2',
false );
92 $tp->recordConnection(
'srv1',
'db3',
false );
93 $tp->recordConnection(
'srv1',
'db4',
false );
98 $logger->expects( $this->exactly( 2 ) )->method(
'warning' );
101 $tp->setLogger( $logger );
102 $tp->setExpectation(
'masterConns', 2, __METHOD__ );
104 $tp->recordConnection(
'srv1',
'db1',
false );
105 $tp->recordConnection(
'srv1',
'db2',
false );
107 $tp->recordConnection(
'srv1',
'db1',
true );
108 $tp->recordConnection(
'srv1',
'db2',
true );
109 $tp->recordConnection(
'srv1',
'db3',
true );
110 $tp->recordConnection(
'srv1',
'db4',
true );
115 $logger->expects( $this->exactly( 2 ) )->method(
'warning' );
118 $tp->setLogger( $logger );
119 $tp->setExpectation(
'queries', 2, __METHOD__ );
121 $tp->recordQueryCompletion(
"SQL 1", microtime(
true ) - 0.01,
false, 0 );
122 $tp->recordQueryCompletion(
"SQL 2", microtime(
true ) - 0.01,
false, 0 );
123 $tp->recordQueryCompletion(
"SQL 3", microtime(
true ) - 0.01,
false, 0 );
124 $tp->recordQueryCompletion(
"SQL 4", microtime(
true ) - 0.01,
false, 0 );
129 $logger->expects( $this->exactly( 2 ) )->method(
'warning' );
132 $tp->setLogger( $logger );
133 $tp->setExpectation(
'writes', 2, __METHOD__ );
135 $tp->recordQueryCompletion(
"SQL 1", microtime(
true ) - 0.01,
false, 0 );
136 $tp->recordQueryCompletion(
"SQL 2", microtime(
true ) - 0.01,
false, 0 );
137 $tp->recordQueryCompletion(
"SQL 3", microtime(
true ) - 0.01,
false, 0 );
138 $tp->recordQueryCompletion(
"SQL 4", microtime(
true ) - 0.01,
false, 0 );
140 $tp->transactionWritingIn(
'srv1',
'db1',
'123' );
141 $tp->recordQueryCompletion(
"SQL 1w", microtime(
true ) - 0.01,
true, 2 );
142 $tp->recordQueryCompletion(
"SQL 2w", microtime(
true ) - 0.01,
true, 5 );
143 $tp->recordQueryCompletion(
"SQL 3w", microtime(
true ) - 0.01,
true, 3 );
144 $tp->recordQueryCompletion(
"SQL 4w", microtime(
true ) - 0.01,
true, 1 );
145 $tp->transactionWritingOut(
'srv1',
'db1',
'123', 1, 1 );