Skip to content

Commit a398195

Browse files
committed
Merge pull request #11 from magento-api/MAGETWO-32105-Move-Api-Functional-Tests
[API] MAGETWO-32105: Move api-functional tests from EE to CE
2 parents bb7d62b + c05f346 commit a398195

File tree

246 files changed

+28705
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+28705
-7
lines changed

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
"ext-curl": "*",
4949
"ext-iconv": "*",
5050
"sjparkinson/static-review": "~4.1",
51-
"fabpot/php-cs-fixer": "~1.2"
51+
"fabpot/php-cs-fixer": "~1.2",
52+
"lusitanian/oauth": "~0.3"
5253
},
5354
"replace": {
5455
"magento/module-admin-notification": "self.version",

composer.lock

+68-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/api-functional/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*.xml
2+
/var/
3+
/config/*.php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
4+
*/
5+
namespace Magento\TestModule1\Controller;
6+
7+
use Magento\Framework\App\RequestInterface;
8+
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
9+
use Magento\Framework\Stdlib\Cookie\PhpCookieManager;
10+
11+
/**
12+
* Controller for testing the CookieManager.
13+
*
14+
*/
15+
class CookieTester extends \Magento\Framework\App\Action\Action
16+
{
17+
/** @var PhpCookieManager */
18+
protected $cookieManager;
19+
20+
/** @var CookieMetadataFactory */
21+
protected $cookieMetadataFactory;
22+
23+
/**
24+
* @param \Magento\Framework\App\Action\Context $context
25+
* @param PhpCookieManager $cookieManager
26+
* @param CookieMetadataFactory $cookieMetadataFactory
27+
*/
28+
public function __construct(
29+
\Magento\Framework\App\Action\Context $context,
30+
PhpCookieManager $cookieManager,
31+
CookieMetadataFactory $cookieMetadataFactory
32+
) {
33+
$this->cookieManager = $cookieManager;
34+
$this->cookieMetadataFacory = $cookieMetadataFactory;
35+
parent::__construct($context);
36+
}
37+
38+
/**
39+
* Retrieve cookie metadata factory
40+
*/
41+
protected function getCookieMetadataFactory()
42+
{
43+
return $this->cookieMetadataFacory;
44+
}
45+
46+
/**
47+
* Retrieve cookie metadata factory
48+
*/
49+
protected function getCookieManager()
50+
{
51+
return $this->cookieManager;
52+
}
53+
54+
/**
55+
* Dispatch request
56+
*
57+
* @param RequestInterface $request
58+
* @return \Magento\Framework\App\ResponseInterface
59+
*/
60+
public function dispatch(RequestInterface $request)
61+
{
62+
if (!$this->getRequest()->isDispatched()) {
63+
parent::dispatch($request);
64+
}
65+
66+
$result = parent::dispatch($request);
67+
return $result;
68+
}
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
4+
*/
5+
namespace Magento\TestModule1\Controller\CookieTester;
6+
7+
/**
8+
* Controller to test deletion of a cookie
9+
*/
10+
class DeleteCookie extends \Magento\TestModule1\Controller\CookieTester
11+
{
12+
/**
13+
*
14+
* @return void
15+
*/
16+
public function execute()
17+
{
18+
$cookieName = $this->getRequest()->getParam('cookie_name');
19+
$this->getCookieManager()->deleteCookie($cookieName);
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
4+
*/
5+
namespace Magento\TestModule1\Controller\CookieTester;
6+
7+
/**
8+
*/
9+
class SetPublicCookie extends \Magento\TestModule1\Controller\CookieTester
10+
{
11+
/**
12+
* Sets a public cookie with data from url parameters
13+
*
14+
* @return void
15+
*/
16+
public function execute()
17+
{
18+
$publicCookieMetadata = $this->getCookieMetadataFactory()->createPublicCookieMetadata();
19+
20+
$cookieDomain = $this->getRequest()->getParam('cookie_domain');
21+
if ($cookieDomain !== null) {
22+
$publicCookieMetadata->setDomain($cookieDomain);
23+
}
24+
25+
$cookiePath = $this->getRequest()->getParam('cookie_path');
26+
if ($cookiePath !== null) {
27+
$publicCookieMetadata->setPath($cookiePath);
28+
}
29+
30+
$cookieDuration = $this->getRequest()->getParam('cookie_duration');
31+
if ($cookieDuration !== null) {
32+
$publicCookieMetadata->setDuration($cookieDuration);
33+
}
34+
35+
$httpOnly = $this->getRequest()->getParam('cookie_httponly');
36+
if ($httpOnly !== null) {
37+
$publicCookieMetadata->setHttpOnly($httpOnly);
38+
}
39+
40+
$secure = $this->getRequest()->getParam('cookie_secure');
41+
if ($secure !== null) {
42+
$publicCookieMetadata->setSecure($secure);
43+
}
44+
45+
$cookieName = $this->getRequest()->getParam('cookie_name');
46+
$cookieValue = $this->getRequest()->getParam('cookie_value');
47+
$this->getCookieManager()->setPublicCookie($cookieName, $cookieValue, $publicCookieMetadata);
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
4+
*/
5+
namespace Magento\TestModule1\Controller\CookieTester;
6+
7+
/**
8+
*/
9+
class SetSensitiveCookie extends \Magento\TestModule1\Controller\CookieTester
10+
{
11+
/**
12+
* Sets a sensitive cookie with data from url parameters
13+
*
14+
* @return void
15+
*/
16+
public function execute()
17+
{
18+
$sensitiveCookieMetadata = $this->getCookieMetadataFactory()->createSensitiveCookieMetadata();
19+
20+
$cookieDomain = $this->getRequest()->getParam('cookie_domain');
21+
if ($cookieDomain !== null) {
22+
$sensitiveCookieMetadata->setDomain($cookieDomain);
23+
}
24+
$cookiePath = $this->getRequest()->getParam('cookie_domain');
25+
if ($cookiePath !== null) {
26+
$sensitiveCookieMetadata->setPath($cookiePath);
27+
}
28+
29+
$cookieName = $this->getRequest()->getParam('cookie_name');
30+
$cookieValue = $this->getRequest()->getParam('cookie_value');
31+
$this->getCookieManager()->setSensitiveCookie($cookieName, $cookieValue, $sensitiveCookieMetadata);
32+
}
33+
}

0 commit comments

Comments
 (0)