MethodsMapTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Test case for \Magento\Framework\Profiler
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Framework\Reflection;
  9. use Magento\TestFramework\Helper\CacheCleaner;
  10. class MethodsMapTest extends \PHPUnit\Framework\TestCase
  11. {
  12. /** @var \Magento\Framework\Reflection\MethodsMap */
  13. private $object;
  14. protected function setUp()
  15. {
  16. $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
  17. $this->object = $objectManager->create(
  18. \Magento\Framework\Reflection\MethodsMap::class
  19. );
  20. }
  21. public function testGetMethodsMap()
  22. {
  23. CacheCleaner::cleanAll();
  24. $data = $this->object->getMethodsMap(\Magento\Framework\Reflection\MethodsMap::class);
  25. $this->assertArrayHasKey('getMethodsMap', $data);
  26. $cachedData = $this->object->getMethodsMap(\Magento\Framework\Reflection\MethodsMap::class);
  27. $this->assertEquals($data, $cachedData);
  28. }
  29. public function testGetMethodParams()
  30. {
  31. CacheCleaner::cleanAll();
  32. $data = $this->object->getMethodParams(
  33. \Magento\Framework\Reflection\MethodsMap::class,
  34. 'getMethodParams'
  35. );
  36. $this->assertCount(2, $data);
  37. $cachedData = $this->object->getMethodParams(
  38. \Magento\Framework\Reflection\MethodsMap::class,
  39. 'getMethodParams'
  40. );
  41. $this->assertEquals($data, $cachedData);
  42. }
  43. }