Import: Handle uploads with sha1 starting with 0 properly
[mediawiki.git] / tests / phpunit / includes / TestingAccessWrapperTest.php
blobfc54afae338176802b00370c7db6151f6359800b
1 <?php
3 class TestingAccessWrapperTest extends MediaWikiTestCase {
4 protected $raw;
5 protected $wrapped;
7 function setUp() {
8 parent::setUp();
10 require_once __DIR__ . '/../data/helpers/WellProtectedClass.php';
11 $this->raw = new WellProtectedClass();
12 $this->wrapped = TestingAccessWrapper::newFromObject( $this->raw );
15 function testGetProperty() {
16 $this->assertSame( 1, $this->wrapped->property );
17 $this->assertSame( 42, $this->wrapped->privateProperty );
18 $this->assertSame( 9000, $this->wrapped->privateParentProperty );
21 function testSetProperty() {
22 $this->wrapped->property = 10;
23 $this->assertSame( 10, $this->wrapped->property );
24 $this->assertSame( 10, $this->raw->getProperty() );
26 $this->wrapped->privateProperty = 11;
27 $this->assertSame( 11, $this->wrapped->privateProperty );
28 $this->assertSame( 11, $this->raw->getPrivateProperty() );
30 $this->wrapped->privateParentProperty = 12;
31 $this->assertSame( 12, $this->wrapped->privateParentProperty );
32 $this->assertSame( 12, $this->raw->getPrivateParentProperty() );
35 function testCallMethod() {
36 $this->wrapped->incrementPropertyValue();
37 $this->assertSame( 2, $this->wrapped->property );
38 $this->assertSame( 2, $this->raw->getProperty() );
40 $this->wrapped->incrementPrivatePropertyValue();
41 $this->assertSame( 43, $this->wrapped->privateProperty );
42 $this->assertSame( 43, $this->raw->getPrivateProperty() );
44 $this->wrapped->incrementPrivateParentPropertyValue();
45 $this->assertSame( 9001, $this->wrapped->privateParentProperty );
46 $this->assertSame( 9001, $this->raw->getPrivateParentProperty() );
49 function testCallMethodTwoArgs() {
50 $this->assertSame( 'two', $this->wrapped->whatSecondArg( 'one', 'two' ) );