init
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\PageCache\Block;
|
||||
|
||||
/**
|
||||
* Test for \Magento\PageCache\Block\Javascript
|
||||
*/
|
||||
class JavascriptTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Magento\PageCache\Block\Javascript
|
||||
*/
|
||||
protected $javascript;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\RequestInterface
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
|
||||
|
||||
$this->request = $objectManager->get(\Magento\Framework\App\RequestInterface::class);
|
||||
|
||||
$this->javascript = $objectManager->create(
|
||||
\Magento\PageCache\Block\Javascript::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetScriptOptions()
|
||||
{
|
||||
$this->request->getQuery()->set('getparameter', 1);
|
||||
$this->assertStringContainsString('?getparameter=1', $this->javascript->getScriptOptions());
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\PageCache\Block\System\Config\Form\Field;
|
||||
|
||||
/**
|
||||
* @magentoAppArea adminhtml
|
||||
*/
|
||||
class ExportTest extends \Magento\TestFramework\TestCase\AbstractBackendController
|
||||
{
|
||||
/**
|
||||
* Check Varnish export buttons
|
||||
* @covers \Magento\PageCache\Block\System\Config\Form\Field\Export::_getElementHtml
|
||||
* @magentoAppIsolation enabled
|
||||
* @magentoDbIsolation enabled
|
||||
*/
|
||||
public function testExportButtons()
|
||||
{
|
||||
$this->dispatch('backend/admin/system_config/edit/section/system/');
|
||||
$body = $this->getResponse()->getBody();
|
||||
$this->assertStringContainsString('[id^=system_full_page_cache_varnish_export_button_version]', $body);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\PageCache\Model;
|
||||
|
||||
class ConfigTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Magento\PageCache\Model\Config
|
||||
*/
|
||||
private $config;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$readFactoryMock = $this->createMock(\Magento\Framework\Filesystem\Directory\ReadFactory::class);
|
||||
$modulesDirectoryMock = $this->createMock(\Magento\Framework\Filesystem\Directory\Write::class);
|
||||
$readFactoryMock->expects(
|
||||
$this->any()
|
||||
)->method(
|
||||
'create'
|
||||
)->willReturn(
|
||||
$modulesDirectoryMock
|
||||
);
|
||||
$modulesDirectoryMock->expects(
|
||||
$this->any()
|
||||
)->method(
|
||||
'readFile'
|
||||
)->willReturn(
|
||||
file_get_contents(__DIR__ . '/_files/test.vcl')
|
||||
);
|
||||
|
||||
/** @var \PHPUnit\Framework\MockObject\MockObject $vclTemplateLocator */
|
||||
$vclTemplateLocator = $this->getMockBuilder(\Magento\PageCache\Model\Varnish\VclTemplateLocator::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['getTemplate'])
|
||||
->getMock();
|
||||
$vclTemplateLocator->expects($this->any())
|
||||
->method('getTemplate')
|
||||
->willReturn(file_get_contents(__DIR__ . '/_files/test.vcl'));
|
||||
|
||||
/** @var \PHPUnit\Framework\MockObject\MockObject $vclTemplateLocator */
|
||||
$vclGeneratorFactory = $this->getMockBuilder(\Magento\PageCache\Model\Varnish\VclGeneratorFactory::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['create'])
|
||||
->getMock();
|
||||
$expectedParams = [
|
||||
'backendHost' => 'example.com',
|
||||
'backendPort' => '8080',
|
||||
'accessList' => explode(',', '127.0.0.1,192.168.0.1,127.0.0.2'),
|
||||
'designExceptions' => json_decode('{"_":{"regexp":"\/firefox\/i","value":"Magento\/blank"}}', true),
|
||||
'sslOffloadedHeader' => 'X-Forwarded-Proto',
|
||||
'gracePeriod' => 1234
|
||||
];
|
||||
$vclGeneratorFactory->expects($this->any())
|
||||
->method('create')
|
||||
->with($expectedParams)
|
||||
->willReturn(new \Magento\PageCache\Model\Varnish\VclGenerator(
|
||||
$vclTemplateLocator,
|
||||
'example.com',
|
||||
'8080',
|
||||
explode(',', '127.0.0.1,192.168.0.1,127.0.0.2'),
|
||||
1234,
|
||||
'X-Forwarded-Proto',
|
||||
json_decode('{"_":{"regexp":"\/firefox\/i","value":"Magento\/blank"}}', true)
|
||||
));
|
||||
$this->config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
|
||||
\Magento\PageCache\Model\Config::class,
|
||||
[
|
||||
'vclGeneratorFactory' => $vclGeneratorFactory
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
/**
|
||||
* @magentoConfigFixture default/system/full_page_cache/varnish/backend_host example.com
|
||||
* @magentoConfigFixture default/system/full_page_cache/varnish/backend_port 8080
|
||||
* @magentoConfigFixture default/system/full_page_cache/varnish/grace_period 1234
|
||||
* @magentoConfigFixture default/system/full_page_cache/varnish/access_list 127.0.0.1,192.168.0.1,127.0.0.2
|
||||
* @magentoConfigFixture current_store design/theme/ua_regexp {"_":{"regexp":"\/firefox\/i","value":"Magento\/blank"}}
|
||||
* @magentoAppIsolation enabled
|
||||
*/
|
||||
// @codingStandardsIgnoreEnd
|
||||
public function testGetVclFile()
|
||||
{
|
||||
$result = $this->config->getVclFile(Config::VARNISH_6_CONFIGURATION_PATH);
|
||||
$this->assertEquals(file_get_contents(__DIR__ . '/_files/result.vcl'), $result);
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\PageCache\Model\Layout;
|
||||
|
||||
use Magento\Framework\App\Cache\Type\Layout as LayoutCache;
|
||||
use Magento\Framework\Message\Session;
|
||||
use Magento\Framework\View\Layout;
|
||||
use Magento\Framework\View\LayoutFactory;
|
||||
use Magento\TestFramework\Helper\Bootstrap;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Integration tests for \Magento\PageCache\Model\Layout\DepersonalizePlugin class.
|
||||
*
|
||||
* @magentoAppArea frontend
|
||||
*/
|
||||
class DepersonalizePluginTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Session
|
||||
*/
|
||||
private $messageSession;
|
||||
|
||||
/**
|
||||
* @var Layout
|
||||
*/
|
||||
private $layout;
|
||||
|
||||
/**
|
||||
* @var LayoutCache
|
||||
*/
|
||||
private $cache;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->messageSession = Bootstrap::getObjectManager()->get(Session::class);
|
||||
$this->layout = Bootstrap::getObjectManager()->get(LayoutFactory::class)->create();
|
||||
$this->cache = Bootstrap::getObjectManager()->get(LayoutCache::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->messageSession->clearStorage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @magentoCache full_page enabled
|
||||
* @dataProvider afterGenerateElementsDataProvider
|
||||
*
|
||||
* @param string $layout
|
||||
* @param array $expectedResult
|
||||
* @return void
|
||||
*/
|
||||
public function testAfterGenerateElements(string $layout, array $expectedResult): void
|
||||
{
|
||||
$this->cache->clean();
|
||||
$this->assertTrue($this->layout->loadFile($layout));
|
||||
$this->messageSession->setData(['some_data' => 1]);
|
||||
$this->layout->generateElements();
|
||||
$this->assertEquals($expectedResult, $this->messageSession->getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function afterGenerateElementsDataProvider(): array
|
||||
{
|
||||
return [
|
||||
'cacheable' => [
|
||||
'layout' => INTEGRATION_TESTS_DIR . '/testsuite/Magento/Framework/View/_files/layout/cacheable.xml',
|
||||
'expectedResult' => [],
|
||||
],
|
||||
'nonCacheable' => [
|
||||
'layout' => INTEGRATION_TESTS_DIR . '/testsuite/Magento/Framework/View/_files/layout/non_cacheable.xml',
|
||||
'expectedResult' => ['some_data' => 1],
|
||||
],
|
||||
'nonCacheableBlockWithoutReference' => [
|
||||
'layout' => INTEGRATION_TESTS_DIR
|
||||
. '/testsuite/Magento/Framework/View/_files/layout/non_cacheable_block_with_missing_refference.xml',
|
||||
'expectedResult' => [],
|
||||
],
|
||||
'nonCacheableBlockWithExistedReference' => [
|
||||
'layout' => INTEGRATION_TESTS_DIR
|
||||
. '/testsuite/Magento/Framework/View/_files/layout/non_cacheable_block_with_declared_reference.xml',
|
||||
'expectedResult' => ['some_data' => 1],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\PageCache\Model\Layout;
|
||||
|
||||
use Magento\Framework\View\EntitySpecificHandlesList;
|
||||
|
||||
class MergeTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @magentoAppArea frontend
|
||||
*/
|
||||
public function testLoadEntitySpecificHandleWithEsiBlock()
|
||||
{
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('Handle \'default\' must not contain blocks with \'ttl\' attribute specified');
|
||||
|
||||
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
|
||||
|
||||
// Mock cache to avoid layout being read from existing cache
|
||||
$cacheMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
|
||||
/** @var \Magento\Framework\View\Model\Layout\Merge $layoutMerge */
|
||||
$layoutMerge = $objectManager->create(
|
||||
\Magento\Framework\View\Model\Layout\Merge::class,
|
||||
['cache' => $cacheMock]
|
||||
);
|
||||
|
||||
/** @var EntitySpecificHandlesList $entitySpecificHandleList */
|
||||
$entitySpecificHandleList = $objectManager->get(EntitySpecificHandlesList::class);
|
||||
// Add 'default' handle, which has declarations of blocks with ttl, to the list of entity specific handles.
|
||||
// This allows to simulate a situation, when block with ttl attribute
|
||||
// is declared e.g. in 'catalog_product_view_id_1' handle
|
||||
$entitySpecificHandleList->addHandle('default');
|
||||
$layoutMerge->load(['default']);
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\PageCache\Model\System\Config\Backend;
|
||||
|
||||
class TtlTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Magento\PageCache\Model\System\Config\Backend\Ttl
|
||||
*/
|
||||
protected $_model;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\Config\ScopeConfigInterface
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->_config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
|
||||
->create(\Magento\Framework\App\Config\ScopeConfigInterface::class);
|
||||
$this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
|
||||
->create(\Magento\PageCache\Model\System\Config\Backend\Ttl::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider beforeSaveDataProvider
|
||||
*
|
||||
* @param $value
|
||||
* @param $path
|
||||
*/
|
||||
public function testBeforeSave($value, $path)
|
||||
{
|
||||
$this->_prepareData($value, $path);
|
||||
}
|
||||
|
||||
public function beforeSaveDataProvider()
|
||||
{
|
||||
return [
|
||||
[125, 'ttl_1'],
|
||||
[0, 'ttl_2'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider beforeSaveDataProviderWithException
|
||||
*
|
||||
* @param $value
|
||||
* @param $path
|
||||
*/
|
||||
public function testBeforeSaveWithException($value, $path)
|
||||
{
|
||||
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
|
||||
$this->_prepareData($value, $path);
|
||||
}
|
||||
|
||||
public function beforeSaveDataProviderWithException()
|
||||
{
|
||||
return [
|
||||
['', 'ttl_3'],
|
||||
['sdfg', 'ttl_4']
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $path
|
||||
*/
|
||||
protected function _prepareData($value, $path)
|
||||
{
|
||||
$this->_model->setValue($value);
|
||||
$this->_model->setPath($path);
|
||||
$this->_model->setField($path);
|
||||
$this->_model->save();
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\PageCache\Model\System\Config\Backend;
|
||||
|
||||
class VarnishTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Magento\PageCache\Model\System\Config\Backend\Varnish
|
||||
*/
|
||||
protected $_model;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\Config\MutableScopeConfigInterface
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->_config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
|
||||
\Magento\Framework\App\Config\MutableScopeConfigInterface::class
|
||||
);
|
||||
$data = [
|
||||
'access_list' => 'localhost',
|
||||
'backend_host' => 'localhost',
|
||||
'backend_port' => 8080,
|
||||
'ttl' => 120,
|
||||
];
|
||||
$this->_config->setValue('system/full_page_cache/default', $data);
|
||||
$this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
|
||||
\Magento\PageCache\Model\System\Config\Backend\Varnish::class
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider beforeSaveDataProvider
|
||||
*
|
||||
* @param $value
|
||||
* @param $path
|
||||
* @param $expected
|
||||
* @param $needUpdate
|
||||
*/
|
||||
public function testBeforeSave($value, $path, $expected, $needUpdate)
|
||||
{
|
||||
if ($needUpdate) {
|
||||
$this->_model->load($path, 'path');
|
||||
}
|
||||
|
||||
$this->_model->setValue($value);
|
||||
$this->_model->setPath($path);
|
||||
$this->_model->setField($path);
|
||||
$this->_model->save();
|
||||
$value = $this->_model->getValue();
|
||||
|
||||
$this->assertEquals($value, $expected);
|
||||
}
|
||||
|
||||
public function beforeSaveDataProvider()
|
||||
{
|
||||
return [
|
||||
['localhost', 'access_list', 'localhost', false],
|
||||
['localhost', 'backend_host', 'localhost', false],
|
||||
[8081, 'backend_port', 8081, false],
|
||||
[125, 'ttl', 125, false],
|
||||
['localhost', 'access_list', 'localhost', true],
|
||||
['', 'backend_host', 'localhost', true],
|
||||
[0, 'backend_port', 8080, true],
|
||||
[0, 'ttl', 120, true]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider afterLoadDataProvider
|
||||
*
|
||||
* @param $path
|
||||
* @param $expected
|
||||
* @param $needUpdate
|
||||
*/
|
||||
public function testAfterLoad($path, $expected, $needUpdate)
|
||||
{
|
||||
if ($needUpdate) {
|
||||
$this->_model->load($path, 'path');
|
||||
}
|
||||
$this->_model->setValue('');
|
||||
$this->_model->setPath($path);
|
||||
$this->_model->setField($path);
|
||||
$this->_model->save();
|
||||
$value = $this->_model->getValue();
|
||||
|
||||
$this->assertEquals($value, $expected);
|
||||
}
|
||||
|
||||
public function afterLoadDataProvider()
|
||||
{
|
||||
return [
|
||||
['access_list', 'localhost', true],
|
||||
['backend_host', 'localhost', true],
|
||||
['backend_port', 8080, true],
|
||||
['ttl', 120, true]
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright © Magento, Inc. All rights reserved.
|
||||
// See COPYING.txt for license details.
|
||||
example.com:8080
|
||||
|
||||
by ips:
|
||||
"127.0.0.1";
|
||||
"192.168.0.1";
|
||||
"127.0.0.2";
|
||||
|
||||
if (req.http.user-agent ~ "(?i)firefox") {
|
||||
hash_data("Magento/blank");
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright © Magento, Inc. All rights reserved.
|
||||
// See COPYING.txt for license details.
|
||||
/* {{ host }} */:/* {{ port }} */
|
||||
|
||||
by ips:
|
||||
/* {{ ips }} */
|
||||
|
||||
/* {{ design_exceptions_code }} */
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\PageCache\Observer\SwitchPageCacheOnMaintenance;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Magento\TestFramework\Helper\Bootstrap;
|
||||
|
||||
/**
|
||||
* Page Cache state test.
|
||||
*/
|
||||
class PageCacheStateTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var PageCacheState
|
||||
*/
|
||||
private $pageCacheStateStorage;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
$objectManager = Bootstrap::getObjectManager();
|
||||
$this->pageCacheStateStorage = $objectManager->get(PageCacheState::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests save state.
|
||||
*
|
||||
* @param bool $state
|
||||
* @return void
|
||||
* @dataProvider saveStateProvider
|
||||
*/
|
||||
public function testSave(bool $state): void
|
||||
{
|
||||
$this->pageCacheStateStorage->save($state);
|
||||
$this->assertEquals($state, $this->pageCacheStateStorage->isEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests flush state.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFlush(): void
|
||||
{
|
||||
$this->pageCacheStateStorage->save(true);
|
||||
$this->assertTrue($this->pageCacheStateStorage->isEnabled());
|
||||
$this->pageCacheStateStorage->flush();
|
||||
$this->assertFalse($this->pageCacheStateStorage->isEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* Save state provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function saveStateProvider(): array
|
||||
{
|
||||
return [[true], [false]];
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\PageCache\Plugin;
|
||||
|
||||
use Magento\Framework\App\FrontController;
|
||||
use Magento\Framework\App\RequestInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Magento\Framework\App\Request\Http as HttpRequest;
|
||||
use Magento\Framework\Data\Form\FormKey\Validator as FormKeyValidator;
|
||||
use Magento\TestFramework\Helper\Bootstrap;
|
||||
|
||||
class RegisterFormKeyFromCookieTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var HttpRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* @var FrontController
|
||||
*/
|
||||
private $frontController;
|
||||
|
||||
/**
|
||||
* @var FormKeyValidator
|
||||
*/
|
||||
private $formKeyValidator;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
$objectManager = Bootstrap::getObjectManager();
|
||||
$this->request = $objectManager->get(RequestInterface::class);
|
||||
$this->frontController = $objectManager->get(
|
||||
FrontController::class
|
||||
);
|
||||
$this->formKeyValidator = $objectManager->get(FormKeyValidator::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @magentoAppArea frontend
|
||||
*/
|
||||
public function testTakenFromCookie()
|
||||
{
|
||||
if (!Bootstrap::canTestHeaders()) {
|
||||
$this->markTestSkipped(
|
||||
'Can\'t test dispatch process without sending headers'
|
||||
);
|
||||
}
|
||||
$_SERVER['HTTP_HOST'] = 'localhost';
|
||||
$formKey = 'customFormKey';
|
||||
$_COOKIE['form_key'] = $formKey;
|
||||
$this->request->setMethod(HttpRequest::METHOD_POST);
|
||||
$this->request->setParam('form_key', $formKey);
|
||||
$this->request->setRequestUri('core/index/index');
|
||||
$this->frontController->dispatch($this->request);
|
||||
$this->assertTrue($this->formKeyValidator->validate($this->request));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user