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

Public Member Functions

 testGetHttpHost ()
 
 testSetGetServerValue ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $_model = null
 

Detailed Description

Definition at line 10 of file RequestTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 17 of file RequestTest.php.

18  {
19  $this->_model = new \Magento\TestFramework\Request(
20  $this->createMock(\Magento\Framework\Stdlib\Cookie\CookieReaderInterface::class),
21  $this->createMock(\Magento\Framework\Stdlib\StringUtils::class),
22  $this->createMock(\Magento\Framework\App\Route\ConfigInterface\Proxy::class),
23  $this->createMock(\Magento\Framework\App\Request\PathInfoProcessorInterface::class),
24  $this->createMock(\Magento\Framework\ObjectManagerInterface::class)
25  );
26  }

◆ testGetHttpHost()

testGetHttpHost ( )

Definition at line 28 of file RequestTest.php.

29  {
30  $this->assertEquals('localhost', $this->_model->getHttpHost());
31  $this->assertEquals('localhost:81', $this->_model->getHttpHost(false));
32  }

◆ testSetGetServerValue()

testSetGetServerValue ( )

Definition at line 34 of file RequestTest.php.

35  {
36  $this->_model->setServer(new Parameters([]));
37  $this->assertSame([], $this->_model->getServer()->toArray());
38  $this->assertSame(
39  $this->_model,
40  $this->_model->setServer(new Parameters(['test' => 'value', 'null' => null]))
41  );
42  $this->assertSame(['test' => 'value', 'null' => null], $this->_model->getServer()->toArray());
43  $this->assertEquals('value', $this->_model->getServer('test'));
44  $this->assertSame(null, $this->_model->getServer('non-existing'));
45  $this->assertSame('default', $this->_model->getServer('non-existing', 'default'));
46  $this->assertSame(null, $this->_model->getServer('null'));
47  }

Field Documentation

◆ $_model

$_model = null
protected

Definition at line 15 of file RequestTest.php.


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