Merge "content: Recognise .json as JsonContent in User and MediaWiki namespace"
[lhc/web/wiklou.git] / tests / phpunit / includes / TestingAccessWrapperTest.php
1 <?php
2
3 class TestingAccessWrapperTest extends MediaWikiTestCase {
4 protected $raw;
5 protected $wrapped;
6
7 function setUp() {
8 parent::setUp();
9
10 require_once __DIR__ . '/../data/helpers/WellProtectedClass.php';
11 $this->raw = new WellProtectedClass();
12 $this->wrapped = TestingAccessWrapper::newFromObject( $this->raw );
13 }
14
15 function testGetProperty() {
16 $this->assertSame( 1, $this->wrapped->property );
17 }
18
19 function testSetProperty() {
20 $this->wrapped->property = 10;
21 $this->assertSame( 10, $this->wrapped->property );
22 $this->assertSame( 10, $this->raw->getProperty() );
23 }
24
25 function testCallMethod() {
26 $this->wrapped->incrementPropertyValue();
27 $this->assertSame( 2, $this->wrapped->property );
28 $this->assertSame( 2, $this->raw->getProperty() );
29 }
30
31 function testCallMethodTwoArgs() {
32 $this->assertSame( 'two', $this->wrapped->whatSecondArg( 'one', 'two' ) );
33 }
34 }