-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f366eee
commit 7aadfab
Showing
3 changed files
with
41 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,13 @@ | ||
<?php | ||
namespace Df\Oro\T; | ||
use Zend_Http_Client as C; | ||
// 2017-06-01 | ||
final class Basic extends TestCase { | ||
/** 2017-06-01 */ | ||
function t01_users() { | ||
/** @var C $c */ | ||
$c = (new C) | ||
->setConfig(['timeout' => 120]) | ||
->setHeaders(['content-type' => 'application/json'] + df_oro_headers()) | ||
->setMethod(C::GET) | ||
->setUri("https://localhost.com:848/app_dev.php/api/rest/latest/users") | ||
; | ||
$c->setAdapter((new \Zend_Http_Client_Adapter_Socket)->setStreamContext([ | ||
'ssl' => ['allow_self_signed' => true, 'verify_peer' => false] | ||
])); | ||
echo df_dump(df_json_decode($c->request()->getBody())); | ||
} | ||
|
||
/** 2017-06-03 */ | ||
function t02_customers() { | ||
/** @var C $c */ | ||
$c = (new C) | ||
->setConfig(['timeout' => 120]) | ||
->setHeaders(['content-type' => 'application/json'] + df_oro_headers()) | ||
->setMethod(C::GET) | ||
->setUri("https://localhost.com:848/app_dev.php/api/extenddfcustomers") | ||
; | ||
$c->setAdapter((new \Zend_Http_Client_Adapter_Socket)->setStreamContext([ | ||
'ssl' => ['allow_self_signed' => true, 'verify_peer' => false] | ||
])); | ||
echo df_dump(df_json_decode($c->request()->getBody())); | ||
} | ||
|
||
/** | ||
* 2017-06-04 | ||
* «How to apply a filter to a «get list» Web API request?» https://oplatform.club/t/103 | ||
*/ | ||
function t03_orders() { | ||
/** @var C $c */ | ||
$c = (new C) | ||
->setConfig(['timeout' => 120]) | ||
->setHeaders(['content-type' => 'application/json'] + df_oro_headers()) | ||
->setMethod(C::GET) | ||
->setUri("https://localhost.com:848/app_dev.php/api/extenddforders?filter[product]=1") | ||
; | ||
$c->setAdapter((new \Zend_Http_Client_Adapter_Socket)->setStreamContext([ | ||
'ssl' => ['allow_self_signed' => true, 'verify_peer' => false] | ||
])); | ||
echo df_json_encode_pretty(df_json_decode($c->request()->getBody())); | ||
} | ||
|
||
/** | ||
* 2017-06-04 | ||
* «What is the difference between the «application/json» and «application/vnd.api+json» | ||
* content types of a Web API response?» https://oplatform.club/t/104 | ||
*/ | ||
function t04_orders_vnd() { | ||
/** @var C $c */ | ||
$c = (new C) | ||
->setConfig(['timeout' => 120]) | ||
->setHeaders([ | ||
'accept' => 'application/vnd.api+json' | ||
,'content-type' => 'application/vnd.api+json' | ||
] + df_oro_headers()) | ||
->setMethod(C::GET) | ||
->setUri("https://localhost.com:848/app_dev.php/api/extenddforders?filter[product]=1") | ||
; | ||
$c->setAdapter((new \Zend_Http_Client_Adapter_Socket)->setStreamContext([ | ||
'ssl' => ['allow_self_signed' => true, 'verify_peer' => false] | ||
])); | ||
echo df_json_encode_pretty(df_json_decode($c->request()->getBody())); | ||
} | ||
|
||
/** @test | ||
* 2017-06-04 | ||
* «How to include related entities to a response on a Web API «get list» request?» | ||
* https://oplatform.club/t/105 | ||
*/ | ||
function t05_orders_include() { | ||
/** @var C $c */ | ||
$c = (new C) | ||
->setConfig(['timeout' => 120]) | ||
->setHeaders([ | ||
'accept' => 'application/vnd.api+json' | ||
,'content-type' => 'application/vnd.api+json' | ||
] + df_oro_headers()) | ||
->setMethod(C::GET) | ||
->setUri("https://localhost.com:848/app_dev.php/api/extenddforders?filter[product]=1&include=product,website") | ||
; | ||
$c->setAdapter((new \Zend_Http_Client_Adapter_Socket)->setStreamContext([ | ||
'ssl' => ['allow_self_signed' => true, 'verify_peer' => false] | ||
])); | ||
echo df_json_encode_pretty(df_json_decode($c->request()->getBody())); | ||
} | ||
function t01_orders() {echo df_json_encode_pretty(df_oro_get_list( | ||
'orders', ['product' => 1], ['product', 'website'], true | ||
));} | ||
} |
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