Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
PageCache
Model
System
Config
Backend
VarnishTest.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\PageCache\Model\System\Config\Backend
;
7
8
class
VarnishTest
extends
\PHPUnit\Framework\TestCase
9
{
13
protected
$_model
;
14
18
protected
$_config
;
19
20
protected
function
setUp
()
21
{
22
$this->_config =
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
23
\
Magento
\Framework\
App
\
Config
\MutableScopeConfigInterface::class
24
);
25
$data
= [
26
'access_list'
=>
'localhost'
,
27
'backend_host'
=>
'localhost'
,
28
'backend_port'
=> 8080,
29
'ttl'
=> 120,
30
];
31
$this->_config->setValue(
'system/full_page_cache/default'
,
$data
);
32
$this->_model =
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
()->create(
33
\
Magento
\PageCache\Model\System\
Config
\Backend\Varnish::class
34
);
35
}
36
45
public
function
testBeforeSave
(
$value
,
$path
, $expected, $needUpdate)
46
{
47
if
($needUpdate) {
48
$this->_model->load(
$path
,
'path'
);
49
}
50
51
$this->_model->setValue(
$value
);
52
$this->_model->setPath(
$path
);
53
$this->_model->setField(
$path
);
54
$this->_model->save();
55
$value
= $this->_model->getValue();
56
57
$this->assertEquals(
$value
, $expected);
58
}
59
60
public
function
beforeSaveDataProvider
()
61
{
62
return
[
63
[
'localhost'
,
'access_list'
,
'localhost'
,
false
],
64
[
'localhost'
,
'backend_host'
,
'localhost'
,
false
],
65
[8081,
'backend_port'
, 8081,
false
],
66
[125,
'ttl'
, 125,
false
],
67
[
'localhost'
,
'access_list'
,
'localhost'
,
true
],
68
[
''
,
'backend_host'
,
'localhost'
,
true
],
69
[0,
'backend_port'
, 8080,
true
],
70
[0,
'ttl'
, 120,
true
]
71
];
72
}
73
81
public
function
testAfterLoad
(
$path
, $expected, $needUpdate)
82
{
83
if
($needUpdate) {
84
$this->_model->load(
$path
,
'path'
);
85
}
86
$this->_model->setValue(
''
);
87
$this->_model->setPath(
$path
);
88
$this->_model->setField(
$path
);
89
$this->_model->save();
90
$value
= $this->_model->getValue();
91
92
$this->assertEquals(
$value
, $expected);
93
}
94
95
public
function
afterLoadDataProvider
()
96
{
97
return
[
98
[
'access_list'
,
'localhost'
,
true
],
99
[
'backend_host'
,
'localhost'
,
true
],
100
[
'backend_port'
, 8080,
true
],
101
[
'ttl'
, 120,
true
]
102
];
103
}
104
}
Magento\PageCache\Model\System\Config\Backend\VarnishTest
Definition:
VarnishTest.php:8
Magento\Framework\App
Magento\PageCache\Model\System\Config\Backend\VarnishTest\beforeSaveDataProvider
beforeSaveDataProvider()
Definition:
VarnishTest.php:60
Magento\PageCache\Model\System\Config\Backend\VarnishTest\testBeforeSave
testBeforeSave($value, $path, $expected, $needUpdate)
Definition:
VarnishTest.php:45
Magento\PageCache\Model\System\Config\Backend\VarnishTest\$_model
$_model
Definition:
VarnishTest.php:13
Magento\PageCache\Model\System\Config\Backend\VarnishTest\afterLoadDataProvider
afterLoadDataProvider()
Definition:
VarnishTest.php:95
Magento\PageCache\Model\System\Config\Backend
Definition:
TtlTest.php:6
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$value
$value
Definition:
gender.phtml:16
Magento\PageCache\Model\Config
Definition:
Config.php:21
Magento
Magento\PageCache\Model\System\Config\Backend\VarnishTest\setUp
setUp()
Definition:
VarnishTest.php:20
Magento\PageCache\Model\System\Config\Backend\VarnishTest\testAfterLoad
testAfterLoad($path, $expected, $needUpdate)
Definition:
VarnishTest.php:81
Magento\PageCache\Model\System\Config\Backend\VarnishTest\$_config
$_config
Definition:
VarnishTest.php:18
$path
$path
Definition:
import_with_filesystem_images.php:14
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125