ConfigTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Search\Test\Unit\Model\SearchEngine;
  7. class ConfigTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /** @var \Magento\Search\Model\SearchEngine\Config\Data|\PHPUnit_Framework_MockObject_MockObject */
  10. protected $dataStorageMock;
  11. /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */
  12. protected $objectManager;
  13. protected function setUp()
  14. {
  15. $this->dataStorage = $this->createMock(\Magento\Search\Model\SearchEngine\Config\Data::class);
  16. $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  17. }
  18. public function testGetDeclaredFeatures()
  19. {
  20. $config = $this->objectManager->getObject(
  21. \Magento\Search\Model\SearchEngine\Config::class,
  22. ['dataStorage' => $this->dataStorage]
  23. );
  24. $this->dataStorage->expects($this->once())->method('get')->with('mysql')->willReturn(['synonyms']);
  25. $this->assertEquals(['synonyms'], $config->getDeclaredFeatures('mysql'));
  26. }
  27. public function testIsFeatureSupported()
  28. {
  29. $config = $this->objectManager->getObject(
  30. \Magento\Search\Model\SearchEngine\Config::class,
  31. ['dataStorage' => $this->dataStorage]
  32. );
  33. $this->dataStorage->expects($this->once())->method('get')->with('mysql')->willReturn(['synonyms']);
  34. $this->assertEquals(true, $config->isFeatureSupported('synonyms', 'mysql'));
  35. }
  36. }