RouteParamsResolverFactoryTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Url\Test\Unit;
  7. use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
  8. class RouteParamsResolverFactoryTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /** @var \Magento\Framework\Url\RouteParamsResolverFactory */
  11. protected $object;
  12. /** @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
  13. protected $objectManager;
  14. protected function setUp()
  15. {
  16. $this->objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class);
  17. $objectManager = new ObjectManager($this);
  18. $this->object = $objectManager->getObject(
  19. \Magento\Framework\Url\RouteParamsResolverFactory::class,
  20. ['objectManager' => $this->objectManager]
  21. );
  22. }
  23. public function testCreate()
  24. {
  25. $producedInstance = $this->createMock(\Magento\Framework\Url\RouteParamsResolverInterface::class);
  26. $this->objectManager->expects($this->once())
  27. ->method('create')
  28. ->with(\Magento\Framework\Url\RouteParamsResolverInterface::class)
  29. ->will($this->returnValue($producedInstance));
  30. $this->assertSame($producedInstance, $this->object->create([]));
  31. }
  32. }