ResponseFactoryTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\App\Test\Unit;
  7. class ResponseFactoryTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \Magento\Framework\App\ResponseFactory
  11. */
  12. protected $_model;
  13. /**
  14. * @var \PHPUnit_Framework_MockObject_MockObject
  15. */
  16. protected $_objectManagerMock;
  17. /**
  18. * @var \Magento\Framework\App\ResponseInterface
  19. */
  20. protected $_expectedObject;
  21. protected function setUp()
  22. {
  23. $this->_objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
  24. $this->_model = new \Magento\Framework\App\ResponseFactory($this->_objectManagerMock);
  25. }
  26. public function testCreate()
  27. {
  28. $this->_expectedObject = $this->getMockBuilder(\Magento\Framework\App\ResponseInterface::class)->getMock();
  29. $arguments = [['property' => 'value']];
  30. $this->_objectManagerMock->expects(
  31. $this->once()
  32. )->method(
  33. 'create'
  34. )->with(
  35. \Magento\Framework\App\ResponseInterface::class,
  36. $arguments
  37. )->will(
  38. $this->returnValue($this->_expectedObject)
  39. );
  40. $this->assertEquals($this->_expectedObject, $this->_model->create($arguments));
  41. }
  42. }