Skip to content

Commit f7499b4

Browse files
committed
WP/DeprecatedClasses: add tests for namespaced names
1 parent 42cbf42 commit f7499b4

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/*
4+
* Safeguard correct handling of all types of namespaced class name references.
5+
*/
6+
$streams = new \WP_Http_Streams();
7+
$streams = new MyNamespace\WP_Http_Streams();
8+
$streams = new \MyNamespace\WP_Http_Streams();
9+
$streams = new namespace\WP_Http_Streams();
10+
class MyClass1 extends \Services_JSON {}
11+
class MyClass2 extends MyNamespace\Services_JSON {}
12+
class MyClass3 extends \MyNamespace\Services_JSON {}
13+
class MyClass4 extends namespace\Services_JSON {}
14+
\WP_Http_Curl::do_something();
15+
MyNamespace\WP_Http_Curl::do_something();
16+
\MyNamespace\WP_Http_Curl::do_something();
17+
namespace\WP_Http_Curl::do_something();

WordPress/Tests/WP/DeprecatedClassesUnitTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ public function getErrorList( $testFile = '' ) {
3939
unset( $errors[16], $errors[18], $errors[21], $errors[26] );
4040

4141
return $errors;
42+
43+
case 'DeprecatedClassesUnitTest.2.inc':
44+
return array(
45+
6 => 1,
46+
9 => 1,
47+
10 => 1,
48+
13 => 1,
49+
14 => 1,
50+
17 => 1,
51+
);
52+
4253
default:
4354
return array();
4455
}

0 commit comments

Comments
 (0)