Skip to content

Commit

Permalink
Merge pull request #11 from magento-api/MAGETWO-32105-Move-Api-Functi…
Browse files Browse the repository at this point in the history
…onal-Tests

[API] MAGETWO-32105: Move api-functional tests from EE to CE
  • Loading branch information
vpelipenko committed Jan 6, 2015
2 parents bb7d62b + c05f346 commit a398195
Show file tree
Hide file tree
Showing 246 changed files with 28,705 additions and 7 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"ext-curl": "*",
"ext-iconv": "*",
"sjparkinson/static-review": "~4.1",
"fabpot/php-cs-fixer": "~1.2"
"fabpot/php-cs-fixer": "~1.2",
"lusitanian/oauth": "~0.3"
},
"replace": {
"magento/module-admin-notification": "self.version",
Expand Down
74 changes: 68 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dev/tests/api-functional/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*.xml
/var/
/config/*.php
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;
}
}
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);
}
}
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);
}
}
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);
}
}
Loading

0 comments on commit a398195

Please sign in to comment.