blob: 72b070dbb7e5422eaf80e4d1062a8052976deffb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<?php
namespace SMW\Tests\MediaWiki\Connection;
use SMW\MediaWiki\Connection\TransactionProfiler;
use SMW\Tests\PHPUnitCompat;
/**
* @covers \SMW\MediaWiki\Connection\TransactionProfiler
* @group semantic-mediawiki
*
* @license GNU GPL v2+
* @since 3.0
*
* @author mwjames
*/
class TransactionProfilerTest extends \PHPUnit_Framework_TestCase {
use PHPUnitCompat;
private $connection;
protected function setUp() {
$this->transactionProfiler = $this->getMockBuilder( '\stdClass' )
->disableOriginalConstructor()
->setMethods( [ 'setSilenced' ] )
->getMock();
}
public function testCanConstruct() {
$this->assertInstanceOf(
TransactionProfiler::class,
new TransactionProfiler( $this->transactionProfiler )
);
}
public function testSetSilenced_Enabled() {
$instance = new TransactionProfiler(
$this->transactionProfiler
);
$instance->silenceTransactionProfiler();
$this->transactionProfiler->expects( $this->once() )
->method( 'setSilenced' );
$instance->setSilenced( true );
}
public function testSetSilenced_NotEnabled() {
$instance = new TransactionProfiler(
$this->transactionProfiler
);
$this->transactionProfiler->expects( $this->never() )
->method( 'setSilenced' );
$instance->setSilenced( true );
}
}
|