mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
Add missing access modifiers to methods in WP_Query. Add magic methods for __get(), __set(), __isset(), __unset(), and __call().
Add unit test for magic methods. See #27881, #22234. git-svn-id: https://develop.svn.wordpress.org/trunk@28523 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -49,6 +49,18 @@ class Basic_Object {
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
public function __set( $name, $value ) {
|
||||
return $this->$name = $value;
|
||||
}
|
||||
|
||||
public function __isset( $name ) {
|
||||
return isset( $this->$name );
|
||||
}
|
||||
|
||||
public function __unset( $name ) {
|
||||
unset( $this->$name );
|
||||
}
|
||||
|
||||
public function __call( $name, $arguments ) {
|
||||
return call_user_func_array( array( $this, $name ), $arguments );
|
||||
}
|
||||
|
||||
@@ -145,4 +145,18 @@ EOF;
|
||||
|
||||
$this->assertEquals( 'maybe', $basic->callMe() );
|
||||
}
|
||||
|
||||
function test_subclass_isset() {
|
||||
$basic = new Basic_Subclass();
|
||||
|
||||
$this->assertTrue( isset( $basic->foo ) );
|
||||
}
|
||||
|
||||
function test_subclass_unset() {
|
||||
$basic = new Basic_Subclass();
|
||||
|
||||
unset( $basic->foo );
|
||||
|
||||
$this->assertFalse( isset( $basic->foo ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user