HttpMethodMapTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Framework\App\Test\Unit\Request;
  8. use Magento\Framework\App\Request\HttpMethodMap;
  9. use PHPUnit\Framework\TestCase;
  10. class HttpMethodMapTest extends TestCase
  11. {
  12. /**
  13. * Test filtering of interface names.
  14. */
  15. public function testFilter()
  16. {
  17. $map = new HttpMethodMap(
  18. ['method1' => '\\Throwable', 'method2' => 'DateTime']
  19. );
  20. $this->assertEquals(
  21. ['method1' => \Throwable::class, 'method2' => \DateTime::class],
  22. $map->getMap()
  23. );
  24. }
  25. /**
  26. * Test validation of interface names.
  27. *
  28. * @expectedException \InvalidArgumentException
  29. */
  30. public function testExisting()
  31. {
  32. new HttpMethodMap(['method1' => 'NonExistingClass']);
  33. }
  34. /**
  35. * Test validation of method names.
  36. *
  37. * @expectedException \InvalidArgumentException
  38. */
  39. public function testMethod()
  40. {
  41. new HttpMethodMap([\Throwable::class]);
  42. }
  43. }