-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 #11 from magento-api/MAGETWO-32105-Move-Api-Functi…
…onal-Tests [API] MAGETWO-32105: Move api-functional tests from EE to CE
- Loading branch information
Showing
246 changed files
with
28,705 additions
and
7 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,3 @@ | ||
/*.xml | ||
/var/ | ||
/config/*.php |
69 changes: 69 additions & 0 deletions
69
dev/tests/api-functional/_files/Magento/TestModule1/Controller/CookieTester.php
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,69 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) | ||
*/ | ||
namespace Magento\TestModule1\Controller; | ||
|
||
use Magento\Framework\App\RequestInterface; | ||
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory; | ||
use Magento\Framework\Stdlib\Cookie\PhpCookieManager; | ||
|
||
/** | ||
* Controller for testing the CookieManager. | ||
* | ||
*/ | ||
class CookieTester extends \Magento\Framework\App\Action\Action | ||
{ | ||
/** @var PhpCookieManager */ | ||
protected $cookieManager; | ||
|
||
/** @var CookieMetadataFactory */ | ||
protected $cookieMetadataFactory; | ||
|
||
/** | ||
* @param \Magento\Framework\App\Action\Context $context | ||
* @param PhpCookieManager $cookieManager | ||
* @param CookieMetadataFactory $cookieMetadataFactory | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\App\Action\Context $context, | ||
PhpCookieManager $cookieManager, | ||
CookieMetadataFactory $cookieMetadataFactory | ||
) { | ||
$this->cookieManager = $cookieManager; | ||
$this->cookieMetadataFacory = $cookieMetadataFactory; | ||
parent::__construct($context); | ||
} | ||
|
||
/** | ||
* Retrieve cookie metadata factory | ||
*/ | ||
protected function getCookieMetadataFactory() | ||
{ | ||
return $this->cookieMetadataFacory; | ||
} | ||
|
||
/** | ||
* Retrieve cookie metadata factory | ||
*/ | ||
protected function getCookieManager() | ||
{ | ||
return $this->cookieManager; | ||
} | ||
|
||
/** | ||
* Dispatch request | ||
* | ||
* @param RequestInterface $request | ||
* @return \Magento\Framework\App\ResponseInterface | ||
*/ | ||
public function dispatch(RequestInterface $request) | ||
{ | ||
if (!$this->getRequest()->isDispatched()) { | ||
parent::dispatch($request); | ||
} | ||
|
||
$result = parent::dispatch($request); | ||
return $result; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
dev/tests/api-functional/_files/Magento/TestModule1/Controller/CookieTester/DeleteCookie.php
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,21 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) | ||
*/ | ||
namespace Magento\TestModule1\Controller\CookieTester; | ||
|
||
/** | ||
* Controller to test deletion of a cookie | ||
*/ | ||
class DeleteCookie extends \Magento\TestModule1\Controller\CookieTester | ||
{ | ||
/** | ||
* | ||
* @return void | ||
*/ | ||
public function execute() | ||
{ | ||
$cookieName = $this->getRequest()->getParam('cookie_name'); | ||
$this->getCookieManager()->deleteCookie($cookieName); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...sts/api-functional/_files/Magento/TestModule1/Controller/CookieTester/SetPublicCookie.php
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,49 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) | ||
*/ | ||
namespace Magento\TestModule1\Controller\CookieTester; | ||
|
||
/** | ||
*/ | ||
class SetPublicCookie extends \Magento\TestModule1\Controller\CookieTester | ||
{ | ||
/** | ||
* Sets a public cookie with data from url parameters | ||
* | ||
* @return void | ||
*/ | ||
public function execute() | ||
{ | ||
$publicCookieMetadata = $this->getCookieMetadataFactory()->createPublicCookieMetadata(); | ||
|
||
$cookieDomain = $this->getRequest()->getParam('cookie_domain'); | ||
if ($cookieDomain !== null) { | ||
$publicCookieMetadata->setDomain($cookieDomain); | ||
} | ||
|
||
$cookiePath = $this->getRequest()->getParam('cookie_path'); | ||
if ($cookiePath !== null) { | ||
$publicCookieMetadata->setPath($cookiePath); | ||
} | ||
|
||
$cookieDuration = $this->getRequest()->getParam('cookie_duration'); | ||
if ($cookieDuration !== null) { | ||
$publicCookieMetadata->setDuration($cookieDuration); | ||
} | ||
|
||
$httpOnly = $this->getRequest()->getParam('cookie_httponly'); | ||
if ($httpOnly !== null) { | ||
$publicCookieMetadata->setHttpOnly($httpOnly); | ||
} | ||
|
||
$secure = $this->getRequest()->getParam('cookie_secure'); | ||
if ($secure !== null) { | ||
$publicCookieMetadata->setSecure($secure); | ||
} | ||
|
||
$cookieName = $this->getRequest()->getParam('cookie_name'); | ||
$cookieValue = $this->getRequest()->getParam('cookie_value'); | ||
$this->getCookieManager()->setPublicCookie($cookieName, $cookieValue, $publicCookieMetadata); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
.../api-functional/_files/Magento/TestModule1/Controller/CookieTester/SetSensitiveCookie.php
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,33 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) | ||
*/ | ||
namespace Magento\TestModule1\Controller\CookieTester; | ||
|
||
/** | ||
*/ | ||
class SetSensitiveCookie extends \Magento\TestModule1\Controller\CookieTester | ||
{ | ||
/** | ||
* Sets a sensitive cookie with data from url parameters | ||
* | ||
* @return void | ||
*/ | ||
public function execute() | ||
{ | ||
$sensitiveCookieMetadata = $this->getCookieMetadataFactory()->createSensitiveCookieMetadata(); | ||
|
||
$cookieDomain = $this->getRequest()->getParam('cookie_domain'); | ||
if ($cookieDomain !== null) { | ||
$sensitiveCookieMetadata->setDomain($cookieDomain); | ||
} | ||
$cookiePath = $this->getRequest()->getParam('cookie_domain'); | ||
if ($cookiePath !== null) { | ||
$sensitiveCookieMetadata->setPath($cookiePath); | ||
} | ||
|
||
$cookieName = $this->getRequest()->getParam('cookie_name'); | ||
$cookieValue = $this->getRequest()->getParam('cookie_value'); | ||
$this->getCookieManager()->setSensitiveCookie($cookieName, $cookieValue, $sensitiveCookieMetadata); | ||
} | ||
} |
Oops, something went wrong.