Removes namescape format enforcement
This commit is contained in:
@@ -25,7 +25,7 @@ class API {
|
|||||||
function __construct() {
|
function __construct() {
|
||||||
foreach($this->_available_api_versions as $available_api_version) {
|
foreach($this->_available_api_versions as $available_api_version) {
|
||||||
$this->addEndpointNamespace(
|
$this->addEndpointNamespace(
|
||||||
sprintf('%s\%s', __NAMESPACE__, self::ENDPOINTS_LOCATION),
|
sprintf('%s\%s\%s', __NAMESPACE__, self::ENDPOINTS_LOCATION, $available_api_version),
|
||||||
$available_api_version
|
$available_api_version
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -89,9 +89,8 @@ class API {
|
|||||||
} else if(!empty($this->_endpoint_namespaces[$this->_request_api_version])) {
|
} else if(!empty($this->_endpoint_namespaces[$this->_request_api_version])) {
|
||||||
foreach($this->_endpoint_namespaces[$this->_request_api_version] as $namespace) {
|
foreach($this->_endpoint_namespaces[$this->_request_api_version] as $namespace) {
|
||||||
$endpoint_class = sprintf(
|
$endpoint_class = sprintf(
|
||||||
'%s\%s\%s',
|
'%s\%s',
|
||||||
$namespace,
|
$namespace,
|
||||||
$this->_request_api_version,
|
|
||||||
ucfirst($this->_request_endpoint)
|
ucfirst($this->_request_endpoint)
|
||||||
);
|
);
|
||||||
if(class_exists($endpoint_class)) {
|
if(class_exists($endpoint_class)) {
|
||||||
|
@@ -84,7 +84,7 @@ class APITest extends MailPoetTest {
|
|||||||
|
|
||||||
function testItAcceptsAndProcessesAPIVersion() {
|
function testItAcceptsAndProcessesAPIVersion() {
|
||||||
$namespace = array(
|
$namespace = array(
|
||||||
'name' => 'MailPoet\API\Endpoints',
|
'name' => 'MailPoet\API\Endpoints\v2',
|
||||||
'version' => 'v2'
|
'version' => 'v2'
|
||||||
);
|
);
|
||||||
$this->api->addEndpointNamespace($namespace['name'], $namespace['version']);
|
$this->api->addEndpointNamespace($namespace['name'], $namespace['version']);
|
||||||
@@ -104,7 +104,7 @@ class APITest extends MailPoetTest {
|
|||||||
|
|
||||||
function testItCallsAddedEndpoints() {
|
function testItCallsAddedEndpoints() {
|
||||||
$namespace = array(
|
$namespace = array(
|
||||||
'name' => 'MailPoet\API\Endpoints',
|
'name' => 'MailPoet\API\Endpoints\v1',
|
||||||
'version' => 'v1'
|
'version' => 'v1'
|
||||||
);
|
);
|
||||||
$this->api->addEndpointNamespace($namespace['name'], $namespace['version']);
|
$this->api->addEndpointNamespace($namespace['name'], $namespace['version']);
|
||||||
@@ -123,7 +123,7 @@ class APITest extends MailPoetTest {
|
|||||||
|
|
||||||
function testItCallsAddedEndpointsForSpecificAPIVersion() {
|
function testItCallsAddedEndpointsForSpecificAPIVersion() {
|
||||||
$namespace = array(
|
$namespace = array(
|
||||||
'name' => 'MailPoet\API\Endpoints',
|
'name' => 'MailPoet\API\Endpoints\v2',
|
||||||
'version' => 'v2'
|
'version' => 'v2'
|
||||||
);
|
);
|
||||||
$this->api->addEndpointNamespace($namespace['name'], $namespace['version']);
|
$this->api->addEndpointNamespace($namespace['name'], $namespace['version']);
|
||||||
|
Reference in New Issue
Block a user