-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from BurdaMagazinOrg/feature/DRPLDCX-68/unit-t…
…ests-dcx-integration DRPLDCX-68 Test for article archiving
- Loading branch information
Showing
5 changed files
with
132 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Drupal\Tests\dcx_integration; | ||
|
||
interface DcxApiClientInterface { | ||
|
||
public function getObject($url, array $params, &$data); | ||
|
||
public function createObject($url, array $params, array $data, &$response_body); | ||
|
||
public function setObject($url, array $params, array $data, &$response_body); | ||
|
||
public function deleteObject($url, array $params, &$response_body); | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Drupal\Tests\dcx_integration; | ||
|
||
/** | ||
* Dummy API client class which allows introspection of called methods and | ||
* arguments for testing. | ||
*/ | ||
class DummyDcxApiClient /* implement DcxApiClientInterface */{ | ||
|
||
/** | ||
* | ||
* @var string name of the last method call on this object | ||
*/ | ||
public $method; | ||
/** | ||
* | ||
* @var mixed arguments of the last call | ||
*/ | ||
public $args; | ||
|
||
/** | ||
* Magic method which is triggered when invoking inaccessible methods in an | ||
* object context. | ||
*/ | ||
public function __call($method, $args) { | ||
if (isset($this->$method)) { | ||
$this->method = $method; | ||
$this->args = $args; | ||
|
||
$func = $this->$method; | ||
return call_user_func_array($func, $args); | ||
} | ||
} | ||
|
||
public function createObject($url, array $params, array $data, &$response_body) { | ||
$this->method = __FUNCTION__; // __METHOD__ would return namespaced value | ||
$this->args = func_get_args(); | ||
|
||
// Provides means to manipulate $response_body | ||
$response_body = isset($this->expected_response_body)?$this->expected_response_body:$response_body; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters