MapperTest.php 1004 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Analytics\Test\Unit\ReportXml\Config;
  7. use Magento\Analytics\ReportXml\Config\Mapper;
  8. class MapperTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /**
  11. * @var Mapper
  12. */
  13. private $mapper;
  14. protected function setUp()
  15. {
  16. $this->mapper = new Mapper();
  17. }
  18. public function testExecute()
  19. {
  20. $configData['config'][0]['report'] = [
  21. [
  22. 'source' => ['product'],
  23. 'name' => 'Product',
  24. ]
  25. ];
  26. $expectedResult = [
  27. 'Product' => [
  28. 'source' => 'product',
  29. 'name' => 'Product',
  30. ]
  31. ];
  32. $this->assertEquals($this->mapper->execute($configData), $expectedResult);
  33. }
  34. public function testExecuteWithoutReports()
  35. {
  36. $configData = [];
  37. $this->assertEquals($this->mapper->execute($configData), []);
  38. }
  39. }