Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
ConfigFixtureTest Class Reference
Inheritance diagram for ConfigFixtureTest:

Public Member Functions

 testGlobalConfig ()
 
 testCurrentStoreConfig ()
 
 testSpecificStoreConfig ()
 
 testInitStoreAfterOfScope ()
 
 testInitStoreAfter ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $_object
 

Detailed Description

Definition at line 12 of file ConfigFixtureTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 19 of file ConfigFixtureTest.php.

20  {
21  $this->_object = $this->createPartialMock(
22  \Magento\TestFramework\Annotation\ConfigFixture::class,
23  ['_getConfigValue', '_setConfigValue']
24  );
25  }

◆ testCurrentStoreConfig()

testCurrentStoreConfig ( )

@magentoConfigFixture current_store dev/restrict/allow_ips 192.168.0.1

Definition at line 65 of file ConfigFixtureTest.php.

66  {
67  $this->_object->expects(
68  $this->at(0)
69  )->method(
70  '_getConfigValue'
71  )->with(
72  'dev/restrict/allow_ips',
73  ''
74  )->will(
75  $this->returnValue('127.0.0.1')
76  );
77  $this->_object->expects(
78  $this->at(1)
79  )->method(
80  '_setConfigValue'
81  )->with(
82  'dev/restrict/allow_ips',
83  '192.168.0.1',
84  ''
85  );
86  $this->_object->startTest($this);
87 
88  $this->_object->expects(
89  $this->once()
90  )->method(
91  '_setConfigValue'
92  )->with(
93  'dev/restrict/allow_ips',
94  '127.0.0.1',
95  ''
96  );
97  $this->_object->endTest($this);
98  }

◆ testGlobalConfig()

testGlobalConfig ( )

@magentoConfigFixture current_store web/unsecure/base_url http://example.com/

Definition at line 30 of file ConfigFixtureTest.php.

31  {
32  $this->_object->expects(
33  $this->at(0)
34  )->method(
35  '_getConfigValue'
36  )->with(
37  'web/unsecure/base_url'
38  )->will(
39  $this->returnValue('http://localhost/')
40  );
41  $this->_object->expects(
42  $this->at(1)
43  )->method(
44  '_setConfigValue'
45  )->with(
46  'web/unsecure/base_url',
47  'http://example.com/'
48  );
49  $this->_object->startTest($this);
50 
51  $this->_object->expects(
52  $this->once()
53  )->method(
54  '_setConfigValue'
55  )->with(
56  'web/unsecure/base_url',
57  'http://localhost/'
58  );
59  $this->_object->endTest($this);
60  }

◆ testInitStoreAfter()

testInitStoreAfter ( )

@magentoConfigFixture current_store web/unsecure/base_url http://example.com/

Definition at line 148 of file ConfigFixtureTest.php.

149  {
150  $this->_object->startTest($this);
151  $this->_object->expects(
152  $this->at(0)
153  )->method(
154  '_getConfigValue'
155  )->with(
156  'web/unsecure/base_url'
157  )->will(
158  $this->returnValue('http://localhost/')
159  );
160  $this->_object->expects(
161  $this->at(1)
162  )->method(
163  '_setConfigValue'
164  )->with(
165  'web/unsecure/base_url',
166  'http://example.com/'
167  );
168  $this->_object->initStoreAfter();
169  }

◆ testInitStoreAfterOfScope()

testInitStoreAfterOfScope ( )

Definition at line 138 of file ConfigFixtureTest.php.

139  {
140  $this->_object->expects($this->never())->method('_getConfigValue');
141  $this->_object->expects($this->never())->method('_setConfigValue');
142  $this->_object->initStoreAfter();
143  }

◆ testSpecificStoreConfig()

testSpecificStoreConfig ( )

@magentoConfigFixture admin_store dev/restrict/allow_ips 192.168.0.2

Definition at line 103 of file ConfigFixtureTest.php.

104  {
105  $this->_object->expects(
106  $this->at(0)
107  )->method(
108  '_getConfigValue'
109  )->with(
110  'dev/restrict/allow_ips',
111  'admin'
112  )->will(
113  $this->returnValue('192.168.0.1')
114  );
115  $this->_object->expects(
116  $this->at(1)
117  )->method(
118  '_setConfigValue'
119  )->with(
120  'dev/restrict/allow_ips',
121  '192.168.0.2',
122  'admin'
123  );
124  $this->_object->startTest($this);
125 
126  $this->_object->expects(
127  $this->once()
128  )->method(
129  '_setConfigValue'
130  )->with(
131  'dev/restrict/allow_ips',
132  '192.168.0.1',
133  'admin'
134  );
135  $this->_object->endTest($this);
136  }

Field Documentation

◆ $_object

$_object
protected

Definition at line 17 of file ConfigFixtureTest.php.


The documentation for this class was generated from the following file: