Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
RequestFactoryTest.php
Go to the documentation of this file.
1 <?php
7 
8 use \Magento\Framework\App\RequestFactory;
9 
10 class RequestFactoryTest extends \PHPUnit\Framework\TestCase
11 {
15  protected $model;
16 
20  protected $objectManagerMock;
21 
22  protected function setUp()
23  {
24  $this->objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
25  $this->model = new RequestFactory($this->objectManagerMock);
26  }
27 
32  public function testCreate()
33  {
34  $arguments = ['some_key' => 'same_value'];
35 
36  $appRequest = $this->createMock(\Magento\Framework\App\RequestInterface::class);
37 
38  $this->objectManagerMock->expects($this->once())
39  ->method('create')
40  ->with(\Magento\Framework\App\RequestInterface::class, $arguments)
41  ->will($this->returnValue($appRequest));
42 
43  $this->assertEquals($appRequest, $this->model->create($arguments));
44  }
45 }
$arguments