diff --git tests/phpunit/includes/class-basic-object.php tests/phpunit/includes/class-basic-object.php
new file mode 100644
index 0000000..569ec54
-
|
+
|
|
| 1 | <?php |
| 2 | /** |
| 3 | * Unit Tests: Basic_Object class |
| 4 | * |
| 5 | * @package WordPress |
| 6 | * @subpackage UnitTests |
| 7 | * @since 4.6.0 |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * Class used to test accessing methods and properties. |
| 12 | * |
| 13 | * @since 4.0.0 |
| 14 | */ |
| 15 | class Basic_Object { |
| 16 | private $foo = 'bar'; |
| 17 | |
| 18 | public function __get( $name ) { |
| 19 | return $this->$name; |
| 20 | } |
| 21 | |
| 22 | public function __set( $name, $value ) { |
| 23 | return $this->$name = $value; |
| 24 | } |
| 25 | |
| 26 | public function __isset( $name ) { |
| 27 | return isset( $this->$name ); |
| 28 | } |
| 29 | |
| 30 | public function __unset( $name ) { |
| 31 | unset( $this->$name ); |
| 32 | } |
| 33 | |
| 34 | public function __call( $name, $arguments ) { |
| 35 | return call_user_func_array( array( $this, $name ), $arguments ); |
| 36 | } |
| 37 | |
| 38 | private function callMe() { |
| 39 | return 'maybe'; |
| 40 | } |
| 41 | } |
diff --git tests/phpunit/includes/class-basic-subclass.php tests/phpunit/includes/class-basic-subclass.php
new file mode 100644
index 0000000..2108c09
-
|
+
|
|
| 1 | <?php |
| 2 | /** |
| 3 | * Unit Tests: Basic_Subclass class |
| 4 | * |
| 5 | * @package WordPress |
| 6 | * @subpackage UnitTests |
| 7 | * @since 4.6.0 |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * Class used to test accessing methods and properties. |
| 12 | * |
| 13 | * @since 4.0.0 |
| 14 | */ |
| 15 | class Basic_Subclass extends Basic_Object {} |
diff --git tests/phpunit/includes/functions.php tests/phpunit/includes/functions.php
index 370d837..be95192 100644
|
|
function _delete_all_posts() { |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | | class Basic_Object { |
62 | | private $foo = 'bar'; |
63 | | |
64 | | public function __get( $name ) { |
65 | | return $this->$name; |
66 | | } |
67 | | |
68 | | public function __set( $name, $value ) { |
69 | | return $this->$name = $value; |
70 | | } |
71 | | |
72 | | public function __isset( $name ) { |
73 | | return isset( $this->$name ); |
74 | | } |
75 | | |
76 | | public function __unset( $name ) { |
77 | | unset( $this->$name ); |
78 | | } |
79 | | |
80 | | public function __call( $name, $arguments ) { |
81 | | return call_user_func_array( array( $this, $name ), $arguments ); |
82 | | } |
83 | | |
84 | | private function callMe() { |
85 | | return 'maybe'; |
86 | | } |
87 | | } |
88 | | |
89 | | class Basic_Subclass extends Basic_Object {} |
90 | | |
91 | 61 | function _wp_die_handler( $message, $title = '', $args = array() ) { |
92 | 62 | if ( !$GLOBALS['_wp_die_disabled'] ) { |
93 | 63 | _wp_die_handler_txt( $message, $title, $args); |
… |
… |
function _upload_dir_no_subdir( $uploads ) { |
147 | 117 | |
148 | 118 | /** |
149 | 119 | * Helper used with the `upload_dir` filter to set https upload URL. |
150 | | */ |
| 120 | */ |
151 | 121 | function _upload_dir_https( $uploads ) { |
152 | 122 | $uploads['url'] = str_replace( 'http://', 'https://', $uploads['url'] ); |
153 | 123 | $uploads['baseurl'] = str_replace( 'http://', 'https://', $uploads['baseurl'] ); |
diff --git tests/phpunit/tests/basic.php tests/phpunit/tests/basic.php
index f68fbeb..1225ae3 100644
|
|
|
1 | 1 | <?php |
| 2 | |
| 3 | require_once dirname( dirname( __FILE__ ) ) . '/includes/class-basic-object.php'; |
| 4 | require_once dirname( dirname( __FILE__ ) ) . '/includes/class-basic-subclass.php'; |
| 5 | |
2 | 6 | /** |
3 | 7 | * just make sure the test framework is working |
4 | 8 | * |